CGSGPosition Class
A Position object
Item Index
Methods
- add
- addEquals
- copy
- cross
- divide
- divideByFloat
- divideByFloatEquals
- divideEquals
- dot
- equalsTo
- getDistance
- getLength
- getSquaredLength
- isNegative
- multiply
- multiplyByFloat
- multiplyByFloatEquals
- multiplyEquals
- normalize
- perp
- perpendicular
- project
- rotate
- sign
- subtract
- subtractEquals
- toString
- translateBy
- translateTo
- translateWith
- unit
- unitEquals
- unitFast
Methods
add
-
vector
returns a new vector added to the value passed in parameter
Parameters:
-
vector
CGSGVector2D
addEquals
-
vector
add to this vector, the value passed in parameter
Parameters:
-
vector
CGSGVector2D
cross
()
public
Get cross product of this vector and another vector
divide
-
vector
return a new vector divided by the value passed in parameter
Parameters:
-
vector
CGSGVector2D
divideEquals
-
vector
divide to this vector, the value passed in parameter
Parameters:
-
vector
CGSGVector2D
dot
()
public
Get dot product of this vector and another vector
equalsTo
-
position
Indicates if this position meaningfully equals to the given position.
Parameters:
-
position
CGSGPositionthe position to compare to this position
Returns:
true if given position exists and has same coordinates as this position, false otherwise
getDistance
-
vector
Compute the euclidian distance between this vector and the one passe in parameter
Parameters:
-
vector
CGSGVector2D
Returns:
multiply
-
vector
returns a new vector multiplied to the value passed in parameter
Parameters:
-
vector
CGSGVector2D
multiplyEquals
-
vector
multiply to this vector, the value passed in parameter
Parameters:
-
vector
CGSGVector2D
normalize
()
public
Normalize this vector
perp
()
public
Get a perpendicular vector of this vector
perpendicular
()
public
Get a vector perpendicular to this vector and another vector
project
()
public
Get a projected vector of this vector and another vector
sign
()
public
Determines if a given vector is to the right or left of this vector.
subtract
-
vector
returns a new vector subtracted from the value passed in parameter
Parameters:
-
vector
CGSGVector2D
subtractEquals
-
vector
subtract to this vector, the value passed in parameter
Parameters:
-
vector
CGSGVector2D
toString
()
public
Get a string representing this vector
translateBy
-
x
-
y
Add new coordinate to the current relative one
translateTo
-
newX
-
newY
Replace current relative position by this new one
translateWith
-
x
-
y
Add new coordinate to the current relative one
unit
()
public
Get unit vector of this vector and another vector
unitEquals
()
public
Get unit vector of this vector and another vector
unitFast
()
public
Get approximation of unit vector of this vector and another vector