packages feed

spatial-math 0.1.3 → 0.1.4

raw patch · 2 files changed

+23/−1 lines, 2 files

Files

SpatialMath.hs view
@@ -8,6 +8,8 @@ --                   , Quat(..)                    , Euler(..)                    , rotateXyzAboutX+                   , rotateXyzAboutY+                   , rotateXyzAboutZ                    , euler321OfQuat                    , euler321OfDcm                    , quatOfEuler321@@ -49,6 +51,26 @@     bx =  ax     by =  ay*cosTheta + az*sinTheta     bz = -ay*sinTheta + az*cosTheta++rotateXyzAboutY :: Floating a => Xyz a -> a -> Xyz a+rotateXyzAboutY (Xyz ax ay az) rotAngle = Xyz bx by bz+  where+    cosTheta = cos rotAngle+    sinTheta = sin rotAngle++    bx =  ax*cosTheta - az*sinTheta+    by =  ay+    bz =  ax*sinTheta + az*cosTheta++rotateXyzAboutZ :: Floating a => Xyz a -> a -> Xyz a+rotateXyzAboutZ (Xyz ax ay az) rotAngle = Xyz bx by bz+  where+    cosTheta = cos rotAngle+    sinTheta = sin rotAngle++    bx =  ax*cosTheta + ay*sinTheta+    by = -ax*sinTheta + ay*cosTheta+    bz =  az  euler321OfQuat :: RealFloat a => Quat a -> Euler a euler321OfQuat (Quat q0 q1 q2 q3) = Euler yaw pitch roll
spatial-math.cabal view
@@ -1,5 +1,5 @@ name:                spatial-math-version:             0.1.3+version:             0.1.4 synopsis:            3d math including quaternions/euler angles/dcms and utility functions description:         This is a port of my 'mathlib' C library: https://github.com/ghorn/mathlib license:             BSD3