Class Vector3d

a generic 3D Vector Object

Constructors

Properties

x: number
y: number
z: number

Methods

  • return true if this vector is equal to the given values or vector

    Parameters

    • Rest...args:
          | [number, number]
          | [number, number, number]
          | [number]
          | [Vector2d]
          | [Vector3d]

      other vector or vector components

    Returns boolean

    true if both vectors are equal

  • Linearly interpolate between this vector and the given one.

    Parameters

    • v: Vector3d

      other vector

    • alpha: number

      distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).

    Returns Vector3d

    Reference to this object for method chaining

  • Rotate this vector (counter-clockwise) by the specified angle (in radians) around the z axis

    Parameters

    • angle: number

      The angle to rotate (in radians)

    • Optionalv: XYPoint

      an optional point to rotate around (on the same z axis)

    Returns Vector3d

    Reference to this object for method chaining

  • Multiply this vector values by the given scalar

    Parameters

    • x: number

      x component

    • Optionaly: number = x

      y component

    • Optionalz: number = 1

      z component

    Returns Vector3d

    Reference to this object for method chaining

  • convert the object to a string representation

    Returns `x:${number},y:${number},z:${number}`

    stringified representation