Class Vector2

Hierarchy

  • Vector2

Constructors

  • Constructor of Vector2.

    Parameters

    • x: number = 0

      The x component of the vector, default 0

    • y: number = 0

      The y component of the vector, default 0

    Returns Vector2

Properties

_onValueChanged: (() => void) = null

Type declaration

    • (): void
    • Internal

      Returns void

_x: number
_y: number
_one: Vector2 = ...
_zero: Vector2 = ...

Accessors

Methods

  • Calculate the length of this vector.

    Returns

    The length of this vector

    Returns number

  • Calculate the squared length of this vector.

    Returns

    The squared length of this vector

    Returns number

  • Scale this vector by the given value.

    Returns

    This vector

    Parameters

    • s: number

      The amount by which to scale the vector

    Returns Vector2

  • Set the value of this vector.

    Returns

    This vector

    Parameters

    • x: number

      The x component of the vector

    • y: number

      The y component of the vector

    Returns Vector2

  • Set the value of this vector by an array.

    Returns

    This vector

    Parameters

    • array: ArrayLike<number>

      The array

    • offset: number = 0

      The start offset of the array

    Returns Vector2

  • Clone the value of this vector to an array.

    Parameters

    • out: Float32Array | Float64Array | number[]

      The array

    • outOffset: number = 0

      The start offset of the array

    Returns void

  • Determines the distance of two vectors.

    Returns

    The distance of two vectors

    Parameters

    Returns number

  • Determines the squared distance of two vectors.

    Returns

    The squared distance of two vectors

    Parameters

    Returns number

  • Determines the dot product of two vectors.

    Returns

    The dot product of two vectors

    Parameters

    • left: Vector2

      The first vector to dot

    • right: Vector2

      The second vector to dot

    Returns number

  • Determines whether the specified vectors are equals.

    Returns

    True if the specified vectors are equals, false otherwise

    Parameters

    • left: Vector2

      The first vector to compare

    • right: Vector2

      The second vector to compare

    Returns boolean

  • Performs a linear interpolation between two vectors.

    Parameters

    • left: Vector2

      The first vector

    • right: Vector2

      The second vector

    • t: number

      The blend amount where 0 returns left and 1 right

    • out: Vector2

      The result of linear blending between two vectors

    Returns void

  • Calculate a vector containing the largest components of the specified vectors.

    Parameters

    • left: Vector2

      The first vector

    • right: Vector2

      The second vector

    • out: Vector2

      The vector containing the largest components of the specified vectors

    Returns void

  • Calculate a vector containing the smallest components of the specified vectors.

    Parameters

    • left: Vector2

      The first vector

    • right: Vector2

      The second vector

    • out: Vector2

      The vector containing the smallest components of the specified vectors

    Returns void

  • Scale a vector by the given value.

    Parameters

    • left: Vector2

      The vector to scale

    • s: number

      The amount by which to scale the vector

    • out: Vector2

      The scaled vector

    Returns void

Generated using TypeDoc