Options
All
  • Public
  • Public/Protected
  • All
Menu

Module quat

Index

Functions

add

calculateW

  • Calculates the W component of a quat from the X, Y, and Z components. Assumes that quaternion is 1 unit in length. Any existing W component will be ignored.

    Parameters

    • out: IArray

      the receiving quaternion

    • a: IArray

      quat to calculate W component of

    Returns IArray

    out

clone

  • Creates a new quat initialized with values from an existing quaternion

    function

    Parameters

    • a: IArray

      quaternion to clone

    Returns IArray

    a new quaternion

conjugate

  • Calculates the conjugate of a quat If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.

    Parameters

    • out: IArray

      the receiving quaternion

    • a: IArray

      quat to calculate conjugate of

    Returns IArray

    out

copy

create

dot

  • Calculates the dot product of two quat's

    function

    Parameters

    Returns number

    dot product of a and b

fromMat3

  • Creates a quaternion from the given 3x3 rotation matrix.

    NOTE: The resultant quaternion is not normalized, so you should be sure to renormalize the quaternion yourself where necessary.

    function

    Parameters

    • out: IArray

      the receiving quaternion

    • m: IArray

      rotation matrix

    Returns IArray

    out

fromValues

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

    function

    Parameters

    • x: number

      X component

    • y: number

      Y component

    • z: number

      Z component

    • w: number

      W component

    Returns IArray

    a new quaternion

identity

invert

len

  • Calculates the length of a quat

    function

    Parameters

    • a: IArray

      vector to calculate length of

    Returns number

    length of a

length

  • Calculates the length of a quat

    function

    Parameters

    • a: IArray

      vector to calculate length of

    Returns number

    length of a

lerp

  • Performs a linear interpolation between two quat's

    function

    Parameters

    • out: IArray

      the receiving quaternion

    • a: IArray

      the first operand

    • b: IArray

      the second operand

    • t: number

      interpolation amount between the two inputs

    Returns IArray

    out

mul

multiply

normalize

rotateX

  • Rotates a quaternion by the given angle about the X axis

    Parameters

    • out: IArray

      quat receiving operation result

    • a: IArray

      quat to rotate

    • rad: number

      angle (in radians) to rotate

    Returns IArray

    out

rotateY

  • Rotates a quaternion by the given angle about the Y axis

    Parameters

    • out: IArray

      quat receiving operation result

    • a: IArray

      quat to rotate

    • rad: number

      angle (in radians) to rotate

    Returns IArray

    out

rotateZ

  • Rotates a quaternion by the given angle about the Z axis

    Parameters

    • out: IArray

      quat receiving operation result

    • a: IArray

      quat to rotate

    • rad: number

      angle (in radians) to rotate

    Returns IArray

    out

rotationTo

  • Sets a quaternion to represent the shortest rotation from one vector to another.

    Both vectors are assumed to be unit length.

    Parameters

    • out: IArray

      the receiving quaternion.

    • a: IArray

      the initial vector

    • b: IArray

      the destination vector

    Returns IArray

    out

scale

  • Scales a quat by a scalar number

    function

    Parameters

    • out: IArray

      the receiving vector

    • a: IArray

      the vector to scale

    • b: number

      amount to scale the vector by

    Returns IArray

    out

set

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

    function

    Parameters

    • out: IArray

      the receiving quaternion

    • x: number

      X component

    • y: number

      Y component

    • z: number

      Z component

    • w: number

      W component

    Returns IArray

    out

setAxes

  • Sets the specified quaternion with values corresponding to the given axes. Each axis is a vec3 and is expected to be unit length and perpendicular to all other specified axes.

    Parameters

    • out: IArray
    • view: IArray

      the vector representing the viewing direction

    • right: IArray

      the vector representing the local "right" direction

    • up: IArray

      the vector representing the local "up" direction

    Returns IArray

    out

setAxisAngle

  • Sets a quat from the given angle and rotation axis, then returns it.

    Parameters

    • out: IArray

      the receiving quaternion

    • axis: IArray

      the axis around which to rotate

    • rad: number

      the angle in radians

    Returns IArray

    out

slerp

  • Performs a spherical linear interpolation between two quat

    Parameters

    • out: IArray

      the receiving quaternion

    • a: IArray

      the first operand

    • b: IArray

      the second operand

    • t: number

      interpolation amount between the two inputs

    Returns IArray

    out

sqrLen

  • Calculates the squared length of a quat

    function

    Parameters

    • a: IArray

      vector to calculate squared length of

    Returns number

    squared length of a

squaredLength

  • squaredLength(a: IArray): number
  • Calculates the squared length of a quat

    function

    Parameters

    • a: IArray

      vector to calculate squared length of

    Returns number

    squared length of a

str

  • Returns a string representation of a quatenion

    Parameters

    Returns string

    string representation of the vector

Generated using TypeDoc