quaternion_multiply

compas.geometry.quaternion_multiply(r, q)[source]

Multiplies two quaternions.

Parameters:
r[float, float, float, float] | compas.geometry.Quaternion

Quaternion or sequence of four floats [w, x, y, z].

q[float, float, float, float] | compas.geometry.Quaternion

Quaternion or sequence of four floats [w, x, y, z].

Returns:
[float, float, float, float]

Quaternion \(p = rq\) as a list of four real values [pw, px, py, pz].

Notes

Multiplication of two quaternions \(p = rq\) can be interpreted as applying rotation \(r\) to an orientation \(q\), provided that both \(r\) and \(q\) are unit-length. The result is also unit-length. Multiplication of quaternions is not commutative!

References