All Bundles
Vector2
2D floating-point vector
Operations
New
Creates a new vector
New()
Creates a new vector
New(x:Float, y:Float)
Parameters
Name | Type | Description |
---|
x | Float | x-position |
y | Float | y-position |
Add
Adds to current vector
method : public : Add(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|
rhs | Vector2 | vector to add |
Add two vectors
function : Add(lhs:Vector2, rhs:Vector2) ~ Vector2
Parameters
Return
AddX
Increments the current x-position
method : public : AddX(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|
rhs | Vector2 | increment to the current x-position |
Increments the current x-position
method : public : AddX(x:Int) ~ Nil
Parameters
Name | Type | Description |
---|
x | Int | increment to the current x-position |
AddY
Increments the current y-position
method : public : AddY(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|
rhs | Vector2 | increment to the current y-position |
Increments the current y-position
method : public : AddY(y:Int) ~ Nil
Parameters
Name | Type | Description |
---|
y | Int | increment to the current y-position |
Div
Divides current vector
method : public : Div(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|
rhs | Vector2 | vector to divide |
Divides current vector
method : public : Div(v:Float) ~ Nil
Parameters
Name | Type | Description |
---|
v | Float | v to divide by |
Divides two vectors
function : Div(lhs:Vector2, rhs:Vector2) ~ Vector2
Parameters
Return
Divides a vector by a value
function : Div(rhs:Vector2, v:Float) ~ Vector2
Parameters
Name | Type | Description |
---|
rhs | Vector2 | vector |
v | Float | value to divides by |
Return
DivX
Divides the current x-position
method : public : DivX(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|
rhs | Vector2 | value to divide by the current x-position |
Divides the current x-position
method : public : DivX(x:Int) ~ Nil
Parameters
Name | Type | Description |
---|
x | Int | value to divide by the current x-position |
Divides x-vector component by a value
function : DivX(rhs:Vector2, v:Float) ~ Vector2
Parameters
Name | Type | Description |
---|
rhs | Vector2 | vector |
v | Float | value to multiple by |
Return
DivY
Divides the current y-position
method : public : DivY(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|
rhs | Vector2 | value to divide by the current y-position |
Divides the current y-position
method : public : DivY(y:Int) ~ Nil
Parameters
Name | Type | Description |
---|
y | Int | value to divide by the current y-position |
Divides y-vector component by a value
function : DivY(rhs:Vector2, v:Float) ~ Vector2
Parameters
Return
Dot
Calculates the dot product
function : Dot(lhs:Vector2, rhs:Vector2) ~ Float
Parameters
Return
Type | Description |
---|
Float | dot product |
GetX
Gets the x-position
method : public : GetX() ~ Float
Return
Type | Description |
---|
Float | x-position |
GetY
Gets the y-position
method : public : GetY() ~ Float
Return
Type | Description |
---|
Float | y-position |
Limit
Sets vector limit
method : public : Limit(v:Float) ~ Nil
Parameters
Name | Type | Description |
---|
v | Float | limit |
Sets vector limit
method : public : Limit(x:Float, y:Float) ~ Nil
Parameters
Magnitude
Calculates the magnitude
method : public : Magnitude() ~ Float
Return
Type | Description |
---|
Float | magnitude |
MagnitudeSquared
Calculates the magnitude squared
method : public : MagnitudeSquared() ~ Float
Return
Type | Description |
---|
Float | magnitude squared |
Mul
Multiples current vector
method : public : Mul(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|
rhs | Vector2 | vector to multiply |
Multiples current vector
method : public : Mul(v:Float) ~ Nil
Parameters
Name | Type | Description |
---|
v | Float | v to multiply by |
Multiplies two vectors
function : Mul(lhs:Vector2, rhs:Vector2) ~ Vector2
Parameters
Return
Multiplies a vector by a value
function : Mul(rhs:Vector2, v:Float) ~ Vector2
Parameters
Name | Type | Description |
---|
rhs | Vector2 | vector |
v | Float | value to multiple by |
Return
MulX
Multiplies the current x-position
method : public : MulX(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|
rhs | Vector2 | value to multiply to the current x-position |
Multiplies the current x-position
method : public : MulX(x:Int) ~ Nil
Parameters
Name | Type | Description |
---|
x | Int | value to multiply to the current x-position |
Multiplies x-vector component by a value
function : MulX(rhs:Vector2, v:Float) ~ Vector2
Parameters
Name | Type | Description |
---|
rhs | Vector2 | vector |
v | Float | value to multiple by |
Return
MulY
Multiplies the current y-position
method : public : MulY(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|
rhs | Vector2 | value to multiply to the current y-position |
Multiplies the current y-position
method : public : MulY(y:Int) ~ Nil
Parameters
Name | Type | Description |
---|
y | Int | value to multiply to the current y-position |
Multiplies y-vector component by a value
function : MulY(rhs:Vector2, v:Float) ~ Vector2
Parameters
Name | Type | Description |
---|
rhs | Vector2 | vector |
v | Float | value to multiply by |
Return
Normalize
Normalizes a unit vector
method : public : Normalize() ~ Nil
Set
Sets the x and y positions
method : public : Set(x:Float, y:Float) ~ Nil
Parameters
Name | Type | Description |
---|
x | Float | x-position |
y | Float | y-position |
SetX
Sets the x-position
method : public : SetX(x:Float) ~ Nil
Parameters
Name | Type | Description |
---|
x | Float | x-position |
SetY
Sets the y-position
method : public : SetY(y:Float) ~ Nil
Parameters
Name | Type | Description |
---|
y | Float | y-position |
Sub
Subtracts from current vector
method : public : Sub(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|
rhs | Vector2 | vector to subtract |
Subtract two vectors
function : Sub(lhs:Vector2, rhs:Vector2) ~ Vector2
Parameters
Return
SubX
Decrements the current x-position
method : public : SubX(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|
rhs | Vector2 | decrements to the current x-position |
Decrements the current x-position
method : public : SubX(x:Int) ~ Nil
Parameters
Name | Type | Description |
---|
x | Int | decrements to the current x-position |
SubY
Decrements the current y-position
method : public : SubY(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|
rhs | Vector2 | decrements to the current y-position |
Decrements the current y-position
method : public : SubY(y:Int) ~ Nil
Parameters
Name | Type | Description |
---|
y | Int | decrements to the current y-position |
ToString
String representation of vector
method : public : ToString() ~ String
Return
Type | Description |
---|
String | string representation |
Zero
Sets vector to zero
method : public : Zero() ~ Nil