LumaPictures/pymel

Multiplying a Point by a TransformationMatrix is subtly wrong

Opened this issue · 0 comments

Create a Point, attempt to transform the point with a TransformationMatrix. At first. it appears to work, but the 'w' component of the result is incorrectly set to 0. Pymel should either raise an exception when trying to do "Point * TransformationMatrix" (it isn't allowed in C++ or the OpenMaya Python API), or it should produce the correct answer.

Example:

import pymel.core as pm
p0 = pm.dt.Point()
print(p0.w)
1.0
m = pm.dt.TransformationMatrix()
m.setTranslation((42, 0, 0), "world")
print(m)
[[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [42.0, 0.0, 0.0, 1.0]]
p1 = p0 * m
print(p1)
[42.0, 0.0, 0.0, 0.0]
print(p0-p1)
[-inf, nan, nan]