Do these inaccuracies other apply to the other transforms besides scale like shear, rotation and position?
Absolutely. It’s all stored in one matrix of 16 floats. All components of the transform are subject to floating-point imprecision. But you usually notice it first in the scale.
David
16 floats? Um, let’s see 3 for position, 3 for scale, 3 for shear, 4 for rotation; 3+3+3+4 = 13 floats. I seem to be missing 3 floats. What other transforms do they have?
It’s not like that. It’s a 4x4 transform matrix. There are sixteen floats arranged in a 4x4 grid, not a separate scale, rotate, shear, and translation.
There are more compact representations of a transform, but the 4x4 matrix is the most general and the most efficient for computing compositions of relative transforms.
Note that Panda’s scene graph stores the transform using a TransformState object, which actually stores either a 4x4 matrix or the individual scale, rotate, shear, and translation components, according to what was supplied by the user for any given node. However, computations involving compositions of multiple TransformStates will usually be elevated to the general 4x4 matrix representation, especially when a matrix inverse operation is required (as in when you perform a wrtReparentTo() operation). This is when the floating-point error referred to by the manual is most likely to be introduced.
David
Okay if myNodePath 's position and rotation are under player control slight inaccuracies are probably not important, but I want all other transforms to be invariant.
Then could I just correct the other transforms after each wrtReparentTo() ?
myNodePath.wrtReparentTo(myNewParent)
myNodePath.setScale(1,1,1)
myNodePath.setShear(0,0,0)
I have been known to write code that does exactly that.
David