Quaternion

Hierarchy

  • Quaternion

Index

Constructors

constructor

Find examples in Playground
  • new Quaternion(x?: number, y?: number, z?: number, w?: number): Quaternion
  • Creates a new Quaternion from the given floats

    Parameters

    • Optional x: number

      defines the first component (0 by default)

    • Optional y: number

      defines the second component (0 by default)

    • Optional z: number

      defines the third component (0 by default)

    • Optional w: number

      defines the fourth component (1.0 by default)

    Returns Quaternion

Properties

w

Find examples in Playground
w: number

defines the fourth component (1.0 by default)

x

Find examples in Playground
x: number

defines the first component (0 by default)

y

Find examples in Playground
y: number

defines the second component (0 by default)

z

Find examples in Playground
z: number

defines the third component (0 by default)

Methods

add

Find examples in Playground
  • Adds two quaternions

    Parameters

    Returns Quaternion

    a new quaternion as the addition result of the given one and the current quaternion

addInPlace

Find examples in Playground

asArray

Find examples in Playground
  • asArray(): number[]
  • Copy the quaternion to an array

    Returns number[]

    a new array populated with 4 elements from the quaternion coordinates

clone

Find examples in Playground
  • Clone the current quaternion

    Returns Quaternion

    a new quaternion copied from the current one

conjugate

Find examples in Playground
  • Conjugates in place (1-q) the current quaternion

    Returns Quaternion

    a new quaternion

conjugateInPlace

Find examples in Playground
  • Conjugates in place (1-q) the current quaternion

    Returns Quaternion

    the current updated quaternion

conjugateToRef

Find examples in Playground
  • Conjugates (1-q) the current quaternion and stores the result in the given quaternion

    Parameters

    Returns Quaternion

    the current quaternion

copyFrom

Find examples in Playground

copyFromFloats

Find examples in Playground
  • copyFromFloats(x: number, y: number, z: number, w: number): Quaternion
  • Updates the current quaternion with the given float coordinates

    Parameters

    • x: number

      defines the x coordinate

    • y: number

      defines the y coordinate

    • z: number

      defines the z coordinate

    • w: number

      defines the w coordinate

    Returns Quaternion

    the updated current quaternion

equals

Find examples in Playground
  • Check if two quaternions are equals

    Parameters

    Returns boolean

    true if the current quaternion and the given one coordinates are strictly equals

fromRotationMatrix

Find examples in Playground
  • Updates the current quaternion from the given rotation matrix values

    Parameters

    Returns Quaternion

    the current updated quaternion

getClassName

Find examples in Playground
  • getClassName(): string
  • Gets the class name of the quaternion

    Returns string

    the string "Quaternion"

getHashCode

Find examples in Playground
  • getHashCode(): number
  • Gets a hash code for this quaternion

    Returns number

    the quaternion hash code

length

Find examples in Playground
  • length(): number
  • Gets length of current quaternion

    Returns number

    the quaternion length (float)

multiply

Find examples in Playground
  • Multiplies two quaternions

    Parameters

    Returns Quaternion

    a new quaternion set as the multiplication result of the current one with the given one "q1"

multiplyInPlace

Find examples in Playground
  • Updates the current quaternion with the multiplication of itself with the given one "q1"

    Parameters

    Returns Quaternion

    the currentupdated quaternion

multiplyToRef

Find examples in Playground
  • Sets the given "result" as the the multiplication result of the current one with the given one "q1"

    Parameters

    Returns Quaternion

    the current quaternion

normalize

Find examples in Playground
  • Normalize in place the current quaternion

    Returns Quaternion

    the current updated quaternion

scale

Find examples in Playground
  • Multiplies the current quaternion by a scale factor

    Parameters

    • value: number

      defines the scale factor

    Returns Quaternion

    a new quaternion set by multiplying the current quaternion coordinates by the float "scale"

scaleAndAddToRef

Find examples in Playground
  • Scale the current quaternion values by a factor and add the result to a given quaternion

    Parameters

    • scale: number

      defines the scale factor

    • result: Quaternion

      defines the Quaternion object where to store the result

    Returns Quaternion

    the unmodified current quaternion

scaleInPlace

Find examples in Playground
  • Multiplies in place the current quaternion by a scale factor

    Parameters

    • value: number

      defines the scale factor

    Returns Quaternion

    the current modified quaternion

scaleToRef

Find examples in Playground
  • Scale the current quaternion values by a factor and stores the result to a given quaternion

    Parameters

    • scale: number

      defines the scale factor

    • result: Quaternion

      defines the Quaternion object where to store the result

    Returns Quaternion

    the unmodified current quaternion

set

Find examples in Playground
  • set(x: number, y: number, z: number, w: number): Quaternion
  • Updates the current quaternion from the given float coordinates

    Parameters

    • x: number

      defines the x coordinate

    • y: number

      defines the y coordinate

    • z: number

      defines the z coordinate

    • w: number

      defines the w coordinate

    Returns Quaternion

    the updated current quaternion

subtract

Find examples in Playground
  • Subtract two quaternions

    Parameters

    Returns Quaternion

    a new quaternion as the subtraction result of the given one from the current one

toEulerAngles

Find examples in Playground
  • toEulerAngles(order?: string): Vector3
  • Returns a new Vector3 set with the Euler angles translated from the current quaternion

    Parameters

    • Optional order: string

      is a reserved parameter and is ignore for now

    Returns Vector3

    a new Vector3 containing the Euler angles

toEulerAnglesToRef

Find examples in Playground
  • Sets the given vector3 "result" with the Euler angles translated from the current quaternion

    Parameters

    • result: Vector3

      defines the vector which will be filled with the Euler angles

    • Optional order: string

      is a reserved parameter and is ignore for now

    Returns Quaternion

    the current unchanged quaternion

toRotationMatrix

Find examples in Playground
  • Updates the given rotation matrix with the current quaternion values

    Parameters

    • result: Matrix

      defines the target matrix

    Returns Quaternion

    the current unchanged quaternion

toString

Find examples in Playground
  • toString(): string
  • Gets a string representation for the current quaternion

    Returns string

    a string with the Quaternion coordinates

Static AreClose

Find examples in Playground
  • Checks if the two quaternions are close to each other

    Parameters

    Returns boolean

    true if the two quaternions are close to each other

Static Dot

Find examples in Playground
  • Returns the dot product (float) between the quaternions "left" and "right"

    Parameters

    Returns number

    the dot product

Static FromArray

Find examples in Playground
  • Creates a new quaternion from data stored into an array

    Parameters

    • array: DeepImmutable<ArrayLike<number>>

      defines the data source

    • Optional offset: number

      defines the offset in the source array where the data starts

    Returns Quaternion

    a new quaternion

Static FromEulerAngles

Find examples in Playground
  • FromEulerAngles(x: number, y: number, z: number): Quaternion
  • Create a quaternion from Euler rotation angles

    Parameters

    • x: number

      Pitch

    • y: number

      Yaw

    • z: number

      Roll

    Returns Quaternion

    the new Quaternion

Static FromEulerAnglesToRef

Find examples in Playground
  • Updates a quaternion from Euler rotation angles

    Parameters

    • x: number

      Pitch

    • y: number

      Yaw

    • z: number

      Roll

    • result: Quaternion

      the quaternion to store the result

    Returns Quaternion

    the updated quaternion

Static FromEulerVector

Find examples in Playground
  • Create a quaternion from Euler rotation vector

    Parameters

    Returns Quaternion

    the new Quaternion

Static FromEulerVectorToRef

Find examples in Playground
  • Updates a quaternion from Euler rotation vector

    Parameters

    Returns Quaternion

    the updated quaternion

Static FromRotationMatrix

Find examples in Playground
  • Creates a new quaternion from a rotation matrix

    Parameters

    Returns Quaternion

    a new quaternion created from the given rotation matrix values

Static FromRotationMatrixToRef

Find examples in Playground
  • Updates the given quaternion with the given rotation matrix values

    Parameters

    Returns void

Static Hermite

Find examples in Playground

Static Identity

Find examples in Playground
  • Creates an identity quaternion

    Returns Quaternion

    the identity quaternion

Static Inverse

Find examples in Playground
  • Inverse a given quaternion

    Parameters

    Returns Quaternion

    a new quaternion as the inverted current quaternion

Static InverseToRef

Find examples in Playground
  • Inverse a given quaternion

    Parameters

    • q: Quaternion

      defines the source quaternion

    • result: Quaternion

      the quaternion the result will be stored in

    Returns Quaternion

    the result quaternion

Static IsIdentity

Find examples in Playground
  • Gets a boolean indicating if the given quaternion is identity

    Parameters

    Returns boolean

    true if the quaternion is identity

Static RotationAlphaBetaGamma

Find examples in Playground
  • RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion
  • Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation

    Parameters

    • alpha: number

      defines the rotation around first axis

    • beta: number

      defines the rotation around second axis

    • gamma: number

      defines the rotation around third axis

    Returns Quaternion

    the new quaternion

Static RotationAlphaBetaGammaToRef

Find examples in Playground
  • RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void
  • Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation and stores it in the target quaternion

    Parameters

    • alpha: number

      defines the rotation around first axis

    • beta: number

      defines the rotation around second axis

    • gamma: number

      defines the rotation around third axis

    • result: Quaternion

      defines the target quaternion

    Returns void

Static RotationAxis

Find examples in Playground
  • Creates a quaternion from a rotation around an axis

    Parameters

    Returns Quaternion

    a new quaternion created from the given axis (Vector3) and angle in radians (float)

Static RotationAxisToRef

Find examples in Playground
  • Creates a rotation around an axis and stores it into the given quaternion

    Parameters

    Returns Quaternion

    the target quaternion

Static RotationQuaternionFromAxis

Find examples in Playground
  • Creates a new quaternion containing the rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation)

    Parameters

    Returns Quaternion

    the new quaternion

Static RotationQuaternionFromAxisToRef

Find examples in Playground
  • Creates a rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation) and stores it in the target quaternion

    Parameters

    Returns void

Static RotationYawPitchRoll

Find examples in Playground
  • RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion
  • Creates a new quaternion from the given Euler float angles (y, x, z)

    Parameters

    • yaw: number

      defines the rotation around Y axis

    • pitch: number

      defines the rotation around X axis

    • roll: number

      defines the rotation around Z axis

    Returns Quaternion

    the new quaternion

Static RotationYawPitchRollToRef

Find examples in Playground
  • RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void
  • Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion

    Parameters

    • yaw: number

      defines the rotation around Y axis

    • pitch: number

      defines the rotation around X axis

    • roll: number

      defines the rotation around Z axis

    • result: Quaternion

      defines the target quaternion

    Returns void

Static Slerp

Find examples in Playground

Static SlerpToRef

Find examples in Playground
  • Interpolates between two quaternions and stores it into a target quaternion

    Parameters

    Returns void

Static Zero

Find examples in Playground
  • Creates an empty quaternion

    Returns Quaternion

    a new quaternion set to (0.0, 0.0, 0.0)

Generated using TypeDoc