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) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | vector to add |
Add # function
Add two vectors
function : Add(lhs:Vector2, rhs:Vector2) ~ Vector2Parameters
| 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) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | increment to the current x-position |
AddX #
Increments the current x-position
method : public : AddX(x:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| x | Int | increment to the current x-position |
AddY #
Increments the current y-position
method : public : AddY(rhs:Vector2) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | increment to the current y-position |
AddY #
Increments the current y-position
method : public : AddY(y:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| y | Int | increment to the current y-position |
Div #
Divides current vector
method : public : Div(rhs:Vector2) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | vector to divide |
Div #
Divides current vector
method : public : Div(v:Float) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| v | Float | v to divide by |
Div # function
Divides two vectors
function : Div(lhs:Vector2, rhs:Vector2) ~ Vector2Parameters
| Name | Type | Description |
|---|---|---|
| lhs | Vector2 | left vector |
| rhs | Vector2 | right vector |
Return
| Type | Description |
|---|---|
| Vector2 | new vector |
Div # function
Divides a vector by a value
function : Div(rhs:Vector2, v:Float) ~ Vector2Parameters
| 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) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | value to divide by the current x-position |
DivX #
Divides the current x-position
method : public : DivX(x:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| x | Int | value to divide by the current x-position |
DivX # function
Divides x-vector component by a value
function : DivX(rhs:Vector2, v:Float) ~ Vector2Parameters
| 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) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | value to divide by the current y-position |
DivY #
Divides the current y-position
method : public : DivY(y:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| y | Int | value to divide by the current y-position |
DivY # function
Divides y-vector component by a value
function : DivY(rhs:Vector2, v:Float) ~ Vector2Parameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | vector |
| v | Float | value to divide by |
Return
| Type | Description |
|---|---|
| Vector2 | new vector |
Dot # function
Calculates the dot product
function : Dot(lhs:Vector2, rhs:Vector2) ~ FloatParameters
| 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) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| v | Float | limit |
Limit #
Sets vector limit
method : public : Limit(x:Float, y:Float) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| x | Float | x-limit |
| y | Float | y-limit |
Magnitude #
Calculates the magnitude
method : public : Magnitude() ~ FloatReturn
| Type | Description |
|---|---|
| Float | magnitude |
MagnitudeSquared #
Calculates the magnitude squared
method : public : MagnitudeSquared() ~ FloatReturn
| Type | Description |
|---|---|
| Float | magnitude squared |
Mul #
Multiples current vector
method : public : Mul(rhs:Vector2) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | vector to multiply |
Mul #
Multiples current vector
method : public : Mul(v:Float) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| v | Float | v to multiply by |
Mul # function
Multiplies two vectors
function : Mul(lhs:Vector2, rhs:Vector2) ~ Vector2Parameters
| Name | Type | Description |
|---|---|---|
| lhs | Vector2 | left vector |
| rhs | Vector2 | right vector |
Return
| Type | Description |
|---|---|
| Vector2 | new vector |
Mul # function
Multiplies a vector by a value
function : Mul(rhs:Vector2, v:Float) ~ Vector2Parameters
| 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) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | value to multiply to the current x-position |
MulX #
Multiplies the current x-position
method : public : MulX(x:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| x | Int | value to multiply to the current x-position |
MulX # function
Multiplies x-vector component by a value
function : MulX(rhs:Vector2, v:Float) ~ Vector2Parameters
| 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) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | value to multiply to the current y-position |
MulY #
Multiplies the current y-position
method : public : MulY(y:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| y | Int | value to multiply to the current y-position |
MulY # function
Multiplies y-vector component by a value
function : MulY(rhs:Vector2, v:Float) ~ Vector2Parameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | vector |
| v | Float | value to multiply by |
Return
| Type | Description |
|---|---|
| Vector2 | new vector |
New # constructor
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) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| x | Float | x-position |
| y | Float | y-position |
SetX #
Sets the x-position
method : public : SetX(x:Float) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| x | Float | x-position |
SetY #
Sets the y-position
method : public : SetY(y:Float) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| y | Float | y-position |
Sub #
Subtracts from current vector
method : public : Sub(rhs:Vector2) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | vector to subtract |
Sub # function
Subtract two vectors
function : Sub(lhs:Vector2, rhs:Vector2) ~ Vector2Parameters
| 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) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | decrements to the current x-position |
SubX #
Decrements the current x-position
method : public : SubX(x:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| x | Int | decrements to the current x-position |
SubY #
Decrements the current y-position
method : public : SubY(rhs:Vector2) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| rhs | Vector2 | decrements to the current y-position |
SubY #
Decrements the current y-position
method : public : SubY(y:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| y | Int | decrements to the current y-position |