Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Quaternion

A Quaternion describes a rotation in 3D space. The Quaternion is mathematically defined as Q = xi + yj + z*k + w, where (i,j,k) are imaginary basis vectors. (x,y,z) can be seen as a vector related to the axis of rotation, while the real multiplier, w, is related to the amount of rotation.

param x

Multiplier of the imaginary basis vector i.

param y

Multiplier of the imaginary basis vector j.

param z

Multiplier of the imaginary basis vector k.

param w

Multiplier of the real part.

see

http://en.wikipedia.org/wiki/Quaternion

Hierarchy

  • Quaternion

Index

Constructors

constructor

  • new Quaternion(x?: number, y?: number, z?: number, w?: number): Quaternion

Methods

conjugate

copy

integrate

inverse

mult

normalize

normalizeFast

set

  • set(x: number, y: number, z: number, w: number): Quaternion

setFromAxisAngle

setFromEuler

  • setFromEuler(x: number, y: number, z: number, order?: string): Quaternion
  • Set the quaternion components given Euler angle representation.

    Parameters

    • x: number
    • y: number
    • z: number
    • order: string = 'XYZ'

      The order to apply angles: 'XYZ' or 'YXZ' or any other combination.

      See MathWorks reference

    Returns Quaternion

setFromVectors

slerp

  • Performs a spherical linear interpolation between two quat

    Parameters

    • toQuat: Quaternion

      second operand

    • t: number

      interpolation amount between the self quaternion and toQuat

    • target: Quaternion = ...

      A quaternion to store the result in. If not provided, a new one will be created.

    Returns Quaternion

    The "target" object

toArray

  • toArray(): [number, number, number, number]

toAxisAngle

  • toAxisAngle(targetAxis?: Vec3): [Vec3, number]
  • Converts the quaternion to [ axis, angle ] representation.

    Parameters

    • targetAxis: Vec3 = ...

      A vector object to reuse for storing the axis.

    Returns [Vec3, number]

    An array, first element is the axis and the second is the angle in radians.

toEuler

  • toEuler(target: Vec3, order?: string): void

toString

  • toString(): string

vmult