Class: Vector

Vector

FM.Vector

new Vector(pX, pY)

Vector object.
Parameters:
Name Type Description
pX int X position.
pY int Y position.
Author:
  • Simon Chauvin
Source:

Members

x :int

x position.
Type:
  • int
Default Value:
  • 0
Source:

y :int

y position.
Type:
  • int
Default Value:
  • 0
Source:

Methods

add(vector) → {FM.Vector}

Add the specified vector to the current one;
Parameters:
Name Type Description
vector FM.Vector The vector to add.
Source:
Returns:
The vector modified.
Type
FM.Vector

clone() → {FM.Vector}

Clone the current vector.
Source:
Returns:
The new cloned vector.
Type
FM.Vector

copy(vector) → {FM.Vector}

Copy the given vector to the current one.
Parameters:
Name Type Description
vector FM.Vector The vector to copy.
Source:
Returns:
The vector copied.
Type
FM.Vector

crossProd(vector) → {float}

Calculate the cross product of the current vector and another vector.
Parameters:
Name Type Description
vector FM.Vector The vector to cross product.
Source:
Returns:
The cross product.
Type
float

destroy()

Destroy the point and its objects.
Source:

dotProduct(vector) → {FM.Vector}

Dot operation on the current vector and the specified one;
Parameters:
Name Type Description
vector FM.Vector The vector to dot product.
Source:
Returns:
The dot product.
Type
FM.Vector

getLength() → {float}

Return length of the vector;
Source:
Returns:
The length of the vector.
Type
float

getLengthSquared() → {int}

Return length of the vector;
Source:
Returns:
The squared length of the vector.
Type
int

isEquals(vector) → {boolean}

Check if the current vector is equals to the specified one;
Parameters:
Name Type Description
vector FM.Vector The vector to compare.
Source:
Returns:
Whether the two vector are equal or not.
Type
boolean

multiply(vector) → {FM.Vector}

Multiply the current vector by the one specified;
Parameters:
Name Type Description
vector FM.Vector The vector to multiply.
Source:
Returns:
The vector modified.
Type
FM.Vector

normalize()

Normalize the vector.
Source:

reset(pX, pY) → {FM.Vector}

Reset the vector the specified values.
Parameters:
Name Type Description
pX int The x position.
pY int The y position.
Source:
Returns:
The vector reset.
Type
FM.Vector

substract(vector) → {FM.Vector}

Substract the specified vector from the current one;
Parameters:
Name Type Description
vector FM.Vector The vector to substract.
Source:
Returns:
The vector modified.
Type
FM.Vector