mesh.transform(T) misleading, doesn't actually use a transformation matrix #6129
evatt-harvey-salinger
started this conversation in
General
Replies: 1 comment
-
Changed discussion from Q&A to General. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
This is my first time I've left a comment on a Github, so hopefully I've done it correctly.
I've been working with transformation matrices and was excited to find that open3d support passing a transformation matrix to rotate and translate an object. However, after running some tests and following this tutorial...
http://www.open3d.org/docs/release/tutorial/geometry/transformation.html
...I'm fairly confident that the "transformation matrix" is not being used in the standard mathematical sense.
Based on my testing, my suspicion is that the transformation matrix T is being decomposed into a rotation matrix R = T[:3, :3] and a translation vector t = T[:3, 3], and the mesh is moved using mesh.rotate(R).translate(t), where t is the translation vector in world coordinates.
However, if a transformation matrix contains both a rotation and translation, T[:3, 3] is not the translation vector in world coordinates, but it is the translation vector in the rotated coordinate system. A transformation matrix allows for rotation and translation to be applied to a vector v in a single step. Instead of applying a rotation and translation successively...
... you can matmult the rotation and translation transformation together to get T...
... and simply do T.dot(v)
Importantly, when you do the dot product to combine the rotation and translation, the translation values get rotated into the new rotated coordinate system. So the translation are no longer wrt the world (tw) but the rotated coordinate system (tr). So T is actually...
Therefore, simply translating the mesh by T[:3, 3] in the world coordinate system is incorrect. To get t wrt to the world, you must do...
...before translating with mesh.translate(tw).
At minimum, it should be made clear in the documentation the transformation matrix accepted by mesh.translate(T) can ONLY do one at a time, rotation or translation. It can't do both in the current set up. It is not actually using T as a homogenous transformation matrix, it's just cherry picking information from it (incorrectly).
Beta Was this translation helpful? Give feedback.
All reactions