ApasScript.

Quaternions

quaternion

The quaternion w + xi + yj + zk. Arithmetic stays exact when the parts are.

norm

|q| = sqrt(w^2 + x^2 + y^2 + z^2), exact. Also works on tensors.

normSq

|q|^2, exact.

inverse

q^-1 = conjugate(q) / |q|^2, exact.

isUnit

True if |q| = 1.

scalarPart

w, the real part.

vectorPart

(x, y, z) as a vector.

axisAngle

The unit quaternion rotating by angle (radians) about the axis (ax, ay, az).

toAxisAngle

The rotation axis and angle of a unit quaternion.

fromEuler

The rotation quaternion for roll, pitch, yaw (radians).

compose

The rotation q1 followed by q2 (q2 * q1).

rotationMatrix

The 3x3 rotation matrix of q.

qexp

e^q.

qlog

The natural logarithm of q.

qpow

q^t for a real t.

slerp

Spherical linear interpolation from q0 (t = 0) to q1 (t = 1).