module HGamer3D.Data.Transform3D
(
translate,
scale,
yaw,
pitch,
roll
)
where
import HGamer3D.Data.Vector
import HGamer3D.Data.Angle
type Position = Vec3
type Orientation = UnitQuaternion
type Size = Vec3
translate :: Position -> Position -> Position
translate = (&+)
scale :: Size -> Vec3 -> Size
scale = (&!)
rotRelativeToObjectAxis :: Orientation -> Vec3 -> Float -> Orientation
rotRelativeToObjectAxis ori axis val = let
odir = actU ori axis
qrot = rotU odir val
nrot = qrot .*. ori
in nrot
yaw :: Orientation -> Angle -> Orientation
yaw ori val = rotRelativeToObjectAxis ori vec3Y (asRad val)
roll :: Orientation -> Angle -> Orientation
roll ori val = rotRelativeToObjectAxis ori vec3Z (asRad val)
pitch :: Orientation -> Angle -> Orientation
pitch ori val = rotRelativeToObjectAxis ori vec3X (asRad val)