#19 Bug in toEulerXYZ()

closed
nobody
None
5
2008-11-29
2008-11-28
Anonymous
No

Hi,

I think I found a bug in toEulerXYZ() different to the bug in the mailing list.

How to reproduce the bug:

from cgkit.cgtypes import mat3, mat4

# create a matrix with z-angle -72 degree
m3_72 = mat3.fromEulerXYZ(0,0,float(-72)/float(180)*math.pi)

#create a mtraix with z-angle +72 degree
m372 = mat3.fromEulerXYZ(0,0,float(72)/float(180)*math.pi)

#create a matrix with z-angle 288 degree
m3288 = mat3.fromEulerXYZ(0,0,float(288)/float(360)*2*math.pi)

when you compare m3_72 and m3288 it will return True (which is correct).

m3_72 and ,3288 is
(0.309017, 0.951057, 0)
(-0.951057, 0.309017, 0)
(0, 0, 1)

and

m372 is

(0.309017, -0.951057, 0)
(0.951057, 0.309017, 0)
(0, 0, 1)

This is both correct.

When you now convert all m3-matrizes back to EulerXYZ you get in all cases
(0.0, 0.0, 1.2566370614359175)

For m3_72 and m3288 correct would be
(0.0, 0.0, -1.2566370614359175)

Thanks

Andreas

PS: Unfortunalty I did not found the code for toEulerXYZ in the svn (where do I find _core?)

Discussion

  • Matthias Baas
    Matthias Baas
    2008-11-29

    Which version of cgkit were you using? When I try your example using the latest svn version, I do get -1.2566370614359175 for m3_72 and m3288. As you noticed yourself, there has been an issue with the euler angle methods in alpha8 which has been fixed. But the fix is not released yet, it's only in svn.
    I have closed the bug as it seems to be a duplicate. Feel free to reopen it if there is still an issue.

    By the way, the code is in the supportlib directory (supportlib/include/mat3.h).

    - Matthias -

     
  • Matthias Baas
    Matthias Baas
    2008-11-29

    • status: open --> closed
     
  • I used alpha 8.
    I did not recognize that the fix has not been released yet. Sorry for that.

    And thanks for pointing to the code.