Type Quaternion

Quaternion Fields are stored as r, i, j, k components respectively and can be indexed with 1-4 or the field's name.

Methods

abs() Returns the absolute value of the quaternion.
conj() Returns the conjugate of the quaternion.
exp() Returns Euler's constant e raised to the power of the quaternion.
forward() Returns a vector pointing forward, relative to the rotation represented by the quaternion.
inv() Returns the inverse of the quaternion.
mod() Changes the quaternion so that the represented rotation is by an angle between 0 and 180 degrees.
right() Returns a vector pointing right, relative to the rotation represented by the quaternion.
setUnpacked( real, i, j, k ) Sets the values of the quaternion.
unpack() Returns the 4 components of the quaternion.
up() Returns a vector pointing up, relative to the rotation represented by the quaternion.


Methods

Quaternion:abs()
Returns the absolute value of the quaternion.

Environment:

Shared
Quaternion:conj()
Returns the conjugate of the quaternion.

Environment:

Shared

Return value:

    (Quaternion) The conjugate of this quaternion as a new quaternion.
Quaternion:exp()
Returns Euler's constant e raised to the power of the quaternion.

Environment:

Shared

Return value:

    (Quaternion) e raised to the power of the given quaternion.
Quaternion:forward()
Returns a vector pointing forward, relative to the rotation represented by the quaternion.

Environment:

Shared

Return value:

    (Vector) Forward vector.
Quaternion:inv()
Returns the inverse of the quaternion.

Environment:

Shared

Return value:

    (Quaternion) The inverse of this quaternion as a new quaternion.
Quaternion:mod()
Changes the quaternion so that the represented rotation is by an angle between 0 and 180 degrees.

Environment:

Shared

Return value:

    (Quaternion) A new quaternion with a normalised angle.
Quaternion:right()
Returns a vector pointing right, relative to the rotation represented by the quaternion.

Environment:

Shared

Return value:

    (Vector) Right vector.
Quaternion:setUnpacked( real, i, j, k )
Sets the values of the quaternion.

Environment:

Shared

Parameters:

  • real: The real part to set.
  • i: The i component value to set.
  • j: The j component value to set.
  • k: The k component value to set.

Return value:

    (Quaternion) The quaternion.
Quaternion:unpack()
Returns the 4 components of the quaternion.

Environment:

Shared

Return values:

  1. The real part.
  2. The i component.
  3. The j component.
  4. The k component.
Quaternion:up()
Returns a vector pointing up, relative to the rotation represented by the quaternion.

Environment:

Shared

Return value:

    (Vector) Up vector.

Valid XHTML 1.0!