Message 1 of 1
Bug Report: MEulerRotation::decompose returns wrong value with scaled matrices
Not applicable
11-17-2020
06:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi! I have noticed the following behaviour in Maya 2016... Also confirmed that the same result happens in Maya 2020:
import maya.api.OpenMaya as om
m = om.MMatrix([0.7701511, -0.4794255, 0.4207355, 0, 0.5204336, 0.8536655, 0.0200993, 0, -0.3688035, 0.2034854, 0.9069607, 0, 0, 0, 0, 1])
# Get standard rotation from matrix.
standardRotation = om.MEulerRotation.decompose(m, om.MEulerRotation.kXZY)
tm = om.MTransformationMatrix(m)
tm.scaleBy([2, 1.1, 1.2], om.MSpace.kTransform)
# Get scaled decomposed rotation from matrix
scaledDecomposeRot = om.MEulerRotation.decompose(tm.asMatrix(), om.MEulerRotation.kXZY)
# Get the rotation from transformation matrix
transformScaledRot = tm.rotation()
transformScaledRot.reorderIt(om.MEulerRotation.kXZY)
print "Standard decompose: %s" % standardRotation
print "Scaled decompose: %s" % scaledDecomposeRot
print "Transformation rotation: %s" % transformScaledRot
assert(standardRotation == scaledDecomposeRot)
assert(scaledDecomposeRot == transformScaledRot)
Which gives the unexpected output:
Standard decompose: (-0.234, -0.5, -0.5, kXZY)
Scaled decompose: (-0.254402, -0.5, -0.5, kXZY)
Transformation rotation: (-0.234, -0.5, -0.5, kXZY)
Traceback (most recent call last):
File "/usr/home/dlalancette/testMaya.py", line 20, in <module>
assert(standardRotation == scaledDecomposeRot)
AssertionError
The MEulerRotation::decompose documentation does not state that the function only works with plain rotation matrix, so I would expect it to return value values as well!
Cheers,
David