Open creuzige opened 6 years ago
@cgohlke - any thoughts here? I haven't modified that part of the code from transformations.py
.
I started looking into the code to see if I could be any help. I noticed that in mat2euler the axes sequence specified does not seem to match up with the i,j, and k axes listed for all axes. I've assumed that axis 0 is x, then axis 1 is y, and axis 2 is z. If that doesn't hold, then my observations are probably irrelevant.
I modified the euler.py file to test all of the Euler axis combinations listed (attached as a .txt file) as a standalone program. The output is below.
python euler.py
Input Axes = sxyz
Output Axes: xyz
Axes match
Input Axes = sxyx
Output Axes: xyz
Axes do NOT match
Input Axes = sxzy
Output Axes: xzy
Axes match
Input Axes = sxzx
Output Axes: xzy
Axes do NOT match
Input Axes = syzx
Output Axes: yzx
Axes match
Input Axes = syzy
Output Axes: yzx
Axes do NOT match
Input Axes = syxz
Output Axes: yxz
Axes match
Input Axes = syxy
Output Axes: yxz
Axes do NOT match
Input Axes = szxy
Output Axes: zxy
Axes match
Input Axes = szxz
Output Axes: zxy
Axes do NOT match
Input Axes = szyx
Output Axes: zyx
Axes match
Input Axes = szyz
Output Axes: zyx
Axes do NOT match
Input Axes = rzyx
Output Axes: xyz
Axes do NOT match
Input Axes = rxyx
Output Axes: xyz
Axes do NOT match
Input Axes = ryzx
Output Axes: xzy
Axes do NOT match
Input Axes = rxzx
Output Axes: xzy
Axes do NOT match
Input Axes = rxzy
Output Axes: yzx
Axes do NOT match
Input Axes = ryzy
Output Axes: yzx
Axes do NOT match
Input Axes = rzxy
Output Axes: yxz
Axes do NOT match
Input Axes = ryxy
Output Axes: yxz
Axes do NOT match
Input Axes = ryxz
Output Axes: zxy
Axes do NOT match
Input Axes = rzxz
Output Axes: zxy
Axes do NOT match
Input Axes = rxyz
Output Axes: zyx
Axes do NOT match
Input Axes = rzyz
Output Axes: zyx
Axes do NOT match`
Hi - sorry for the flying feedback - but I'm sure you gathered that the angles are in the order specified by the axis labels, so if you have sxyz
then the order of the angles is indeed x, y, z, but if you have rzyz
then the order is z, y, z.
Yup, I agree that the angles are in the order given by the axis labels. I should have been more clear on my comment.
It looks like for many axis labels, the axis listed as the rotation axis does not match the order I expect. For example, if I state ‘rzyz’ for the axis labels, by my reading of the function eluer2mat in the Euler code, the rotation axes are set as i=2, j=1, and k=0; based upon the _NEXT_AXIS function. Assuming 2, 1, and 0 are Z, Y, X axes, this seems to imply that the rotation axes are ‘rzyx’, not ‘rzyz’.
However, I think I may have found a bug in euler2mat. The code I’ve used is attached below.
My impression is that the intrinsic and extrinsic rotation matrices are inverses of each other. And since they are orthogonal tensors, the inverse is equal to the transpose. However, when I invert the rotation matrix generated from 3 Euler angles using the rzxz convention, I do not get the same rotation matrix as if I perform the ‘szxz’ rotation. Nor does the transpose of the rzxz rotation match the szxz rotation. The values are correct, but the negative signs are in the wrong position. In addition, the axis/angle pair calculated from the szxz rotation has a different axis than the rzxz rotation.
Did I miss something, or are my observations correct?
Thanks!
Code example:
Output: