From 8d7eb2c1a914c5abbf2c92de214be732cb1f1e85 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 17 Aug 2019 16:59:57 +0300 Subject: [PATCH] Full BM@N geometry --- .../hep/dataforge/vis/spatial/gdml/visualGDML.kt | 1 + .../dataforge/vis/spatial/gdml/demo/GDMLDemoApp.kt | 6 +++++- .../kotlin/hep/dataforge/vis/spatial/Tube.kt | 2 +- .../hep/dataforge/vis/spatial/VisualObject3D.kt | 4 ++-- .../hep/dataforge/vis/spatial/three/ThreeFactory.kt | 11 +++++------ .../hep/dataforge/vis/spatial/three/ThreeOutput.kt | 4 ++-- .../hep/dataforge/vis/spatial/demo/ThreeDemoApp.kt | 12 ++++++++---- 7 files changed, 24 insertions(+), 16 deletions(-) diff --git a/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/visualGDML.kt b/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/visualGDML.kt index 70bd2276..db513ba7 100644 --- a/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/visualGDML.kt +++ b/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/visualGDML.kt @@ -24,6 +24,7 @@ private fun VisualObject3D.withPosition( this@withPosition.rotationX = rotation.x() this@withPosition.rotationY = rotation.y() this@withPosition.rotationZ = rotation.z() + this@withPosition.rotationOrder=RotationOrder.ZXY } scale?.let { this@withPosition.scaleX = scale.x.toFloat() diff --git a/dataforge-vis-spatial-gdml/src/jsMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/GDMLDemoApp.kt b/dataforge-vis-spatial-gdml/src/jsMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/GDMLDemoApp.kt index b6205062..7de8ea84 100644 --- a/dataforge-vis-spatial-gdml/src/jsMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/GDMLDemoApp.kt +++ b/dataforge-vis-spatial-gdml/src/jsMain/kotlin/hep/dataforge/vis/spatial/gdml/demo/GDMLDemoApp.kt @@ -102,7 +102,11 @@ private class GDMLDemoApp : ApplicationBase() { } launch { message("Rendering") } - val output = three.output(canvas) + val output = three.output(canvas){ + "axis" to { + "size" to 100 + } + } output.render(visual) launch { message(null) diff --git a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Tube.kt b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Tube.kt index d9c96864..6b869d7f 100644 --- a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Tube.kt +++ b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Tube.kt @@ -33,7 +33,7 @@ class Tube( require(radius > 0) require(height > 0) require(innerRadius >= 0) - require(startAngle >= 0) + //require(startAngle >= 0) require(angle in (0f..(PI2))) } diff --git a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualObject3D.kt b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualObject3D.kt index fae9605c..0a51c6cb 100644 --- a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualObject3D.kt +++ b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/VisualObject3D.kt @@ -121,7 +121,7 @@ enum class RotationOrder { */ var VisualObject3D.rotationOrder: RotationOrder get() = getProperty(VisualObject3D.rotationOrder).enum() ?: RotationOrder.XYZ - set(value) = setProperty(VisualObject3D.rotationOrder, value) + set(value) = setProperty(VisualObject3D.rotationOrder, value.name) /** @@ -191,7 +191,7 @@ var VisualObject3D.rotationY: Number get() = rotation?.y ?: 0f set(value) { rotation().y = value.toDouble() - propertyChanged(VisualObject3D.xRotation) + propertyChanged(VisualObject3D.yRotation) } var VisualObject3D.rotationZ: Number diff --git a/dataforge-vis-spatial/src/jsMain/kotlin/hep/dataforge/vis/spatial/three/ThreeFactory.kt b/dataforge-vis-spatial/src/jsMain/kotlin/hep/dataforge/vis/spatial/three/ThreeFactory.kt index ce3dec9d..c50f5139 100644 --- a/dataforge-vis-spatial/src/jsMain/kotlin/hep/dataforge/vis/spatial/three/ThreeFactory.kt +++ b/dataforge-vis-spatial/src/jsMain/kotlin/hep/dataforge/vis/spatial/three/ThreeFactory.kt @@ -37,13 +37,12 @@ interface ThreeFactory { */ internal fun Object3D.updatePosition(obj: VisualObject3D) { visible = obj.visible ?: true -// Matrix4().apply { -// makeRotationFromEuler(obj.euler) -// applyMatrix(this) -// makeTranslation(obj.x.toDouble(), obj.y.toDouble(), obj.z.toDouble()) -// applyMatrix(this) -// } position.set(obj.x, obj.y, obj.z) +// obj.rotation?.let{ +// rotateZ(it.z) +// rotateX(it.x) +// rotateY(it.y) +// } setRotationFromEuler(obj.euler) scale.set(obj.scaleX, obj.scaleY, obj.scaleZ) updateMatrix() diff --git a/dataforge-vis-spatial/src/jsMain/kotlin/hep/dataforge/vis/spatial/three/ThreeOutput.kt b/dataforge-vis-spatial/src/jsMain/kotlin/hep/dataforge/vis/spatial/three/ThreeOutput.kt index c77deea1..81de1a89 100644 --- a/dataforge-vis-spatial/src/jsMain/kotlin/hep/dataforge/vis/spatial/three/ThreeOutput.kt +++ b/dataforge-vis-spatial/src/jsMain/kotlin/hep/dataforge/vis/spatial/three/ThreeOutput.kt @@ -21,8 +21,8 @@ class ThreeOutput(val three: ThreePlugin, val meta: Meta = EmptyMeta) : Output