Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Euler a = Euler {}
- class Floating a => ArcTan2 a where
- arctan2 :: a -> a -> a
- rotateXyzAboutX :: Floating a => V3 a -> a -> V3 a
- rotateXyzAboutY :: Floating a => V3 a -> a -> V3 a
- rotateXyzAboutZ :: Floating a => V3 a -> a -> V3 a
- euler321OfQuat :: (ArcTan2 a, Ord a) => Quaternion a -> Euler a
- euler321OfDcm :: (Ord a, ArcTan2 a) => M33 a -> Euler a
- unsafeEuler321OfDcm :: ArcTan2 a => M33 a -> Euler a
- quatOfEuler321 :: (Floating a, Ord a) => Euler a -> Quaternion a
- dcmOfQuat :: Num a => Quaternion a -> M33 a
- dcmOfQuatB2A :: Num a => Quaternion a -> M33 a
- dcmOfEuler321 :: Floating a => Euler a -> M33 a
- quatOfDcm :: Floating a => M33 a -> Quaternion a
- quatOfDcmB2A :: Floating a => M33 a -> Quaternion a
- rotVecByDcm :: Num a => M33 a -> V3 a -> V3 a
- rotVecByDcmB2A :: Num a => M33 a -> V3 a -> V3 a
- rotVecByQuat :: Num a => Quaternion a -> V3 a -> V3 a
- rotVecByQuatB2A :: Num a => Quaternion a -> V3 a -> V3 a
- rotVecByEuler :: (Floating a, Ord a) => Euler a -> V3 a -> V3 a
- rotVecByEulerB2A :: (Floating a, Ord a) => Euler a -> V3 a -> V3 a
- type M33 a = V3 (V3 a)
- data V3 a = V3 !a !a !a
- data Quaternion a = Quaternion !a !(V3 a)
Documentation
3-2-1 Euler angle rotation sequence
Instances
Foldable Euler Source # | |
Defined in Types fold :: Monoid m => Euler m -> m # foldMap :: Monoid m => (a -> m) -> Euler a -> m # foldMap' :: Monoid m => (a -> m) -> Euler a -> m # foldr :: (a -> b -> b) -> b -> Euler a -> b # foldr' :: (a -> b -> b) -> b -> Euler a -> b # foldl :: (b -> a -> b) -> b -> Euler a -> b # foldl' :: (b -> a -> b) -> b -> Euler a -> b # foldr1 :: (a -> a -> a) -> Euler a -> a # foldl1 :: (a -> a -> a) -> Euler a -> a # elem :: Eq a => a -> Euler a -> Bool # maximum :: Ord a => Euler a -> a # minimum :: Ord a => Euler a -> a # | |
Traversable Euler Source # | |
Applicative Euler Source # | |
Functor Euler Source # | |
Generic1 Euler Source # | |
Data a => Data (Euler a) Source # | |
Defined in Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Euler a -> c (Euler a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Euler a) # toConstr :: Euler a -> Constr # dataTypeOf :: Euler a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Euler a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Euler a)) # gmapT :: (forall b. Data b => b -> b) -> Euler a -> Euler a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Euler a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Euler a -> r # gmapQ :: (forall d. Data d => d -> u) -> Euler a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Euler a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Euler a -> m (Euler a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Euler a -> m (Euler a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Euler a -> m (Euler a) # | |
Generic (Euler a) Source # | |
Show a => Show (Euler a) Source # | |
Binary a => Binary (Euler a) Source # | |
Serialize a => Serialize (Euler a) Source # | |
Eq a => Eq (Euler a) Source # | |
Ord a => Ord (Euler a) Source # | |
type Rep1 Euler Source # | |
Defined in Types type Rep1 Euler = D1 ('MetaData "Euler" "Types" "SpatialMath-0.2.7.1-FJ8akJ7FKV75UBVB9UHiZk" 'False) (C1 ('MetaCons "Euler" 'PrefixI 'True) (S1 ('MetaSel ('Just "eYaw") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: (S1 ('MetaSel ('Just "ePitch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Just "eRoll") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))) | |
type Rep (Euler a) Source # | |
Defined in Types type Rep (Euler a) = D1 ('MetaData "Euler" "Types" "SpatialMath-0.2.7.1-FJ8akJ7FKV75UBVB9UHiZk" 'False) (C1 ('MetaCons "Euler" 'PrefixI 'True) (S1 ('MetaSel ('Just "eYaw") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: (S1 ('MetaSel ('Just "ePitch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "eRoll") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))) |
class Floating a => ArcTan2 a where Source #
doesn't require RealFloat, used for overloading symbolics
rotateXyzAboutX :: Floating a => V3 a -> a -> V3 a Source #
Rotate a vector about the X axis
>>>
trunc $ rotateXyzAboutX (V3 0 1 0) (pi/2)
V3 0.0 0.0 1.0
>>>
trunc $ rotateXyzAboutX (V3 0 0 1) (pi/2)
V3 0.0 (-1.0) 0.0
rotateXyzAboutY :: Floating a => V3 a -> a -> V3 a Source #
Rotate a vector about the Y axis
>>>
trunc $ rotateXyzAboutY (V3 0 0 1) (pi/2)
V3 1.0 0.0 0.0
>>>
trunc $ rotateXyzAboutY (V3 1 0 0) (pi/2)
V3 0.0 0.0 (-1.0)
rotateXyzAboutZ :: Floating a => V3 a -> a -> V3 a Source #
Rotate a vector about the Z axis
>>>
trunc $ rotateXyzAboutZ (V3 1 0 0) (pi/2)
V3 0.0 1.0 0.0
>>>
trunc $ rotateXyzAboutZ (V3 0 1 0) (pi/2)
V3 (-1.0) 0.0 0.0
euler321OfQuat :: (ArcTan2 a, Ord a) => Quaternion a -> Euler a Source #
Convert quaternion to Euler angles
>>>
euler321OfQuat (Quaternion 1.0 (V3 0.0 0.0 0.0))
Euler {eYaw = 0.0, ePitch = -0.0, eRoll = 0.0}
>>>
euler321OfQuat (Quaternion (sqrt(2)/2) (V3 (sqrt(2)/2) 0.0 0.0))
Euler {eYaw = 0.0, ePitch = -0.0, eRoll = 1.5707963267948966}
>>>
euler321OfQuat (Quaternion (sqrt(2)/2) (V3 0.0 (sqrt(2)/2) 0.0))
Euler {eYaw = 0.0, ePitch = 1.5707963267948966, eRoll = 0.0}
>>>
euler321OfQuat (Quaternion (sqrt(2)/2) (V3 0.0 0.0 (sqrt(2)/2)))
Euler {eYaw = 1.5707963267948966, ePitch = -0.0, eRoll = 0.0}
euler321OfDcm :: (Ord a, ArcTan2 a) => M33 a -> Euler a Source #
Convert DCM to euler angles
>>>
euler321OfDcm $ V3 (V3 1 0 0) (V3 0 1 0) (V3 0 0 1)
Euler {eYaw = 0.0, ePitch = -0.0, eRoll = 0.0}
>>>
euler321OfDcm $ V3 (V3 0 1 0) (V3 (-1) 0 0) (V3 0 0 1)
Euler {eYaw = 1.5707963267948966, ePitch = -0.0, eRoll = 0.0}
>>>
let s = sqrt(2)/2 in euler321OfDcm $ V3 (V3 s s 0) (V3 (-s) s 0) (V3 0 0 1)
Euler {eYaw = 0.7853981633974483, ePitch = -0.0, eRoll = 0.0}
unsafeEuler321OfDcm :: ArcTan2 a => M33 a -> Euler a Source #
Convert DCM to euler angles. Returns Nan if r[1,3] is outside (-1, 1).
>>>
unsafeEuler321OfDcm $ V3 (V3 1 0 0) (V3 0 1 0) (V3 0 0 1)
Euler {eYaw = 0.0, ePitch = -0.0, eRoll = 0.0}
>>>
unsafeEuler321OfDcm $ V3 (V3 0 1 0) (V3 (-1) 0 0) (V3 0 0 1)
Euler {eYaw = 1.5707963267948966, ePitch = -0.0, eRoll = 0.0}
>>>
let s = sqrt(2)/2 in unsafeEuler321OfDcm $ V3 (V3 s s 0) (V3 (-s) s 0) (V3 0 0 1)
Euler {eYaw = 0.7853981633974483, ePitch = -0.0, eRoll = 0.0}
>>>
unsafeEuler321OfDcm $ V3 (V3 0 0 1.1) (V3 0 0 0) (V3 0 0 0)
Euler {eYaw = 0.0, ePitch = NaN, eRoll = 0.0}
quatOfEuler321 :: (Floating a, Ord a) => Euler a -> Quaternion a Source #
Convert Euler angles to quaternion
>>>
quatOfEuler321 (Euler 0 0 0)
Quaternion 1.0 (V3 0.0 0.0 0.0)
>>>
quatOfEuler321 (Euler (pi/2) 0 0)
Quaternion 0.7071067811865476 (V3 0.0 0.0 0.7071067811865475)
>>>
quatOfEuler321 (Euler 0 (pi/2) 0)
Quaternion 0.7071067811865476 (V3 0.0 0.7071067811865475 0.0)
>>>
quatOfEuler321 (Euler 0 0 (pi/2))
Quaternion 0.7071067811865476 (V3 0.7071067811865475 0.0 0.0)
dcmOfQuat :: Num a => Quaternion a -> M33 a Source #
convert a quaternion to a DCM
>>>
dcmOfQuat $ Quaternion 1.0 (V3 0.0 0.0 0.0)
V3 (V3 1.0 0.0 0.0) (V3 0.0 1.0 0.0) (V3 0.0 0.0 1.0)
>>>
let s = sqrt(2)/2 in fmap trunc $ dcmOfQuat $ Quaternion s (V3 0.0 0.0 s)
V3 (V3 0.0 1.0 0.0) (V3 (-1.0) 0.0 0.0) (V3 0.0 0.0 1.0)
>>>
dcmOfQuat $ Quaternion 0.9238795325112867 (V3 0.0 0.0 0.3826834323650898)
V3 (V3 0.7071067811865475 0.7071067811865476 0.0) (V3 (-0.7071067811865476) 0.7071067811865475 0.0) (V3 0.0 0.0 1.0)
dcmOfQuatB2A :: Num a => Quaternion a -> M33 a Source #
dcmOfEuler321 :: Floating a => Euler a -> M33 a Source #
Convert DCM to euler angles
>>>
fmap trunc $ dcmOfEuler321 $ Euler {eYaw = 0.0, ePitch = 0, eRoll = 0}
V3 (V3 1.0 0.0 0.0) (V3 0.0 1.0 0.0) (V3 0.0 0.0 1.0)
>>>
fmap trunc $ dcmOfEuler321 $ Euler {eYaw = pi/2, ePitch = 0, eRoll = 0}
V3 (V3 0.0 1.0 0.0) (V3 (-1.0) 0.0 0.0) (V3 0.0 0.0 1.0)
>>>
fmap trunc $ dcmOfEuler321 $ Euler {eYaw = pi/4, ePitch = 0, eRoll = 0}
V3 (V3 0.7071067811865476 0.7071067811865475 0.0) (V3 (-0.7071067811865475) 0.7071067811865476 0.0) (V3 0.0 0.0 1.0)
quatOfDcm :: Floating a => M33 a -> Quaternion a Source #
convert a DCM to a quaternion
>>>
quatOfDcm $ V3 (V3 1 0 0) (V3 0 1 0) (V3 0 0 1)
Quaternion 1.0 (V3 (-0.0) (-0.0) (-0.0))
>>>
quatOfDcm $ V3 (V3 0 1 0) (V3 (-1) 0 0) (V3 0 0 1)
Quaternion 0.7071067811865477 (V3 (-0.0) (-0.0) 0.7071067811865474)
>>>
let s = sqrt(2)/2 in quatOfDcm $ V3 (V3 s s 0) (V3 (-s) s 0) (V3 0 0 1)
Quaternion 0.9238795325112868 (V3 (-0.0) (-0.0) 0.3826834323650898)
quatOfDcmB2A :: Floating a => M33 a -> Quaternion a Source #
rotVecByQuat :: Num a => Quaternion a -> V3 a -> V3 a Source #
vec_b = q_a2b * vec_a * q_a2b^(-1) vec_b = R(q_a2b) * vec_a
rotVecByQuatB2A :: Num a => Quaternion a -> V3 a -> V3 a Source #
re-exported from linear
A 3-dimensional vector
V3 !a !a !a |
Instances
Representable V3 | |
MonadFix V3 | |
MonadZip V3 | |
Foldable V3 | |
Defined in Linear.V3 fold :: Monoid m => V3 m -> m # foldMap :: Monoid m => (a -> m) -> V3 a -> m # foldMap' :: Monoid m => (a -> m) -> V3 a -> m # foldr :: (a -> b -> b) -> b -> V3 a -> b # foldr' :: (a -> b -> b) -> b -> V3 a -> b # foldl :: (b -> a -> b) -> b -> V3 a -> b # foldl' :: (b -> a -> b) -> b -> V3 a -> b # foldr1 :: (a -> a -> a) -> V3 a -> a # foldl1 :: (a -> a -> a) -> V3 a -> a # elem :: Eq a => a -> V3 a -> Bool # maximum :: Ord a => V3 a -> a # | |
Eq1 V3 | |
Ord1 V3 | |
Read1 V3 | |
Show1 V3 | |
Traversable V3 | |
Applicative V3 | |
Functor V3 | |
Monad V3 | |
Serial1 V3 | |
Defined in Linear.V3 serializeWith :: MonadPut m => (a -> m ()) -> V3 a -> m () # deserializeWith :: MonadGet m => m a -> m (V3 a) # | |
Distributive V3 | |
Foldable1 V3 | |
Defined in Linear.V3 fold1 :: Semigroup m => V3 m -> m # foldMap1 :: Semigroup m => (a -> m) -> V3 a -> m # foldMap1' :: Semigroup m => (a -> m) -> V3 a -> m # toNonEmpty :: V3 a -> NonEmpty a # maximum :: Ord a => V3 a -> a # minimum :: Ord a => V3 a -> a # foldrMap1 :: (a -> b) -> (a -> b -> b) -> V3 a -> b # foldlMap1' :: (a -> b) -> (b -> a -> b) -> V3 a -> b # foldlMap1 :: (a -> b) -> (b -> a -> b) -> V3 a -> b # foldrMap1' :: (a -> b) -> (a -> b -> b) -> V3 a -> b # | |
Hashable1 V3 | |
Metric V3 | |
Trace V3 | |
Finite V3 | |
R1 V3 | |
R2 V3 | |
R3 V3 | |
Additive V3 | |
Apply V3 | |
Bind V3 | |
Traversable1 V3 | |
Generic1 V3 | |
Num r => Coalgebra r (E V3) | |
Unbox a => Vector Vector (V3 a) | |
Defined in Linear.V3 basicUnsafeFreeze :: Mutable Vector s (V3 a) -> ST s (Vector (V3 a)) # basicUnsafeThaw :: Vector (V3 a) -> ST s (Mutable Vector s (V3 a)) # basicLength :: Vector (V3 a) -> Int # basicUnsafeSlice :: Int -> Int -> Vector (V3 a) -> Vector (V3 a) # basicUnsafeIndexM :: Vector (V3 a) -> Int -> Box (V3 a) # basicUnsafeCopy :: Mutable Vector s (V3 a) -> Vector (V3 a) -> ST s () # | |
Unbox a => MVector MVector (V3 a) | |
Defined in Linear.V3 basicLength :: MVector s (V3 a) -> Int # basicUnsafeSlice :: Int -> Int -> MVector s (V3 a) -> MVector s (V3 a) # basicOverlaps :: MVector s (V3 a) -> MVector s (V3 a) -> Bool # basicUnsafeNew :: Int -> ST s (MVector s (V3 a)) # basicInitialize :: MVector s (V3 a) -> ST s () # basicUnsafeReplicate :: Int -> V3 a -> ST s (MVector s (V3 a)) # basicUnsafeRead :: MVector s (V3 a) -> Int -> ST s (V3 a) # basicUnsafeWrite :: MVector s (V3 a) -> Int -> V3 a -> ST s () # basicClear :: MVector s (V3 a) -> ST s () # basicSet :: MVector s (V3 a) -> V3 a -> ST s () # basicUnsafeCopy :: MVector s (V3 a) -> MVector s (V3 a) -> ST s () # basicUnsafeMove :: MVector s (V3 a) -> MVector s (V3 a) -> ST s () # basicUnsafeGrow :: MVector s (V3 a) -> Int -> ST s (MVector s (V3 a)) # | |
Data a => Data (V3 a) | |
Defined in Linear.V3 gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> V3 a -> c (V3 a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (V3 a) # dataTypeOf :: V3 a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (V3 a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V3 a)) # gmapT :: (forall b. Data b => b -> b) -> V3 a -> V3 a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V3 a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V3 a -> r # gmapQ :: (forall d. Data d => d -> u) -> V3 a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> V3 a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> V3 a -> m (V3 a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> V3 a -> m (V3 a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> V3 a -> m (V3 a) # | |
Storable a => Storable (V3 a) | |
Monoid a => Monoid (V3 a) | |
Semigroup a => Semigroup (V3 a) | |
Bounded a => Bounded (V3 a) | |
Floating a => Floating (V3 a) | |
Generic (V3 a) | |
Ix a => Ix (V3 a) | |
Num a => Num (V3 a) | |
Read a => Read (V3 a) | |
Fractional a => Fractional (V3 a) | |
Show a => Show (V3 a) | |
Binary a => Binary (V3 a) | |
Serial a => Serial (V3 a) | |
Serialize a => Serialize (V3 a) | |
NFData a => NFData (V3 a) | |
Eq a => Eq (V3 a) | |
Ord a => Ord (V3 a) | |
Hashable a => Hashable (V3 a) | |
Ixed (V3 a) | |
Epsilon a => Epsilon (V3 a) | |
Random a => Random (V3 a) | |
Unbox a => Unbox (V3 a) | |
Defined in Linear.V3 | |
Num a => Rotation (M33 a) a Source # | |
Defined in SpatialMathT compose :: Rot f1 f2 (M33 a) -> Rot f2 f3 (M33 a) -> Rot f1 f3 (M33 a) Source # rot :: Rot f1 f2 (M33 a) -> V3T f1 a -> V3T f2 a Source # rot' :: Rot f1 f2 (M33 a) -> V3T f2 a -> V3T f1 a Source # toDcm :: Rot f1 f2 (M33 a) -> Rot f1 f2 (M33 a) Source # transpose :: Rot f1 f2 (M33 a) -> Rot f2 f1 (M33 a) Source # | |
FoldableWithIndex (E V3) V3 | |
FunctorWithIndex (E V3) V3 | |
TraversableWithIndex (E V3) V3 | |
Lift a => Lift (V3 a :: Type) | |
Each (V3 a) (V3 b) a b | |
Field1 (V3 a) (V3 a) a a | |
Field2 (V3 a) (V3 a) a a | |
Field3 (V3 a) (V3 a) a a | |
type Rep V3 | |
type Size V3 | |
type Rep1 V3 | |
Defined in Linear.V3 type Rep1 V3 = D1 ('MetaData "V3" "Linear.V3" "linear-1.22-1g9bkrZLtgG1Kif13VBuPE" 'False) (C1 ('MetaCons "V3" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1 :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1))) | |
data MVector s (V3 a) | |
type Rep (V3 a) | |
Defined in Linear.V3 type Rep (V3 a) = D1 ('MetaData "V3" "Linear.V3" "linear-1.22-1g9bkrZLtgG1Kif13VBuPE" 'False) (C1 ('MetaCons "V3" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))) | |
type Index (V3 a) | |
type IxValue (V3 a) | |
data Vector (V3 a) | |
data Quaternion a #
Quaternions
Quaternion !a !(V3 a) |