Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace vec4

Index

Functions

add

  • add(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
  • Adds two vec4's

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns vec4

    out

ceil

  • ceil(out: vec4, a: ReadonlyVec4): vec4
  • Math.ceil the components of a vec4

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      vector to ceil

    Returns vec4

    out

clone

  • clone(a: ReadonlyVec4): vec4
  • Creates a new vec4 initialized with values from an existing vector

    Parameters

    • a: ReadonlyVec4

      vector to clone

    Returns vec4

    a new 4D vector

copy

  • copy(out: vec4, a: ReadonlyVec4): vec4
  • Copy the values from one vec4 to another

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the source vector

    Returns vec4

    out

create

  • Creates a new, empty vec4

    Returns vec4

    a new 4D vector

cross

  • cross(out: any, u: any, v: any, w: any): vec4
  • Returns the cross-product of three vectors in a 4-dimensional space

    Parameters

    • out: any
    • u: any
    • v: any
    • w: any

    Returns vec4

    result

dist

  • dist(a: ReadonlyVec4, b: ReadonlyVec4): number
  • Calculates the euclidian distance between two vec4's

    Parameters

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns number

    distance between a and b

distance

  • distance(a: ReadonlyVec4, b: ReadonlyVec4): number
  • Calculates the euclidian distance between two vec4's

    Parameters

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns number

    distance between a and b

div

  • div(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
  • Divides two vec4's

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns vec4

    out

divide

  • divide(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
  • Divides two vec4's

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns vec4

    out

dot

  • dot(a: ReadonlyVec4, b: ReadonlyVec4): number
  • Calculates the dot product of two vec4's

    Parameters

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns number

    dot product of a and b

equals

  • equals(a: ReadonlyVec4, b: ReadonlyVec4): boolean
  • Returns whether or not the vectors have approximately the same elements in the same position.

    Parameters

    • a: ReadonlyVec4

      The first vector.

    • b: ReadonlyVec4

      The second vector.

    Returns boolean

    True if the vectors are equal, false otherwise.

exactEquals

  • exactEquals(a: ReadonlyVec4, b: ReadonlyVec4): boolean
  • Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)

    Parameters

    • a: ReadonlyVec4

      The first vector.

    • b: ReadonlyVec4

      The second vector.

    Returns boolean

    True if the vectors are equal, false otherwise.

floor

  • floor(out: vec4, a: ReadonlyVec4): vec4
  • Math.floor the components of a vec4

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      vector to floor

    Returns vec4

    out

forEach

  • forEach(a: any, stride: any, offset: any, count: any, fn: any, arg: any): any
  • Parameters

    • a: any
    • stride: any
    • offset: any
    • count: any
    • fn: any
    • arg: any

    Returns any

fromValues

  • fromValues(x: number, y: number, z: number, w: number): vec4
  • Creates a new vec4 initialized with the given values

    Parameters

    • x: number

      X component

    • y: number

      Y component

    • z: number

      Z component

    • w: number

      W component

    Returns vec4

    a new 4D vector

inverse

  • inverse(out: vec4, a: ReadonlyVec4): vec4
  • Returns the inverse of the components of a vec4

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      vector to invert

    Returns vec4

    out

len

  • len(a: ReadonlyVec4): number
  • Calculates the length of a vec4

    Parameters

    • a: ReadonlyVec4

      vector to calculate length of

    Returns number

    length of a

length

  • length(a: ReadonlyVec4): number
  • Calculates the length of a vec4

    Parameters

    • a: ReadonlyVec4

      vector to calculate length of

    Returns number

    length of a

lerp

  • lerp(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4, t: number): vec4
  • Performs a linear interpolation between two vec4's

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    • t: number

      interpolation amount, in the range [0-1], between the two inputs

    Returns vec4

    out

max

  • max(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
  • Returns the maximum of two vec4's

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns vec4

    out

min

  • min(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
  • Returns the minimum of two vec4's

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns vec4

    out

mul

  • mul(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
  • Multiplies two vec4's

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns vec4

    out

multiply

  • multiply(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
  • Multiplies two vec4's

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns vec4

    out

negate

  • negate(out: vec4, a: ReadonlyVec4): vec4
  • Negates the components of a vec4

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      vector to negate

    Returns vec4

    out

normalize

  • normalize(out: vec4, a: ReadonlyVec4): vec4
  • Normalize a vec4

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      vector to normalize

    Returns vec4

    out

random

  • random(out: vec4, scale?: number): vec4
  • Generates a random vector with the given scale

    Parameters

    • out: vec4

      the receiving vector

    • Optional scale: number

    Returns vec4

    out

round

  • round(out: vec4, a: ReadonlyVec4): vec4
  • Math.round the components of a vec4

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      vector to round

    Returns vec4

    out

scale

  • scale(out: vec4, a: ReadonlyVec4, b: number): vec4
  • Scales a vec4 by a scalar number

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the vector to scale

    • b: number

      amount to scale the vector by

    Returns vec4

    out

scaleAndAdd

  • scaleAndAdd(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4, scale: number): vec4
  • Adds two vec4's after scaling the second operand by a scalar value

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    • scale: number

      the amount to scale b by before adding

    Returns vec4

    out

set

  • set(out: vec4, x: number, y: number, z: number, w: number): vec4
  • Set the components of a vec4 to the given values

    Parameters

    • out: vec4

      the receiving vector

    • x: number

      X component

    • y: number

      Y component

    • z: number

      Z component

    • w: number

      W component

    Returns vec4

    out

sqrDist

  • sqrDist(a: ReadonlyVec4, b: ReadonlyVec4): number
  • Calculates the squared euclidian distance between two vec4's

    Parameters

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns number

    squared distance between a and b

sqrLen

  • sqrLen(a: ReadonlyVec4): number
  • Calculates the squared length of a vec4

    Parameters

    • a: ReadonlyVec4

      vector to calculate squared length of

    Returns number

    squared length of a

squaredDistance

  • squaredDistance(a: ReadonlyVec4, b: ReadonlyVec4): number
  • Calculates the squared euclidian distance between two vec4's

    Parameters

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns number

    squared distance between a and b

squaredLength

  • squaredLength(a: ReadonlyVec4): number
  • Calculates the squared length of a vec4

    Parameters

    • a: ReadonlyVec4

      vector to calculate squared length of

    Returns number

    squared length of a

str

  • str(a: ReadonlyVec4): string
  • Returns a string representation of a vector

    Parameters

    • a: ReadonlyVec4

      vector to represent as a string

    Returns string

    string representation of the vector

sub

  • sub(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
  • Subtracts vector b from vector a

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns vec4

    out

subtract

  • subtract(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
  • Subtracts vector b from vector a

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the first operand

    • b: ReadonlyVec4

      the second operand

    Returns vec4

    out

transformMat4

  • transformMat4(out: vec4, a: ReadonlyVec4, m: ReadonlyMat4): vec4
  • Transforms the vec4 with a mat4.

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the vector to transform

    • m: ReadonlyMat4

      matrix to transform with

    Returns vec4

    out

transformQuat

  • transformQuat(out: vec4, a: ReadonlyVec4, q: ReadonlyQuat): vec4
  • Transforms the vec4 with a quat

    Parameters

    • out: vec4

      the receiving vector

    • a: ReadonlyVec4

      the vector to transform

    • q: ReadonlyQuat

      quaternion to transform with

    Returns vec4

    out

zero

  • Set the components of a vec4 to zero

    Parameters

    • out: vec4

      the receiving vector

    Returns vec4

    out