This module provides rotations in 3D space based on quaternions. It is intended to be imported qualified, for example like this:
import Data.Quaternion.Rotation (Rotation) import Data.Quaternion.Rotation as Rotation
newtype Rotation a
A rotation in three-dimensional space, represented by a unit quaternion (also known as a versor).
The constructor is not exported to ensure that only valid rotations can be constructed.
The semigroup instance provides composition of rotations;
p <> q gives
a rotation representating the rotation
q followed by the rotation
Note that in general, this is not the same as
p followed by
Though all functions in this library which create a
Rotation ensure that
Quaternion has magnitude 1, after a sufficient number of
arithmetic operations the magnitude may drift away from 1. In this case
normalize can be used;
normalize takes a possibly-drifted
and rescales if it necessary, so that its magnitude returns to 1.
Convert a 3-by-3 rotation matrix to a Rotation representing the same rotation. The argument should be an array with exactly 9 elements, with the entries in column-major order. If the argument does not have 9 elements, or if it does not represent a rotation matrix, the behaviour of this function is not defined.