A core building block for many pieces of the BeetPx API – a vector, which is 2D point representation of (X,Y).

Implements

Static factories

  • Parameters

    • turnAngle: number

      A full circle turn = 1. In other words: 0 deg = 0 turn, 90 deg = 0.25 turn, 180 deg = 0.5 turn, 270 deg = 0.75 turn.

    Returns BpxVector2d

    A vector of a length 1, angled according to a given turnAngle. E.g. (0, -1) for an angle of -0.25.

Accessors

Methods

  • Parameters

    Returns boolean

    If the vector has both of its components equal to the same components of a given vector.

  • Parameters

    • value: number

    Returns boolean

    If the vector has both of its components equal to a given value.

  • Parameters

    • x: number
    • y: number

    Returns boolean

    If the vector has both of its components equal to a given x and y.

  • Parameters

    Returns boolean

    If the vector has both of its components greater than the same components of a given vector.

  • Parameters

    • value: number

    Returns boolean

    If the vector has both of its components greater than a given value.

  • Parameters

    • x: number
    • y: number

    Returns boolean

    If the vector has both of its components greater than a given x and y.

  • Parameters

    Returns boolean

    If the vector has both of its components greater or equal to the same components of a given vector.

  • Parameters

    • value: number

    Returns boolean

    If the vector has both of its components greater or equal to a given value.

  • Parameters

    • x: number
    • y: number

    Returns boolean

    If the vector has both of its components greater or equal to a given x and y.

  • Parameters

    Returns boolean

    If the vector has both of its components lower than the same components of a given vector.

  • Parameters

    • value: number

    Returns boolean

    If the vector has both of its components lower than a given value.

  • Parameters

    • x: number
    • y: number

    Returns boolean

    If the vector has both of its components lower than a given x and y.

  • Parameters

    Returns boolean

    If the vector has both of its components lower or equal to the same components of a given vector.

  • Parameters

    • value: number

    Returns boolean

    If the vector has both of its components lower or equal to a given value.

  • Parameters

    • x: number
    • y: number

    Returns boolean

    If the vector has both of its components lower or equal to a given x and y.

  • This method is an equivalent of calling BeetPxUtils.trigAtan2 with both x and y of this vector as the params.

    Returns number

    The "turn" of the vector. A full circle turn = 1. In other words: 0 deg = 0 turn, 90 deg = 0.25 turn, 180 deg = 0.5 turn, 270 deg = 0.75 turn.

Properties

x: number

The X component of the vector.

y: number

The X component of the vector.