Module
Data.Quaternion.Rotation
- Package
- purescript-quaternions
- Repository
- hdgarrood/purescript-quaternions
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
#Rotation Source
newtype Rotation aA 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 p.
Note that in general, this is not the same as p followed by q!
Instances
#fromQuaternion Source
fromQuaternion :: Quaternion Number -> Rotation NumberConstruct a Rotation from any Quaternion, by normalizing to a versor.
#toQuaternion Source
toQuaternion :: forall a. Rotation a -> Quaternion aGet the underlying versor.
#showAngleAxis Source
showAngleAxis :: Rotation Number -> StringAn alternative string representation, which can be useful for debugging.