[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [ANN] Quaternion rotation library
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 24 Apr 2019 22:10:35 +0200
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".
The C code, as well as a test suite in Lua and HTML documentation and
a Makefile for Linux, can be found at https://github.com/dlaurie/lua-cqr.
-- Dirk