3 import "JavaBuiltin" as Java
5 importJava "javax.vecmath.Vector3d" where
9 dot :: Vector3d -> Vector3d -> Double
11 length :: Vector3d -> Double
12 lengthSquared :: Vector3d -> Double
14 angle :: Vector3d -> Vector3d -> Double
17 createVector3d :: Double -> Double -> Double -> Vector3d
19 copyVector3d' :: Tuple3d -> Vector3d
21 defaultVector3d :: Vector3d
27 crossM :: MVector3d -> Vector3d -> Vector3d -> <Proc> ()
30 normalizeM :: MVector3d -> <Proc> ()
33 normalizeM2 :: MVector3d -> Vector3d -> <Proc> ()
36 dotM :: MVector3d -> MVector3d -> <Proc> Double
39 lengthM :: MVector3d -> <Proc> Double
40 @JavaName lengthSquared
41 lengthSquaredM :: MVector3d -> <Proc> Double
44 angleM :: MVector3d -> MVector3d -> <Proc> Double
47 createMVector3d :: Double -> Double -> Double -> <Proc> MVector3d
49 copyMVector3d' :: Tuple3d -> <Proc> MVector3d
51 defaultMVector3d :: <Proc> MVector3d
54 applyMOp :: (MVector3d -> <Proc> ()) -> (<Proc> MVector3d) -> Vector3d
55 applyMOp op gen = runProc let
60 normalize :: Vector3d -> Vector3d
61 normalize v = applyMOp normalizeM (copyMVector3d (asTuple v))
63 cross :: Vector3d -> Vector3d -> Vector3d
64 cross x y = applyMOp (\z -> crossM z x y) defaultMVector3d
66 freeze :: MVector3d -> <Proc> Vector3d
67 freeze = Java.unsafeCoerce
69 instance Tuple3dClass Vector3d
71 copyVector3d :: Tuple3dClass a => a -> Vector3d
72 copyVector3d = copyVector3d' . asTuple
74 copyMVector3d :: Tuple3dClass a => a -> <Proc> MVector3d
75 copyMVector3d = copyMVector3d' . asTuple