Vector2
2D floating-point vector
Operations
- New
- Add
- AddX
- AddY
- Div
- DivX
- DivY
- Dot
- GetX
- GetY
- Limit
- Magnitude
- MagnitudeSquared
- Mul
- MulX
- MulY
- Normalize
- Set
- SetX
- SetY
- Sub
- SubX
- SubY
- ToString
- Zero
Add
Adds to current vector
method : public : Add(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|---|---|
rhs | Vector2 | vector to add |
Add
Add two vectors
function : Add(lhs:Vector2, rhs:Vector2) ~ Vector2
Parameters
Name | Type | Description |
---|---|---|
lhs | Vector2 | left vector |
rhs | Vector2 | right vector |
Return
Type | Description |
---|---|
Vector2 | new vector |
AddX
Increments the current x-position
method : public : AddX(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|---|---|
rhs | Vector2 | increment to the current x-position |
AddX
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 |
AddY
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 |
Div
Divides current vector
method : public : Div(v:Float) ~ Nil
Parameters
Name | Type | Description |
---|---|---|
v | Float | v to divide by |
Div
Divides two vectors
function : Div(lhs:Vector2, rhs:Vector2) ~ Vector2
Parameters
Name | Type | Description |
---|---|---|
lhs | Vector2 | left vector |
rhs | Vector2 | right vector |
Return
Type | Description |
---|---|
Vector2 | new vector |
Div
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
Type | Description |
---|---|
Vector2 | new vector |
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 |
DivX
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 |
DivX
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
Type | Description |
---|---|
Vector2 | new vector |
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 |
DivY
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 |
DivY
Divides y-vector component by a value
function : DivY(rhs:Vector2, v:Float) ~ Vector2
Parameters
Name | Type | Description |
---|---|---|
rhs | Vector2 | vector |
v | Float | value to divide by |
Return
Type | Description |
---|---|
Vector2 | new vector |
Dot
Calculates the dot product
function : Dot(lhs:Vector2, rhs:Vector2) ~ Float
Parameters
Name | Type | Description |
---|---|---|
lhs | Vector2 | left vector |
rhs | Vector2 | right vector |
Return
Type | Description |
---|---|
Float | dot product |
Limit
Sets vector limit
method : public : Limit(v:Float) ~ Nil
Parameters
Name | Type | Description |
---|---|---|
v | Float | limit |
Limit
Sets vector limit
method : public : Limit(x:Float, y:Float) ~ Nil
Parameters
Name | Type | Description |
---|---|---|
x | Float | x-limit |
y | Float | y-limit |
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 |
Mul
Multiples current vector
method : public : Mul(v:Float) ~ Nil
Parameters
Name | Type | Description |
---|---|---|
v | Float | v to multiply by |
Mul
Multiplies two vectors
function : Mul(lhs:Vector2, rhs:Vector2) ~ Vector2
Parameters
Name | Type | Description |
---|---|---|
lhs | Vector2 | left vector |
rhs | Vector2 | right vector |
Return
Type | Description |
---|---|
Vector2 | new vector |
Mul
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
Type | Description |
---|---|
Vector2 | new vector |
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 |
MulX
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 |
MulX
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
Type | Description |
---|---|
Vector2 | new vector |
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 |
MulY
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 |
MulY
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
Type | Description |
---|---|
Vector2 | new vector |
New
Creates a new vector
New(x:Float, y:Float)
Parameters
Name | Type | Description |
---|---|---|
x | Float | x-position |
y | Float | y-position |
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 |
Sub
Subtract two vectors
function : Sub(lhs:Vector2, rhs:Vector2) ~ Vector2
Parameters
Name | Type | Description |
---|---|---|
lhs | Vector2 | left vector |
rhs | Vector2 | right vector |
Return
Type | Description |
---|---|
Vector2 | new vector |
SubX
Decrements the current x-position
method : public : SubX(rhs:Vector2) ~ Nil
Parameters
Name | Type | Description |
---|---|---|
rhs | Vector2 | decrements to the current x-position |
SubX
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 |
SubY
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 |