Description

A four dimensional vector. Vectors can only store finite numbers in the range Number.MIN_VALUE to Number.MAX_VALUE.

Constructors

  • Parameters

    • x: number
    • y: number
    • z: number
    • w: number

    Returns vec4

    Description

    Creates a new instance of a vec4.

Properties

a: number

Description

Alternate name for the w component.

b: number

Description

Alternate name for the z component.

g: number

Description

Alternate name for the y component.

length: number

Description

Returns the length of the vector.

lengthSquared: number

Description

Returns the squared length of the vector.

r: number

Description

Alternate name for the x component.

w: number

Description

w component of the vec4.

x: number

Description

x component of the vec4.

y: number

Description

y component of the vec4.

z: number

Description

z component of the vec4.

Methods

  • Parameters

    Returns vec4

    Description

    Returns the vector plus vec.

  • Parameters

    Returns number

    Description

    Returns the angle between the vector and vec.

  • Parameters

    • length: number

    Returns vec4

    Description

    Returns a copy of the vector with its length clamped to length.

  • Parameters

    Returns number

    Description

    Returns the distance between the vector and the vector vec.

  • Parameters

    Returns number

    Description

    Like distance(), but returns the squared distance between vectors.

  • Parameters

    Returns vec4

    Description

    Returns the division of the vector by the vector vec.

  • Parameters

    Returns number

    Description

    Returns the dot product of the vector and vec.

  • Parameters

    Returns boolean

    Description

    Returns whether this is equal to vec.

  • Parameters

    • point: vec4
    • magnitude: number

    Returns vec4

    Description

    Returns a copy of the vector moved towards the point point by the amount magnitude.

  • Parameters

    Returns vec4

    Description

    Returns the component-wise multiplication product of the vector and vec.

  • Returns vec4

    Description

    Returns a copy of the vector with its length scaled to 1.

  • Parameters

    Returns vec4

    Description

    Returns a copy of the vector projected onto the vector vec.

  • Parameters

    Returns vec4

    Description

    Projects the vector onto the plane represented by the normal normal.

  • Parameters

    Returns vec4

    Description

    Returns a copy of the vector reflected across the plane defined by the normal vec.

  • Parameters

    Returns vec4

    Description

    Returns the component-wise multiplication product of the vector and vec.

  • Parameters

    Returns vec4

    Description

    Returns the vector minus vec.

  • Returns string

    Description

    Returns a string representation of the vector.

  • Parameters

    • scale: number

    Returns vec4

    Description

    Multiplies the components by the number scale.

Generated using TypeDoc