3 import "JavaBuiltin" as Java
5 importJava "javax.vecmath.Vector3d" where
9 dot :: Vector3d -> Vector3d -> Double
12 vectorLength :: Vector3d -> Double
13 @JavaName lengthSquared
14 vectorLengthSquared :: Vector3d -> Double
16 angle :: Vector3d -> Vector3d -> Double
19 createVector3d :: Double -> Double -> Double -> Vector3d
21 copyVector3d' :: Tuple3d -> Vector3d
23 defaultVector3d :: Vector3d
29 crossM :: MVector3d -> Vector3d -> Vector3d -> <Proc> ()
32 normalizeM :: MVector3d -> <Proc> ()
35 normalizeM2 :: MVector3d -> Vector3d -> <Proc> ()
38 dotM :: MVector3d -> MVector3d -> <Proc> Double
41 lengthM :: MVector3d -> <Proc> Double
42 @JavaName lengthSquared
43 lengthSquaredM :: MVector3d -> <Proc> Double
46 angleM :: MVector3d -> MVector3d -> <Proc> Double
49 createMVector3d :: Double -> Double -> Double -> <Proc> MVector3d
51 copyMVector3d' :: Tuple3d -> <Proc> MVector3d
53 defaultMVector3d :: <Proc> MVector3d
56 applyMOp :: (MVector3d -> <Proc> ()) -> (<Proc> MVector3d) -> Vector3d
57 applyMOp op gen = runProc let
62 normalize :: Vector3d -> Vector3d
63 normalize v = applyMOp normalizeM (copyMVector3d (asTuple v))
65 cross :: Vector3d -> Vector3d -> Vector3d
66 cross x y = applyMOp (\z -> crossM z x y) defaultMVector3d
68 freeze :: MVector3d -> <Proc> Vector3d
69 freeze = Java.unsafeCoerce
71 instance Tuple3dClass Vector3d
72 instance MTuple3dClass MVector3d
74 copyVector3d :: Tuple3dClass a => a -> Vector3d
75 copyVector3d = copyVector3d' . asTuple
77 copyMVector3d :: Tuple3dClass a => a -> <Proc> MVector3d
78 copyMVector3d = copyMVector3d' . asTuple