Package | shared.math |
Class | public class Vec2Const |
Inheritance | Vec2Const ![]() |
Subclasses | Vec2 |
See also
Property | Defined By | ||
---|---|---|---|
angle : Number [read-only] Vector angle in radians | Vec2Const | ||
length : Number [read-only] Computes the length of the vector | Vec2Const | ||
x : Number [read-only] X component (read-only) | Vec2Const | ||
y : Number [read-only] Y component (read-only) | Vec2Const |
Method | Defined By | ||
---|---|---|---|
Vec2Const(x:Number = 0, y:Number = 0) | Vec2Const | ||
Adds "pos" vector (returns a new Vec2) | Vec2Const | ||
Adds ("x", "y") (returns a new Vec2) | Vec2Const | ||
Returns a new Vec2 clamped to "maxLen" length | Vec2Const | ||
clampInRect(rectangle:Rectangle):Vec2 Clamps this vector to fit in the specified "rectangle" (returns a new Vec2) | Vec2Const | ||
Clamps this vector to specified components (returns a new Vec2) | Vec2Const | ||
Returns a new Vec2, replica of this instance | Vec2Const | ||
Computes the cross product (determinant) with "vec" | Vec2Const | ||
crossDetXY(x:Number, y:Number):Number Computes the cross product (determinant) with ("x", "y")) | Vec2Const | ||
Computes the distance from "vec" vector | Vec2Const | ||
distanceSqr(vec:Vec2Const):Number Computes the squared distance from "vec" vector | Vec2Const | ||
distanceXY(x:Number, y:Number):Number Computes the distance from ("x", "y") | Vec2Const | ||
distanceXYSqr(x:Number, y:Number):Number Computes the distance from ("x", "y") | Vec2Const | ||
Divides by "vec" vector (returns a new Vec2) | Vec2Const | ||
Divides by ("x", "y") (returns a new Vec2) | Vec2Const | ||
Computes the dot product with "vec" vector | Vec2Const | ||
dotXY(x:Number, y:Number):Number Computes the dot product with "vec" vector | Vec2Const | ||
Returns true if this vector's components equal the ones of "vec" | Vec2Const | ||
equalsXY(x:Number, y:Number):Boolean Returns true if this vector's components equal ("x", "y") | Vec2Const | ||
Returns a new Vec2 with negated components | Vec2Const | ||
getDegrees():Number Vector angle in degrees | Vec2Const | ||
Returns a new Vec2 which is the maximum between this vector and "vec" (component-wise) | Vec2Const | ||
Returns a new Vec2 which is the minimum between this vector and "vec" (component-wise) | Vec2Const | ||
getRads():Number Vector angle in radians | Vec2Const | ||
getRadsBetween(vec:Vec2Const):Number Angle between this vector and "vec" in radians | Vec2Const | ||
Returns true if this vector is near "vec2" | Vec2Const | ||
isNearXY(x:Number, y:Number):Boolean Returns true if this vector is near ("x", "y") | Vec2Const | ||
isNormalized():Boolean Returns true if this vector is normalized (length == 1) | Vec2Const | ||
isValid():Boolean Returns true if is a valid vector (has finite components) | Vec2Const | ||
Returns true if the distance from "vec2" vector is lesser than "epsilon" | Vec2Const | ||
isWithinXY(x:Number, y:Number, epsilon:Number):Boolean Returns true if the distance from ("x", "y") vector is lesser than "epsilon" | Vec2Const | ||
isZero():Boolean Returns true if this vector's components are 0 | Vec2Const | ||
lengthSqr():Number Computes the squared length of the vector | Vec2Const | ||
Linear interpolation from this vector to "to" vector (returns a new Vec2) | Vec2Const | ||
Multiplies by "vec" vector (returns a new Vec2) | Vec2Const | ||
Multiplies by ("x", "y") (returns a new Vec2) | Vec2Const | ||
Normalizes the vector (returns a new Vec2) | Vec2Const | ||
Returns a new Vec2 left-perpendicular to this vector | Vec2Const | ||
Returns a new Vec2 right-perpendicular to this vector | Vec2Const | ||
Reflect this vector in plane whose normal is "normal" (returns a new Vec2) | Vec2Const | ||
Rotates by "rads" radians (returns a new Vec2) | Vec2Const | ||
Rotates using spinor "vec" (returns a new Vec2) | Vec2Const | ||
Scales by the scalar "s" (returns a new Vec2) | Vec2Const | ||
Spherical linear interpolation from this vector to "to" vector (returns a new Vec2) - not thoroughly tested
Note: this vector and "vec" MUST be orthogonal for it to work properly
| Vec2Const | ||
Gets spinor between this vector and "vec" (returns a new Vec2) | Vec2Const | ||
Subtracts "pos" vector (returns a new Vec2) | Vec2Const | ||
Subtracts ("x", "y") (returns a new Vec2) | Vec2Const | ||
toPoint():Point Creates an AS3 Point from this vector | Vec2Const | ||
toString():String String representation of this vector (uses Vec2Const.stringDecimals decimal positions) | Vec2Const | ||
Returns a new Vec2 which is a unit for this vector (same as normalize(1)) | Vec2Const |
angle | property |
angle:Number
[read-only] Vector angle in radians
public function get angle():Number
length | property |
length:Number
[read-only] Computes the length of the vector
public function get length():Number
x | property |
x:Number
[read-only] X component (read-only)
public function get x():Number
y | property |
y:Number
[read-only] Y component (read-only)
public function get y():Number
Vec2Const | () | Constructor |
public function Vec2Const(x:Number = 0, y:Number = 0)
x:Number (default = 0 )
| |
y:Number (default = 0 )
|
add | () | method |
public function add(pos:Vec2Const):Vec2
Adds "pos" vector (returns a new Vec2)
Parameters
pos:Vec2Const |
Vec2 |
addXY | () | method |
public function addXY(x:Number, y:Number):Vec2
Adds ("x", "y") (returns a new Vec2)
Parameters
x:Number | |
y:Number |
Vec2 |
clamp | () | method |
public function clamp(maxLen:Number):Vec2
Returns a new Vec2 clamped to "maxLen" length
Parameters
maxLen:Number |
Vec2 |
clampInRect | () | method |
public function clampInRect(rectangle:Rectangle):Vec2
Clamps this vector to fit in the specified "rectangle" (returns a new Vec2)
Parameters
rectangle:Rectangle |
Vec2 |
clampXY | () | method |
public function clampXY(minX:Number, maxX:Number, minY:Number, maxY:Number):Vec2
Clamps this vector to specified components (returns a new Vec2)
Parameters
minX:Number | |
maxX:Number | |
minY:Number | |
maxY:Number |
Vec2 |
clone | () | method |
crossDet | () | method |
public function crossDet(vec:Vec2Const):Number
Computes the cross product (determinant) with "vec"
Parameters
vec:Vec2Const |
Number |
crossDetXY | () | method |
public function crossDetXY(x:Number, y:Number):Number
Computes the cross product (determinant) with ("x", "y"))
Parameters
x:Number | |
y:Number |
Number |
distance | () | method |
public function distance(vec:Vec2Const):Number
Computes the distance from "vec" vector
Parameters
vec:Vec2Const |
Number |
distanceSqr | () | method |
public function distanceSqr(vec:Vec2Const):Number
Computes the squared distance from "vec" vector
Parameters
vec:Vec2Const |
Number |
distanceXY | () | method |
public function distanceXY(x:Number, y:Number):Number
Computes the distance from ("x", "y")
Parameters
x:Number | |
y:Number |
Number |
distanceXYSqr | () | method |
public function distanceXYSqr(x:Number, y:Number):Number
Computes the distance from ("x", "y")
Parameters
x:Number | |
y:Number |
Number |
div | () | method |
public function div(vec:Vec2Const):Vec2
Divides by "vec" vector (returns a new Vec2)
Parameters
vec:Vec2Const |
Vec2 |
divXY | () | method |
public function divXY(x:Number, y:Number):Vec2
Divides by ("x", "y") (returns a new Vec2)
Parameters
x:Number | |
y:Number |
Vec2 |
dot | () | method |
public function dot(vec:Vec2Const):Number
Computes the dot product with "vec" vector
Parameters
vec:Vec2Const |
Number |
dotXY | () | method |
public function dotXY(x:Number, y:Number):Number
Computes the dot product with "vec" vector
Parameters
x:Number | |
y:Number |
Number |
equals | () | method |
public function equals(vec:Vec2Const):Boolean
Returns true if this vector's components equal the ones of "vec"
Parameters
vec:Vec2Const |
Boolean |
equalsXY | () | method |
public function equalsXY(x:Number, y:Number):Boolean
Returns true if this vector's components equal ("x", "y")
Parameters
x:Number | |
y:Number |
Boolean |
flip | () | method |
getDegrees | () | method |
public function getDegrees():Number
Vector angle in degrees
ReturnsNumber |
getMax | () | method |
public function getMax(vec:Vec2Const):Vec2
Returns a new Vec2 which is the maximum between this vector and "vec" (component-wise)
Parameters
vec:Vec2Const |
Vec2 |
getMin | () | method |
public function getMin(vec:Vec2Const):Vec2
Returns a new Vec2 which is the minimum between this vector and "vec" (component-wise)
Parameters
vec:Vec2Const |
Vec2 |
getRads | () | method |
public function getRads():Number
Vector angle in radians
ReturnsNumber |
getRadsBetween | () | method |
public function getRadsBetween(vec:Vec2Const):Number
Angle between this vector and "vec" in radians
Parameters
vec:Vec2Const |
Number |
isNear | () | method |
public function isNear(vec2:Vec2Const):Boolean
Returns true if this vector is near "vec2"
Parameters
vec2:Vec2Const |
Boolean |
isNearXY | () | method |
public function isNearXY(x:Number, y:Number):Boolean
Returns true if this vector is near ("x", "y")
Parameters
x:Number | |
y:Number |
Boolean |
isNormalized | () | method |
public function isNormalized():Boolean
Returns true if this vector is normalized (length == 1)
ReturnsBoolean |
isValid | () | method |
public function isValid():Boolean
Returns true if is a valid vector (has finite components)
ReturnsBoolean |
isWithin | () | method |
public function isWithin(vec2:Vec2Const, epsilon:Number):Boolean
Returns true if the distance from "vec2" vector is lesser than "epsilon"
Parameters
vec2:Vec2Const | |
epsilon:Number |
Boolean |
isWithinXY | () | method |
public function isWithinXY(x:Number, y:Number, epsilon:Number):Boolean
Returns true if the distance from ("x", "y") vector is lesser than "epsilon"
Parameters
x:Number | |
y:Number | |
epsilon:Number |
Boolean |
isZero | () | method |
public function isZero():Boolean
Returns true if this vector's components are 0
ReturnsBoolean |
lengthSqr | () | method |
public function lengthSqr():Number
Computes the squared length of the vector
ReturnsNumber |
lerp | () | method |
public function lerp(to:Vec2Const, t:Number):Vec2
Linear interpolation from this vector to "to" vector (returns a new Vec2)
Parameters
to:Vec2Const | |
t:Number |
Vec2 |
mul | () | method |
public function mul(vec:Vec2Const):Vec2
Multiplies by "vec" vector (returns a new Vec2)
Parameters
vec:Vec2Const |
Vec2 |
mulXY | () | method |
public function mulXY(x:Number, y:Number):Vec2
Multiplies by ("x", "y") (returns a new Vec2)
Parameters
x:Number | |
y:Number |
Vec2 |
normalize | () | method |
public function normalize(length:Number = 1):Vec2
Normalizes the vector (returns a new Vec2)
Parameters
length:Number (default = 1 )
|
Vec2 |
perpLeft | () | method |
perpRight | () | method |
reflect | () | method |
public function reflect(normal:Vec2Const):Vec2
Reflect this vector in plane whose normal is "normal" (returns a new Vec2)
Parameters
normal:Vec2Const |
Vec2 |
rotate | () | method |
public function rotate(rads:Number):Vec2
Rotates by "rads" radians (returns a new Vec2)
Parameters
rads:Number |
Vec2 |
rotateSpinor | () | method |
public function rotateSpinor(vec:Vec2Const):Vec2
Rotates using spinor "vec" (returns a new Vec2)
Parameters
vec:Vec2Const |
Vec2 |
scale | () | method |
public function scale(s:Number):Vec2
Scales by the scalar "s" (returns a new Vec2)
Parameters
s:Number |
Vec2 |
slerp | () | method |
public function slerp(vec:Vec2Const, t:Number):Vec2
Spherical linear interpolation from this vector to "to" vector (returns a new Vec2) - not thoroughly tested Note: this vector and "vec" MUST be orthogonal for it to work properly
Parameters
vec:Vec2Const | |
t:Number |
Vec2 |
spinorBetween | () | method |
public function spinorBetween(vec:Vec2Const):Vec2
Gets spinor between this vector and "vec" (returns a new Vec2)
Parameters
vec:Vec2Const |
Vec2 |
sub | () | method |
public function sub(pos:Vec2Const):Vec2
Subtracts "pos" vector (returns a new Vec2)
Parameters
pos:Vec2Const |
Vec2 |
subXY | () | method |
public function subXY(x:Number, y:Number):Vec2
Subtracts ("x", "y") (returns a new Vec2)
Parameters
x:Number | |
y:Number |
Vec2 |
toPoint | () | method |
public function toPoint():Point
Creates an AS3 Point from this vector
ReturnsPoint |
toString | () | method |
public function toString():String
String representation of this vector (uses Vec2Const.stringDecimals decimal positions)
ReturnsString |
unit | () | method |
public function unit():Vec2
Returns a new Vec2 which is a unit for this vector (same as normalize(1))
ReturnsVec2 |