--- /dev/null
+import "./Vector3d"
+
+import "JavaBuiltin" as Java
+
+importJava "javax.vecmath.AxisAngle4d" where
+ // Immutable mapping
+ data AxisAngle4d
+
+ @JavaName "<init>"
+ createAxisAngle4d :: Double -> Double -> Double -> Double -> AxisAngle4d
+ @JavaName "<init>"
+ createAxisAngle4d2 :: Vector3d -> Double -> AxisAngle4d
+ @JavaName "<init>"
+ defaultAxisAngle4d :: AxisAngle4d
+
+ getX :: AxisAngle4d -> Double
+ getY :: AxisAngle4d -> Double
+ getZ :: AxisAngle4d -> Double
+ getAngle :: AxisAngle4d -> Double
+
+ // Mutable mapping
+ data MAxisAngle4d
+
+ @JavaName "<init>"
+ createMAxisAngle4d :: Double -> Double -> Double -> Double -> <Proc> MAxisAngle4d
+ @JavaName "<init>"
+ createMAxisAngle4d2 :: Vector3d -> Double -> <Proc> MAxisAngle4d
+ @JavaName "<init>"
+ defaultMAxisAngle4d :: <Proc> MAxisAngle4d
+ @JavaName "<init>"
+ copyMAxisAngle4d :: AxisAngle4d -> <Proc> MAxisAngle4d
+
+ @JavaName getX
+ getXM :: MAxisAngle4d -> <Proc> Double
+ @JavaName getY
+ getYM :: MAxisAngle4d -> <Proc> Double
+ @JavaName getZ
+ getZM :: MAxisAngle4d -> <Proc> Double
+ @JavaName getAngle
+ getAngleM :: MAxisAngle4d -> <Proc> Double
+
+ setX :: MAxisAngle4d -> Double -> <Proc> ()
+ setY :: MAxisAngle4d -> Double -> <Proc> ()
+ setZ :: MAxisAngle4d -> Double -> <Proc> ()
+ setAngle :: MAxisAngle4d -> Double -> <Proc> ()
+
+freeze :: MAxisAngle4d -> <Proc> AxisAngle4d
+freeze = Java.unsafeCoerce
@JavaName equals
equalsd :: Double -> Double -> Boolean
+
@JavaName equals
equalst :: T3.Tuple3d -> T3.Tuple3d -> Boolean
distance :: T3.Tuple3d -> T3.Tuple3d -> Double
distanceSquared :: T3.Tuple3d -> T3.Tuple3d -> Double
- isValid :: T3.Tuple3d -> Boolean
\ No newline at end of file
+ isValid :: T3.Tuple3d -> Boolean
import "./Tuple3d"
+import "JavaBuiltin" as Java
+
importJava "javax.vecmath.Point3d" where
data Point3d
@JavaName "<init>"
createPoint3d :: Double -> Double -> Double -> Point3d
@JavaName "<init>"
- copyPoint3d :: Tuple3d -> Point3d
+ copyPoint3d' :: Tuple3d -> Point3d
@JavaName "<init>"
- defaultPoint3d :: Point3d
\ No newline at end of file
+ defaultPoint3d :: Point3d
+
+instance Tuple3dClass Point3d
+
+copyPoint3d :: Tuple3dClass a => a -> Point3d
+copyPoint3d = copyPoint3d' . asTuple
--- /dev/null
+import "JavaBuiltin" as Java
+
+importJava "javax.vecmath.Quat4d" where
+ // Immutable binding
+ data Quat4d
+
+ @JavaName "<init>"
+ createQuat4d :: Double -> Double -> Double -> Double -> Quat4d
+ @JavaName "<init>"
+ copyQuat4d :: Quat4d -> Quat4d
+ @JavaName "<init>"
+ defaultQuat4d :: Quat4d
+
+ getX :: Quat4d -> Double
+ getY :: Quat4d -> Double
+ getZ :: Quat4d -> Double
+ getW :: Quat4d -> Double
+
+ // Mutable binding
+ data MQuat4d
+
+ @JavaName "<init>"
+ createMQuat4d :: Double -> Double -> Double -> Double -> <Proc> MQuat4d
+ @JavaName "<init>"
+ copyMQuat4d :: Quat4d -> <Proc> MQuat4d
+ @JavaName "<init>"
+ defaultMQuat4d :: <Proc> MQuat4d
+
+ @JavaName getX
+ getXM :: MQuat4d -> <Proc> Double
+ @JavaName getY
+ getYM :: MQuat4d -> <Proc> Double
+ @JavaName getZ
+ getZM :: MQuat4d -> <Proc> Double
+ @JavaName getW
+ getWM:: MQuat4d -> <Proc> Double
+ setX :: MQuat4d -> Double -> <Proc> ()
+ setY :: MQuat4d -> Double -> <Proc> ()
+ setZ :: MQuat4d -> Double -> <Proc> ()
+ setW :: MQuat4d -> Double -> <Proc> ()
+
+ @JavaName mul
+ mulM :: MQuat4d -> Quat4d -> <Proc> ()
+ @JavaName mul
+ mulM2 :: MQuat4d -> Quat4d -> Quat4d -> <Proc> ()
+
+ @JavaName mulInverse
+ mulInverseM :: MQuat4d -> Quat4d -> <Proc> ()
+ @JavaName mulInverse
+ mulInverseM2 :: MQuat4d -> Quat4d -> Quat4d -> <Proc> ()
+
+ @JavaName inverse
+ inverseM :: MQuat4d -> <Proc> ()
+ @JavaName inverse
+ inverseM2 :: MQuat4d -> Quat4d -> <Proc> ()
+
+ @JavaName normalize
+ normalizeM :: MQuat4d -> <Proc> ()
+ @JavaName normalize
+ normalizeM2 :: MQuat4d -> Quat4d -> <Proc> ()
+
+freeze :: MQuat4d -> <Proc> Quat4d
+freeze = Java.unsafeCoerce
+
+// Mapping of mutable operations to immutable ones
+
+@private
+applyMOp :: (MQuat4d -> <Proc> ()) -> Quat4d -> Quat4d
+applyMOp op x = runProc let
+ z = copyMQuat4d x
+ op z
+ in freeze z
+
+mul :: Quat4d -> Quat4d -> Quat4d
+mul x y = applyMOp (flip mulM y) x
+
+mulInverse :: Quat4d -> Quat4d -> Quat4d
+mulInverse x y = applyMOp (flip mulInverseM y) x
+
+inverse :: Quat4d -> Quat4d
+inverse = applyMOp inverseM
+
+normalize :: Quat4d -> Quat4d
+normalize = applyMOp normalizeM
--- /dev/null
+import "JavaBuiltin" as Java
+
+importJava "javax.vecmath.Tuple3d" where
+ // Immutable mapping
+ data Tuple3d
+
+ @private
+ @JavaName getX
+ getX' :: Tuple3d -> Double
+ @private
+ @JavaName getY
+ getY' :: Tuple3d -> Double
+ @private
+ @JavaName getZ
+ getZ' :: Tuple3d -> Double
+
+ // Mutable mapping
+ data MTuple3d
+
+ @JavaName getX
+ getXM :: MTuple3d -> <Proc> Double
+ @JavaName getY
+ getYM :: MTuple3d -> <Proc> Double
+ @JavaName getZ
+ getZM :: MTuple3d -> <Proc> Double
+
+ setX :: MTuple3d -> Double -> <Proc> ()
+ setY :: MTuple3d -> Double -> <Proc> ()
+ setZ :: MTuple3d -> Double -> <Proc> ()
+
+ @JavaName add
+ addM :: MTuple3d -> Tuple3d -> <Proc> ()
+ @JavaName add
+ addM2 :: MTuple3d -> Tuple3d -> Tuple3d -> <Proc> ()
+
+ @JavaName sub
+ subM :: MTuple3d -> Tuple3d -> <Proc> ()
+ @JavaName sub
+ subM2 :: MTuple3d -> Tuple3d -> Tuple3d -> <Proc> ()
+
+ @JavaName negate
+ negateM :: MTuple3d -> <Proc> ()
+ @JavaName negate
+ negateM2 :: MTuple3d -> Tuple3d -> <Proc> ()
+
+ @JavaName scale
+ scaleM :: MTuple3d -> Double -> <Proc> ()
+ @JavaName scale
+ scaleM2 :: MTuple3d -> Double -> Tuple3d -> <Proc> ()
+
+ @private
+ clone :: Tuple3d -> <Proc> a
+
+copyMTuple3d :: Tuple3d -> <Proc> MTuple3d
+copyMTuple3d = Java.unsafeCoerce . clone
+
+@private
+applyMOp :: (MTuple3d -> <Proc> ()) -> Tuple3d -> Tuple3d
+applyMOp f x = runProc let
+ z = copyMTuple3d x
+ f z
+ in freeze z
+
+freeze :: MTuple3d -> <Proc> Tuple3d
+freeze = Java.unsafeCoerce
+
+addTuple x y = applyMOp (flip addM y) x
+subTuple x y = applyMOp (flip subM y) x
+negateTuple = applyMOp negateM
+scaleTuple x s = applyMOp (flip scaleM s) x
+
+class Tuple3dClass a where
+ asTuple :: a -> Tuple3d
+ asTuple = Java.unsafeCoerce
+
+ asMTuple :: a -> <Proc> MTuple3d
+ asMTuple x = copyMTuple3d (asTuple x)
+
+ getX :: a -> Double
+ getX = getX' . asTuple
+
+ getY :: a -> Double
+ getY = getY' . asTuple
+
+ getZ :: a -> Double
+ getZ = getZ' . asTuple
+
+ add :: a -> a -> a
+ add x y = Java.unsafeCoerce $ addTuple (asTuple x) (asTuple y)
+
+ sub :: a -> a -> a
+ sub x y = Java.unsafeCoerce $ subTuple (asTuple x) (asTuple y)
+
+ negate :: a -> a
+ negate x = Java.unsafeCoerce $ negateTuple (asTuple x)
+
+ scale :: a -> Double -> a
+ scale x s = Java.unsafeCoerce $ scaleTuple (asTuple x) s
+
+instance Tuple3dClass Tuple3d where
+ asTuple = id
+ getX = getX'
+ getY = getY'
+ getZ = getZ'
+ add = addTuple
+ sub = subTuple
+ negate = negateTuple
+ scale = scaleTuple
--- /dev/null
+import "./Tuple3d"
+
+import "JavaBuiltin" as Java
+
+importJava "javax.vecmath.Vector3d" where
+ // Immutable mapping
+ data Vector3d
+
+ dot :: Vector3d -> Vector3d -> Double
+
+ length :: Vector3d -> Double
+ lengthSquared :: Vector3d -> Double
+
+ angle :: Vector3d -> Vector3d -> Double
+
+ @JavaName "<init>"
+ createVector3d :: Double -> Double -> Double -> Vector3d
+ @JavaName "<init>"
+ copyVector3d' :: Tuple3d -> Vector3d
+ @JavaName "<init>"
+ defaultVector3d :: Vector3d
+
+ // Mutable mapping
+ data MVector3d
+
+ @JavaName cross
+ crossM :: MVector3d -> Vector3d -> Vector3d -> <Proc> ()
+
+ @JavaName normalize
+ normalizeM :: MVector3d -> <Proc> ()
+
+ @JavaName normalize
+ normalizeM2 :: MVector3d -> Vector3d -> <Proc> ()
+
+ @JavaName dot
+ dotM :: MVector3d -> MVector3d -> <Proc> Double
+
+ @JavaName length
+ lengthM :: MVector3d -> <Proc> Double
+ @JavaName lengthSquared
+ lengthSquaredM :: MVector3d -> <Proc> Double
+
+ @JavaName angle
+ angleM :: MVector3d -> MVector3d -> <Proc> Double
+
+ @JavaName "<init>"
+ createMVector3d :: Double -> Double -> Double -> <Proc> MVector3d
+ @JavaName "<init>"
+ copyMVector3d' :: Tuple3d -> <Proc> MVector3d
+ @JavaName "<init>"
+ defaultMVector3d :: <Proc> MVector3d
+
+@private
+applyMOp :: (MVector3d -> <Proc> ()) -> (<Proc> MVector3d) -> Vector3d
+applyMOp op gen = runProc let
+ z = gen
+ op z
+ in freeze z
+
+normalize :: Vector3d -> Vector3d
+normalize v = applyMOp normalizeM (copyMVector3d (asTuple v))
+
+cross :: Vector3d -> Vector3d -> Vector3d
+cross x y = applyMOp (\z -> crossM z x y) defaultMVector3d
+
+freeze :: MVector3d -> <Proc> Vector3d
+freeze = Java.unsafeCoerce
+
+instance Tuple3dClass Vector3d
+
+copyVector3d :: Tuple3dClass a => a -> Vector3d
+copyVector3d = copyVector3d' . asTuple
+
+copyMVector3d :: Tuple3dClass a => a -> <Proc> MVector3d
+copyMVector3d = copyMVector3d' . asTuple
-import "g3d/math/Vector3d"
-import "g3d/math/Quat4d"
+import "G3D/Math/Vector3d"
+import "G3D/Math/Quat4d"
importJava "org.simantics.g3d.scenegraph.G3DNode" where
data G3DNode
-import "g3d/math/Vector3d"
-import "g3d/math/Quat4d"
+import "G3D/Math/Vector3d"
+import "G3D/Math/Quat4d"
importJava "org.simantics.g3d.scenegraph.G3DparentNode" where
data G3DParentNode
+++ /dev/null
-import "./Tuple3d"
-
-importJava "javax.vecmath.AxisAngle4d" where
- data AxisAngle4d
-
- @JavaName "<init>"
- createAxisAngle4d -> Double -> Double -> Double -> Double -> AxisAngle4d
- @JavaName "<init>"
- createAxisAngle4d2 -> Tuple3d -> Double -> AxisAngle4d
- @JavaName "<init>"
- defaultAxisAngle4d -> AxisAngle4d
-
- getX :: AxisAngle4d -> Double
- getY :: AxisAngle4d -> Double
- getZ :: AxisAngle4d -> Double
- getAngle :: AxisAngle4d -> Double
- setX :: AxisAngle4d -> Double -> ()
- setY :: AxisAngle4d -> Double -> ()
- setZ :: AxisAngle4d -> Double -> ()
- setAngle :: AxisAngle4d -> Double -> ()
\ No newline at end of file
+++ /dev/null
-
-importJava "javax.vecmath.Quat4d" where
- data Quat4d
-
- @JavaName "<init>"
- createQuat4d :: Double -> Double -> Double -> Double -> Quat4d
- @JavaName "<init>"
- copyQuat4d :: Quat4d -> Quat4d
- @JavaName "<init>"
- defaultQuat4d :: Quat4d
-
- getX :: Quat4d -> Double
- getY :: Quat4d -> Double
- getZ :: Quat4d -> Double
- getW:: Quat4d -> Double
- setX :: Quat4d -> Double -> ()
- setY :: Quat4d -> Double -> ()
- setZ :: Quat4d -> Double -> ()
- setW :: Quat4d -> Double -> ()
-
- mul :: Quat4d -> Quat4d -> ()
- @JavaName mul
- mul2 :: Quat4d -> Quat4d -> Quat4d ->()
-
- mulInverse :: Quat4d -> Quat4d -> ()
- @JavaName mulInverse
- mulInverse2 :: Quat4d -> Quat4d -> Quat4d ->()
-
- inverse :: Quat4d -> ()
- @JavaName inverse
- inverse2 :: Quat4d -> Quat4d ->()
-
- normalize :: Quat4d -> ()
- @JavaName normalize
- normalize2 :: Quat4d -> Quat4d ->()
-
\ No newline at end of file
+++ /dev/null
-importJava "javax.vecmath.Tuple3d" where
- data Tuple3d
-
- getX :: Tuple3d -> Double
- getY :: Tuple3d -> Double
- getZ :: Tuple3d -> Double
- setX :: Tuple3d -> Double -> ()
- setY :: Tuple3d -> Double -> ()
- setZ :: Tuple3d -> Double -> ()
-
- add :: Tuple3d -> Tuple3d -> ()
- @JavaName add
- add2 :: Tuple3d -> Tuple3d -> Tuple3d -> ()
-
- sub :: Tuple3d -> Tuple3d -> ()
- @JavaName sub
- sub2 :: Tuple3d -> Tuple3d -> Tuple3d -> ()
-
- negate :: Tuple3d -> ()
- @JavaName negate
- negate2 :: Tuple3d -> Tuple3d -> ()
-
- scale :: Tuple3d -> Double -> ()
- @JavaName scale
- scale2 :: Tuple3d -> Double -> Tuple3d -> ()
\ No newline at end of file
+++ /dev/null
-import "./Tuple3d"
-
-importJava "javax.vecmath.Vector3d" where
- data Vector3d
-
- cross :: Vector3d -> Vector3d -> Vector3d -> ()
-
- normalize :: Vector3d -> ()
- @JavaName normalize
- normalize_2 :: Vector3d -> Vector3d -> ()
-
- dot :: Vector3d -> Vector3d -> Double
-
- length :: Vector3d -> Double
- lengthSquared :: Vector3d -> Double
-
- angle :: Vector3d -> Vector3d -> Double
-
- @JavaName "<init>"
- createVector3d :: Double -> Double -> Double -> Vector3d
- @JavaName "<init>"
- copyVector3d :: Tuple3d -> Vector3d
- @JavaName "<init>"
- defaultVector3d :: Vector3d
\ No newline at end of file
-import "g3d/math/Vector3d"
-import "g3d/math/Quat4d"
+import "G3D/Math/Vector3d"
+import "G3D/Math/Quat4d"
importJava "org.simantics.plant3d.scenegraph.P3DNode" where
data P3DNode
-import "g3d/math/Vector3d"
-import "g3d/math/Quat4d"
+import "G3D/Math/Vector3d"
+import "G3D/Math/Quat4d"
importJava "org.simantics.plant3d.scenegraph.P3DParentNode" where
data P3DParentNode
-import "g3d/math/Vector3d"
-import "g3d/math/Quat4d"
-import "g3d/scenegraph/Node"
+import "G3D/Math/Vector3d"
+import "G3D/Math/Quat4d"
+import "G3D/Scenegraph/Node"
importJava "org.simantics.plant3d.scenegraph.P3DRootNode" where
data P3DRootNode
-import "g3d/math/Tuple3d"
-import "g3d/math/Quat4d"
-import "g3d/math/Vector3d"
+import "G3D/Math/Tuple3d"
+import "G3D/Math/Quat4d"
+import "G3D/Math/Vector3d"
importJava "org.simantics.plant3d.scenegraph.PipelineComponent" where
data PipelineComponent
import "./PipelineComponent"
-import "g3d/math/Vector3d"
+import "G3D/Math/Vector3d"
importJava "org.simantics.plant3d.scenegraph.TurnComponent" where
data TurnComponent
import "Simantics/DB"
-import "plant3d/scenegraph/P3DRootNode"
+import "Plant3d/Scenegraph/P3DRootNode"
import "./P3DScriptNodeMap"
importJava "org.simantics.plant3d.scl.SCLUtil" where