Misc. changes
This commit is contained in:
parent
0a54f607b0
commit
524486bb58
5 changed files with 51 additions and 3 deletions
|
|
@ -25,6 +25,7 @@ isRotation' : FieldCmp a => Matrix' n a -> Bool
|
|||
isRotation' mat = isOrthonormal' mat && det mat == 1
|
||||
|
||||
||| Try to constuct a rotation from a matrix.
|
||||
export
|
||||
fromMatrix : FieldCmp a => Matrix' n a -> Maybe (Rotation n a)
|
||||
fromMatrix mat = if isRotation' mat then Just (unsafeMkTrans $ matrixToH mat)
|
||||
else Nothing
|
||||
|
|
@ -35,6 +36,11 @@ isRotation : FieldCmp a => HMatrix' n a -> Bool
|
|||
isRotation {n} mat with (viewShape mat)
|
||||
_ | Shape [S n, S n] = isHMatrix mat && all (==0) (mat !!.. [EndBound last, One last])
|
||||
|
||||
export
|
||||
fromHMatrix : FieldCmp a => HMatrix' n a -> Maybe (Rotation n a)
|
||||
fromHMatrix mat = if isRotation mat then Just (unsafeMkTrans mat)
|
||||
else Nothing
|
||||
|
||||
||| Construct a 2D rotation that rotates by the given angle (in radians).
|
||||
export
|
||||
rotate2D : Num a => Double -> Rotation 2 Double
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue