Show:

CGSGPosition Class

Extends CGSGVector2D
Module: Util

A Position object

Constructor

CGSGPosition
(
  • x
  • y
)
Parameters:

Methods

add
(
  • vector
)
public

add to this vector, the value passed in parameter

Parameters:
copy () CGSGPosition public

Inherited from CGSGVector2D but overwritten in src\utils\class.region.js:44

return a new object with these attributes

Returns:
divide
(
  • vector
)
public

divide to this vector, the value passed in parameter

Parameters:
divideByFloat
(
  • f
)
public

Divide x and y by f

Parameters:
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

multiply to this vector, the value passed in parameter

Parameters:
multiplyByFloat
(
  • f
)
public

Multiply x and y by f

Parameters:
normalize () public

Normalize this vector

rotate
(
  • angle
)
public

rotate this vector around its origin

Parameters:
substract
(
  • vector
)
public

substract to this vector, the value passed in parameter

Parameters:
translateBy
(
  • x
  • y
)
public

Add new coordinate to the current relative one

Parameters:
translateTo
(
  • newX
  • newY
)

Replace current relative position by this new one

Parameters:
translateWith
(
  • x
  • y
)
public

Add new coordinate to the current relative one

Parameters: