CLASSES
TagsA - Z

Quaternion

Description

class Quaternion

Constructor

new Quaternion(x, y, z, w)

Creates a new Quaternion

Parameters

Name Type Description
optional x number The X coordinate of another vector
optional y number The Y coordinate of another vector
optional z number The Z coordinate of another vector

Members

x : number

The first coordinate

y : number

The second coordinate

z : number

The third coordinate

w : number

The fourth coordinate

Methods

toString() → string

Returns a string representation of the quaternion

getClassName() → string

getHashCode() → number

asArray() → number[]

Returns an array representation of the quaternion

equals(otherQuaternion) → boolean

Tests if two quaternion are identical

Parameters

Name Type Description
otherQuaternion Quaternion The quaternion to test against

clone() → Quaternion

Returns a clone of the quaternion

copyFrom(other) → Quaternion

Copies another quaternion

Parameters

Name Type Description
other Quaternion Another quaternion

copyFromFloats(x, y, z, w) → Quaternion

Copies another queternion from a set of floats

Parameters

Name Type Description
x number The X coordinate of another vector
y number The Y coordinate of another vector
z number The Z coordinate of another vector

add(other) → Quaternion

Adds in another quaternion

Parameters

Name Type Description
other Quaternion Another quaternion

subtract(other) → Quaternion

Substracts another quaternion

Parameters

Name Type Description
other Quaternion Another quaternion

scale(value) → Quaternion

Scales a quaternion

Parameters

Name Type Description
value number @param value

multiply(q1) → Quaternion

Multiplies by another quaternion

Parameters

Name Type Description
q1 Quaternion Another quaternion

multiplyToRef(q1, result) → Quaternion

Multiplies another quaternion into a third target quaternion

Parameters

Name Type Description
q1 Quaternion Another quaternion
result Quaternion

multiplyInPlace(q1) → Quaternion

Parameters

Name Type Description
q1 Quaternion Another quaternion

conjugateToRef(ref) → Quaternion

Parameters

Name Type Description
ref Quaternion

conjugateInPlace() → Quaternion

conjugate() → Quaternion

length() → number

The length of the quaternion

normalize() → Quaternion

Normalizes the quaternion

toEulerAngles(order) → Vector3

Parameters

Name Type Description
optional order string

toEulerAnglesToRef(result, order) → Quaternion

Parameters

Name Type Description
result Vector3
optional order string

toRotationMatrix(result) → Quaternion

Converts the quaternion into a target rotation Matrix object

Parameters

Name Type Description
result Matrix

fromRotationMatrix(matrix) → Quaternion

Imports a source matrix into the current quaternion

Parameters

Name Type Description
matrix Matrix

static FromRotationMatrix(matrix) → Quaternion

Parameters

Name Type Description
matrix Matrix

static FromRotationMatrixToRef(matrix, result) → void

Parameters

Name Type Description
matrix Matrix
result Quaternion

static Inverse(q) → Quaternion

Returns the passed quaternion's inverse

Parameters

Name Type Description
q Quaternion The quaternion to inverse

static Identity() → Quaternion

static RotationAxis(axis, angle) → Quaternion

Creates a quaternion using an axis and an angle

Parameters

Name Type Description
axis Vector3 The rotation axis
angle number Some angle

static RotationAxisToRef(axis, angle, result) → Quaternion

Parameters

Name Type Description
axis Vector3 The rotation axis
angle number Some angle
result Quaternion

static FromArray(array, offset) → Quaternion

Creates a quaterion from agiven array

Parameters

Name Type Description
array number[] The given array
optional offset number The first index of the array to look at

static RotationYawPitchRoll(yaw, pitch, roll) → Quaternion

Creates a quaternion from yaw, pitch and roll values

Parameters

Name Type Description
yaw number The yaw rotation
pitch number The pitch rotation
roll number The roll rotation

static RotationYawPitchRollToRef(yaw, pitch, roll, result) → void

Creates a quaternion from yaw, pitch and roll values and put it in the target quaternion

Parameters

Name Type Description
yaw number The yaw rotation
pitch number The pitch rotation
roll number The roll rotation

static RotationAlphaBetaGamma(alpha, beta, gamma) → Quaternion

Parameters

Name Type Description
alpha number
beta number
gamma number

static RotationAlphaBetaGammaToRef(alpha, beta, gamma, result) → void

Parameters

Name Type Description
alpha number
beta number
gamma number

static Slerp(left, right, amount) → Quaternion

Parameters

Name Type Description
left Quaternion interpolation start quaternion
right Quaternion interpolation end quaternion
amount number Weighting factor

static SlerpToRef(left, right, amount, result) → void

Parameters

Name Type Description
left Quaternion interpolation start quaternion
right Quaternion interpolation end quaternion
amount number Weighting factor