Three-dimensional rotations can be represented by three real numbers
(Euler angles), four real numbers (unit quaternions) or nine real numbers
(orthogonal matrices with determinant 1). Quaternions, at the price of
carrying one more number than necessary, are supremely elegant and
have certain practical advantages too.
This module provides an extended idiomatic Lua interface to the CQRlib
library written by Herbert J. Bernstein. It is not a "binding"; access to
the original documentation is only required for those who wish to
understand the module's C code lcqr.c.
A quaternion is implemented as an immutable userdata consisting of
four double precision numbers. The metatable of that module, which is
its own __index, is returned by require "cqr".
Liberal use is made of the additional binary operators of Lua 5.3, e.g.
a // (p|q)
means "a rotated by the quaternion that rotates p to lie on q".