Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/alicevision/meshroom.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfabien servant <fabien.servant@technicolor.com>2022-10-26 11:08:07 +0300
committerFabien Castan <fabcastan@gmail.com>2022-11-03 03:01:30 +0300
commit5a05628a14d7ed34a18ce63570ee445d18e145fc (patch)
tree9cf31a0b38622fe977b7a81b5ed79b983a0f37c1
parent7593254ec096385e6f4132bce3cf834f0a59d523 (diff)
[mesh] update bounding box display to use the correct geometric frame
-rw-r--r--meshroom/ui/components/scene3D.py10
-rw-r--r--meshroom/ui/qml/Viewer3D/MeshingBoundingBox.qml50
2 files changed, 51 insertions, 9 deletions
diff --git a/meshroom/ui/components/scene3D.py b/meshroom/ui/components/scene3D.py
index b4569c19..aeea75dd 100644
--- a/meshroom/ui/components/scene3D.py
+++ b/meshroom/ui/components/scene3D.py
@@ -245,6 +245,16 @@ class Transformations3DHelper(QObject):
return modelMat
+ @Slot(QVector3D, result=QVector3D)
+ def transformRotationGL(self, rotation):
+ M = QQuaternion.fromAxisAndAngle(QVector3D(1, 0, 0), 180.0)
+
+ quaternion = QQuaternion.fromEulerAngles(rotation)
+
+ U = M * quaternion * M
+
+ return U.toEulerAngles()
+
@Slot(QVector3D, QMatrix4x4, Qt3DRender.QCamera, QSize, result=float)
def computeScaleUnitFromModelMatrix(self, axis, modelMat, camera, windowSize):
""" Compute the length of the screen projected vector axis unit transformed by the model matrix.
diff --git a/meshroom/ui/qml/Viewer3D/MeshingBoundingBox.qml b/meshroom/ui/qml/Viewer3D/MeshingBoundingBox.qml
index 4baf4121..cee83594 100644
--- a/meshroom/ui/qml/Viewer3D/MeshingBoundingBox.qml
+++ b/meshroom/ui/qml/Viewer3D/MeshingBoundingBox.qml
@@ -24,18 +24,22 @@ Entity {
// Update node meshing slider values when the gizmo has changed: translation, rotation, scale, type
transformGizmo.onGizmoChanged: {
+
+ var previous_euler = Qt.vector3d(rotation.x, rotation.y, rotation.z)
+ var updated_rotation = Transformations3DHelper.transformRotationGL(previous_euler)
+
switch(type) {
case TransformGizmo.Type.TRANSLATION: {
_reconstruction.setAttribute(
root.currentMeshingNode.attribute("boundingBox.bboxTranslation"),
- JSON.stringify([translation.x, translation.y, translation.z])
+ JSON.stringify([translation.x, -translation.y, -translation.z])
)
break
}
case TransformGizmo.Type.ROTATION: {
_reconstruction.setAttribute(
root.currentMeshingNode.attribute("boundingBox.bboxRotation"),
- JSON.stringify([rotation.x, rotation.y, rotation.z])
+ JSON.stringify([updated_rotation.x, updated_rotation.y, updated_rotation.z])
)
break
}
@@ -50,8 +54,8 @@ Entity {
_reconstruction.setAttribute(
root.currentMeshingNode.attribute("boundingBox"),
JSON.stringify([
- [translation.x, translation.y, translation.z],
- [rotation.x, rotation.y, rotation.z],
+ [translation.x, -translation.y, -translation.z],
+ [updated_rotation.x, updated_rotation.y, updated_rotation.z],
[scale.x, scale.y, scale.z]
])
)
@@ -63,13 +67,41 @@ Entity {
// Translation values from node (vector3d because this is the type of QTransform.translation)
property var nodeTranslation : Qt.vector3d(
root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxTranslation.x").value : 0,
- root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxTranslation.y").value : 0,
- root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxTranslation.z").value : 0
+ root.currentMeshingNode ? -root.currentMeshingNode.attribute("boundingBox.bboxTranslation.y").value : 0,
+ root.currentMeshingNode ? -root.currentMeshingNode.attribute("boundingBox.bboxTranslation.z").value : 0
)
+
// Rotation values from node (3 separated values because QTransform stores Euler angles like this)
- property var nodeRotationX: root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.x").value : 0
- property var nodeRotationY: root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.y").value : 0
- property var nodeRotationZ: root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.z").value : 0
+ property var nodeRotationX: {
+ var rx = root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.x").value : 0
+ var ry = root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.y").value : 0
+ var rz = root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.z").value : 0
+
+ var previous_euler = Qt.vector3d(rx, ry, rz)
+ var updated_rotation = Transformations3DHelper.transformRotationGL(previous_euler)
+ return updated_rotation.x
+ }
+
+ property var nodeRotationY: {
+ var rx = root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.x").value : 0
+ var ry = root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.y").value : 0
+ var rz = root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.z").value : 0
+
+ var previous_euler = Qt.vector3d(rx, ry, rz)
+ var updated_rotation = Transformations3DHelper.transformRotationGL(previous_euler)
+ return updated_rotation.y
+ }
+
+ property var nodeRotationZ: {
+ var rx = root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.x").value : 0
+ var ry = root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.y").value : 0
+ var rz = root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxRotation.z").value : 0
+
+ var previous_euler = Qt.vector3d(rx, ry, rz)
+ var updated_rotation = Transformations3DHelper.transformRotationGL(previous_euler)
+ return updated_rotation.z
+ }
+
// Scale values from node (vector3d because this is the type of QTransform.scale3D)
property var nodeScale: Qt.vector3d(
root.currentMeshingNode ? root.currentMeshingNode.attribute("boundingBox.bboxScale.x").value : 1,