Quaternion
A quaternion.
Static Method Summary
Static Public Methods | ||
public static |
slerp(qa: Quaternion, qb: Quaternion, qr: Quaternion, t: Number): Quaternion Performs a spherical linear interpolation. |
|
public static |
slerpFlat(dst: Number[], dstOffset: Number, src0: Number[], srcOffset0: Number, src1: Number[], srcOffset1: Number, t: Number) Performs an array-based spherical linear interpolation. |
Constructor Summary
Public Constructor | ||
public |
constructor(x: Number, y: Number, z: Number, w: Number) Constructs a new quaternion. |
Member Summary
Public Members | ||
public |
The W component. |
|
public |
The X component. |
|
public |
The Y component. |
|
public |
The Z component. |
Method Summary
Public Methods | ||
public |
angleTo(q: Quaternion): Number Calculates the angle to another quaternion. |
|
public |
clone(): Quaternion Clones this quaternion. |
|
public |
Conjugates this quaternion. |
|
public |
copy(q: Quaternion): Quaternion Copies the components of the given quaternion. |
|
public |
Calculates the dot product with a given vector. |
|
public |
equals(q: Quaternion): Boolean Checks if this quaternions equals the given one. |
|
public |
fromArray(array: Number[], offset: Number): Quaternion Copies values from an array. |
|
public |
invert(): Quaternion Inverts this quaternion. |
|
public |
Calculates the length of this quaternion. |
|
public |
Calculates the squared length of this quaternion. |
|
public |
multiply(q: Quaternion): Quaternion Multiplies this quaternion with the given one and stores the result in this quaternion. |
|
public |
Multiplies the given quaternions and stores the result in this quaternion. |
|
public |
Normalizes this quaternion. |
|
public |
Multiplies the given quaternion with this one and stores the result in this quaternion. |
|
public |
rotateTowards(q: Quaternion, step: Number): Quaternion Rotates this quaternion towards the given one by a given step size. |
|
public |
Sets the components of this quaternion. |
|
public |
setFromAxisAngle(axis: Vector3, angle: Number): Quaternion Sets the components of this quaternion based on a given axis angle. |
|
public |
setFromEuler(euler: Euler): Quaternion Sets the components of this quaternion based on the given Euler angles. |
|
public |
Sets the components of this quaternion based on a given rotation matrix. |
|
public |
setFromUnitVectors(vFrom: Vector3, vTo: Vector3): Quaternion Sets the components of this quaternion based on unit vectors. |
|
public |
slerp(q: Quaternion, t: Number): Quaternion Performs a spherical linear interpolation towards the given quaternion. |
|
public |
Stores this quaternion in an array. |
Static Public Methods
public static slerp(qa: Quaternion, qb: Quaternion, qr: Quaternion, t: Number): Quaternion source
Performs a spherical linear interpolation.
Params:
Name | Type | Attribute | Description |
qa | Quaternion | The base quaternion. |
|
qb | Quaternion | The target quaternion. |
|
qr | Quaternion | A quaternion to store the result in. |
|
t | Number | The slerp factor. |
public static slerpFlat(dst: Number[], dstOffset: Number, src0: Number[], srcOffset0: Number, src1: Number[], srcOffset1: Number, t: Number) source
Performs an array-based spherical linear interpolation.
Params:
Name | Type | Attribute | Description |
dst | Number[] | An array to store the result in. |
|
dstOffset | Number | An offset into the destination array. |
|
src0 | Number[] | An array that contains the base quaternion values. |
|
srcOffset0 | Number | An offset into the base array. |
|
src1 | Number[] | An array that contains the target quaternion values. |
|
srcOffset1 | Number | An offset into the target array. |
|
t | Number | The slerp factor. |
Public Constructors
Public Members
Public Methods
public angleTo(q: Quaternion): Number source
Calculates the angle to another quaternion.
Params:
Name | Type | Attribute | Description |
q | Quaternion | A quaternion. |
public copy(q: Quaternion): Quaternion source
Copies the components of the given quaternion.
Params:
Name | Type | Attribute | Description |
q | Quaternion | The quaternion. |
public dot(v: Vector4): Number source
Calculates the dot product with a given vector.
Params:
Name | Type | Attribute | Description |
v | Vector4 | A vector. |
public equals(q: Quaternion): Boolean source
Checks if this quaternions equals the given one.
Params:
Name | Type | Attribute | Description |
q | Quaternion | A quaternion. |
public fromArray(array: Number[], offset: Number): Quaternion source
Copies values from an array.
public invert(): Quaternion source
Inverts this quaternion. The quaternion is assumed to have unit length.
public multiply(q: Quaternion): Quaternion source
Multiplies this quaternion with the given one and stores the result in this quaternion.
Params:
Name | Type | Attribute | Description |
q | Quaternion | A quaternion. |
public multiplyQuaternions(a: Quaternion, b: Quaternion): Quaternion source
Multiplies the given quaternions and stores the result in this quaternion.
For more details see: http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
Params:
Name | Type | Attribute | Description |
a | Quaternion | A quaternion. |
|
b | Quaternion | Another quaternion. |
public premultiply(q: Quaternion): Quaternion source
Multiplies the given quaternion with this one and stores the result in this quaternion.
Params:
Name | Type | Attribute | Description |
q | Quaternion | A quaternion. |
public rotateTowards(q: Quaternion, step: Number): Quaternion source
Rotates this quaternion towards the given one by a given step size.
Params:
Name | Type | Attribute | Description |
q | Quaternion | The target quaternion. |
|
step | Number | The step size. |
public set(x: Number, y: Number, z: Number, w: Number): Quaternion source
Sets the components of this quaternion.
public setFromAxisAngle(axis: Vector3, angle: Number): Quaternion source
Sets the components of this quaternion based on a given axis angle.
For more information see: http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm
public setFromEuler(euler: Euler): Quaternion source
Sets the components of this quaternion based on the given Euler angles.
For more details see: https://goo.gl/XRD1kr
Params:
Name | Type | Attribute | Description |
euler | Euler | The euler angles. |
public setFromRotationMatrix(m: Matrix4): Quaternion source
Sets the components of this quaternion based on a given rotation matrix.
For more information see: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
Params:
Name | Type | Attribute | Description |
m | Matrix4 | The rotation matrix. The upper 3x3 is assumed to be a pure rotation matrix (i.e. unscaled). |
public setFromUnitVectors(vFrom: Vector3, vTo: Vector3): Quaternion source
Sets the components of this quaternion based on unit vectors.
public slerp(q: Quaternion, t: Number): Quaternion source
Performs a spherical linear interpolation towards the given quaternion.
For more details see: http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
Params:
Name | Type | Attribute | Description |
q | Quaternion | A quaternion. |
|
t | Number | The slerp factor. |