Class Fz2D.Vec2

Defined in: src/scene/vec2.coffee

Overview

Public: Vec2

Instance Method Summary

Constructor Details

::constructor(x = 0, y = 0) Source

Public: Constructor. x - value on the X axis (default: 0) y - value on the Y axis (default: 0)

Parameters:

  • xvalue on the X axis (default: 0)
  • yvalue on the Y axis (default: 0)

Instance Method Details

Fz2D.Vec2 ::add(p) Source

Public: Adds another vector to this vector. p - Fz2D.Vec2 Returns a new Fz2D.Vec2 with the result.

Parameters:

Returns:

::dist(p) Source

Public: Determines the distance to another vector. p - Fz2D.Vec2 Returns the distance.

Parameters:

Returns:

  • Returns the distance.

::distSqr(p) Source

Public: Determines the squared distance to another vector. p - Fz2D.Vec2 Returns the squared distance.

Parameters:

Returns:

  • Returns the squared distance.

Fz2D.Vec2 ::div(s) Source

Public: Divides vector with a scalar. s - scalar Returns a new Fz2D.Vec2 with the result.

Parameters:

  • sscalar

Returns:

::dot(p) Source

Public: Determines the dot product with another vector. p - Fz2D.Vec2 Returns the dot product.

Parameters:

Returns:

  • Returns the dot product.

::equals(p) Source

Public: Compares vector to another vector. p - Fz2D.Vec2 Returns the result of the comparison.

Parameters:

Returns:

  • Returns the result of the comparison.

::isNull() Source

Public: Returns true if the vector is null, otherwise false.

Fz2D.Vec2 ::mul(s) Source

Public: Multiplies vector with a scalar. s - scalar Returns a new Fz2D.Vec2 with the result.

Parameters:

  • sscalar

Returns:

::set(x, y) Source

Public: Sets the components of the vector. x - value on the X axis y - value on the Y axis

Parameters:

  • xvalue on the X axis
  • yvalue on the Y axis

Fz2D.Vec2 ::sub(p) Source

Public: Subtracts another vector from this vector. p - Fz2D.Vec2 Returns a new Fz2D.Vec2 with the result.

Parameters:

Returns: