0 | module Data.NumIdr.Transform.Isometry
 1 |
 2 | import Data.Vect
 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
10 | import Data.NumIdr.Transform.Orthonormal
11 |
12 | %default total
13 |
14 |
15 | ||| An isometry is an affine transformation that preserves distance between
16 | ||| points. It encompasses translations, rotations, and reflections.
17 | public export
18 | Isometry : Nat -> Type -> Type
19 | Isometry = Transform TIsometry
20 |
21 | ||| Determine if a matrix represents an isometry.
22 | export
23 | isIsometry : Eq a => Num a => HMatrix' n a -> Bool
24 | isIsometry mat = isHMatrix mat && isOrthonormal' (getMatrix mat)
25 |
26 | ||| Try to construct an isometry from a homogeneous matrix.
27 | export
28 | fromHMatrix : Eq a => Num a => HMatrix' n a -> Maybe (Isometry n a)
29 | fromHMatrix mat = if isIsometry mat then Just (unsafeMkTrans mat) else Nothing
30 |