Class: Quaternion

Quaternion

new Quaternion(wopt, xopt, yopt, zopt)

Quaternion is an internally used class. A Quaternion instance is attached to a DisplayObject3D object's transform3D property (which is itself an instance of the Transform3D class). It is part of internal calculations, and should only be accessed by extremely advanced users. You should not have to deal with this class in normal usage of the engine.
Parameters:
Name Type Attributes Default Description
w Number <optional>
0 New instance's w value.
x Number <optional>
0 New instance's x value.
y Number <optional>
0 New instance's y value.
z Number <optional>
0 New instance's z value.
Source:

Members

w :Number

The Quaternion instance's w property. Used for calculations.
Type:
  • Number
Default Value:
  • 0
Source:

x :Number

The Quaternion instance's x property. Used for calculations.
Type:
  • Number
Default Value:
  • 0
Source:

y :Number

The Quaternion instance's y property. Used for calculations.
Type:
  • Number
Default Value:
  • 0
Source:

z :Number

The Quaternion instance's z property. Used for calculations.
Type:
  • Number
Default Value:
  • 0
Source:

Methods

(static) multiply(q1, q2) → {Quaternion}

Multiplies two Quaterions together. Note: multiplication of quaternions is non-commutative. Order matters.
Parameters:
Name Type Description
q1 Quaternion The first quaternion to multiply.
q2 Quaternion The second quaternion to multiply.
Source:
Returns:
Returns a new Quaternion with the result of the multiplication.
Type
Quaternion

clone() → {Quaternion}

Produces a new Quaternion instance that is duplicate of the current one.
Source:
Returns:
Returns a new Quaternion instance.
Type
Quaternion

concatenate(q)

This method concatenates the values of another Quaternion with this Quaternion and then sets the resulting values to this Quaternion's w, z, y, and z properties. This is vital for forward kinematics of 3D rotations. There is no return; the Quaternion intance on which this method is called (as opposed to the one supplied as a parameter) is modified as a result.
Parameters:
Name Type Description
q Quaternion Quaternion to concatenate with this one.
Source:

copy(q)

A shortcut to copy the w, x, y, and z values of another Quaternion to this one.
Parameters:
Name Type Description
q Quaternion The Quaternion instance to copy values from.
Source:

copyInverse(p)

A shortcut to copy the inverted result of another Quaternion to this one.
Parameters:
Name Type Description
p Quaternion The Quaternion instance to invert and then get values from.
Source:

normalize()

Normalizes the Quaternion.
Source:

toEuler() → {EulerAngle}

A method for getting a EulerAngle based on the current Quaternion.
Source:
Returns:
Returns a new EulerAngle instance.
Type
EulerAngle

toString() → {String}

Returns a String representation of the Quaternion instance's values.
Source:
Returns:
Returns a string with an object notation form of the w, x, y, and z properties.
Type
String

updateFromEuler(euler)

A method for updating the w, x, y, and z properties based on a EulerAngle intance.
Parameters:
Name Type Description
euler EulerAngle EulerAngle instance to update from.
Source: