0 | module Data.NumIdr.Transform.Translation
3 | import Data.NumIdr.Interfaces
4 | import Data.NumIdr.Array
5 | import Data.NumIdr.Vector
6 | import Data.NumIdr.Matrix
7 | import Data.NumIdr.Homogeneous
8 | import Data.NumIdr.Transform.Point
9 | import Data.NumIdr.Transform.Transform
17 | Translation : Nat -> Type -> Type
18 | Translation = Transform TTranslation
23 | isTranslation : Eq a => Num a => HMatrix' n a -> Bool
24 | isTranslation {n} mat with (viewShape mat)
25 | _ | Shape [S n,S n] = isHMatrix mat && getMatrix mat == identity
29 | fromHMatrix : Eq a => Num a => HMatrix' n a -> Maybe (Translation n a)
30 | fromHMatrix mat = if isTranslation mat then Just (unsafeMkTrans mat) else Nothing
35 | translate : Num a => Vector n a -> Translation n a
36 | translate v = unsafeMkTrans (translationH v)