A vector with 4 components, labeled: X, Y, Z, W.

Hierarchy (View Summary)

Constructors

  • Constructs a new Vector4.

    Parameters

    • x: number

      The X component.

    • y: number

      The Y component.

    • z: number

      The Z component.

    • w: number

      The W component.

    Returns Vector4

Properties

k: number[] = ...

The components of the vector.

Accessors

  • get w(): number
  • Get the W component of the vector.

    Returns number

    The W component of the vector.

  • set w(value: number): void
  • Set the W component of the vector.

    Parameters

    • value: number

    Returns void

  • get x(): number
  • Get the X component of the vector.

    Returns number

    The X component of the vector.

  • set x(value: number): void
  • Set the X component of the vector.

    Parameters

    • value: number

    Returns void

  • get y(): number
  • Get the Y component of the vector.

    Returns number

    The Y component of the vector.

  • set y(value: number): void
  • Set the Y component of the vector.

    Parameters

    • value: number

    Returns void

  • get z(): number
  • Get the Z component of the vector.

    Returns number

    The Z component of the vector.

  • set z(value: number): void
  • Set the Z component of the vector.

    Parameters

    • value: number

    Returns void

Methods

  • Adds the XYZ components of another vector to this vector.

    Parameters

    • x: number

      The value to add to the X component.

    • y: number

      The value to add to the Y component.

    • z: number

      The value to add to the Z component.

    Returns this

    This instance.

  • Scales another vector and adds its XYZ components to this vector.

    Parameters

    • vector: Readonly<Vector4>

      The vector to add to this vector.

    • scale: number

      The scaling to apply to the input vector.

    Returns this

    This instance.

  • Scales another vector and adds its XYZ components to this vector.

    Parameters

    • x: number

      The value to add to the X component.

    • y: number

      The value to add to the Y component.

    • z: number

      The value to add to the Z component.

    • scale: number

      The scaling to apply to the input vector.

    Returns this

    This instance.

  • Clamps the components of the vector at the given boundary.

    Parameters

    • floor: number

      The lowest value to allow.

    • ceil: number

      The largest value to allow.

    Returns this

    This instance.

  • Divides the XYZ components of the vector by the given scale.

    Parameters

    • scale: number

      The scaling to apply to the vector.

    Returns this

    This instance.

  • Divides the XYZ components of this vector by another vector.

    Parameters

    • x: number

      The value to divide the X component with.

    • y: number

      The value to divide the Y component with.

    • z: number

      The value to divide the Z component with.

    Returns this

    This instance.

  • Multiplies the XYZ components of the vector by the given scale.

    Parameters

    • scale: number

      The scaling to apply to the vector.

    Returns this

    This instance.

  • Multiplies the XYZ components of this vector by another vector.

    Parameters

    • x: number

      The value to multiply with the X component.

    • y: number

      The value to multiply with the Y component.

    • z: number

      The value to multiply with the Z component.

    Returns this

    This instance.

  • Sets the vector to new coordinates.

    Parameters

    • x: number

      The new X component for the vector.

    • y: number

      The new Y component for the vector.

    • z: number

      The new Z component for the vector.

    • w: number

      The new W component for the vector.

    Returns this

    This instance.

  • Subtracts the XYZ components of another vector from this vector.

    Parameters

    • x: number

      The value to subtract from the X component.

    • y: number

      The value to subtract from the Y component.

    • z: number

      The value to subtract from the Z component.

    Returns this

    This instance.