API Docs for: v2.1.0
Show:

CGSGScale Class

Extends CGSGPosition
Module: Util

A Scale object

Constructor

CGSGScale

(
  • x
  • y
)

Parameters:

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

() CGSGPosition public

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

return a new object with these attributes

Returns:

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

equalsTo

(
  • position
)
Boolean public

Indicates if this position meaningfully equals to the given position.

Parameters:

  • position CGSGPosition

    the position to compare to this position

Returns:

Boolean:

true if given position exists and has same coordinates as this position, false otherwise

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:

isNegative

() Boolean

Return true if x<0 || y<0

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

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:

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