API Docs for: v2.1.0
Show:

CGSGVector2D Class

A 2D vector object

Methods

add

(
  • vector
)
public

returns a new vector added to the value passed in parameter

Parameters:

addEquals

(
  • vector
)
public

add to this vector, the value passed in parameter

Parameters:

copy

() CGSGVector2D public

Returns:

CGSGVector2D:

a new CGSGVector2D, clone of this one

cross

() public

Get cross product of this vector and another vector

divide

(
  • vector
)
public

return a new vector divided by the value passed in parameter

Parameters:

divideByFloat

(
  • f
)
public

Divide x and y by f

Parameters:

divideByFloatEquals

(
  • f
)
public

Divide x and y by f

Parameters:

divideEquals

(
  • vector
)
public

divide to this vector, the value passed in parameter

Parameters:

dot

() public

Get dot product of this vector and another vector

getDistance

(
  • vector
)
Number public

Compute the euclidian distance between this vector and the one passe in parameter

Parameters:

Returns:

getLength

() Number public

Returns:

getSquaredLength

() Number public

Returns:

multiply

(
  • vector
)
public

returns a new vector multiplied to the value passed in parameter

Parameters:

multiplyByFloat

(
  • f
)
public

Multiply x and y by f

Parameters:

multiplyByFloatEquals

(
  • f
)
public

Multiply x and y by f

Parameters:

multiplyEquals

(
  • vector
)
public

multiply to this vector, the value passed in parameter

Parameters:

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

rotate

(
  • angle
)
public

rotate this vector around its origin

Parameters:

sign

() public

Determines if a given vector is to the right or left of this vector.

subtract

(
  • vector
)
public

returns a new vector subtracted from the value passed in parameter

Parameters:

subtractEquals

(
  • vector
)
public

subtract to this vector, the value passed in parameter

Parameters:

toString

() public

Get a string representing this vector

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