This commit is contained in:
2021-10-19 13:14:52 +01:00
parent d46de1ca80
commit 9e9d2b5def
15 changed files with 71 additions and 122 deletions
+13
View File
@@ -0,0 +1,13 @@
module Quaternion
where
import Geometry.Data
import Geometry.Vector3D
import qualified Linear.Quaternion as Q
-- apply a rotation as if the z axis moves to the new point.
rotateToZ :: Point3 -> Point3 -> Point3
rotateToZ z1
| cprod == V3 0 0 0 = id
| otherwise = Q.rotate $ Q.axisAngle cprod (angleVV3 z1 (V3 0 0 1))
where
cprod = crossProd z1 (V3 0 0 1)