From: H. H. <hen...@gm...> - 2008-08-30 02:57:43
|
v71: I copied your code into our code base and ran the tests for it but it seems that there is something wrong with your calculations. It does not provide correct kind of results. At the moment, there is not a concensus on what kind of matrix should the glmMatRotateYPR functions actually generate; a Z*X*Y or Y*X*Z rotation? My idea is that it should generate Z*X*Y rotation because OpenGL treats vertices as vertical row vectors. OpenGL therefore transforms vertices as Mv, where M is the current modelview matrix and v is the vertex. Z*X*Y*v therefore generates in my opinion a rotation (in this order) around the Y-axis, followed a rotation around the X-axis, and followed by a rotation followed by the Z, which is the correct yaw-pitch-roll rotation. Y*X*Z*v rotation would be in the reverse order. This is at least my idea, correct me if I am wrong. I tested the code that you posted to me with both Y*X*Z and Z*X*Y models. In both cases your code resulted into a matrix which was different what would a serie of glRotatef calls result. The reference data which I use in my test cases to check the correctness of the glmMatRotateYPR results has been generated by the following OpenGL calls: // for the Z*X*Y model glLoadIdentity (); glRotatef (30.0f, 0.0f, 0.0f, 1.0f); glRotatef (30.0f, 1.0f, 0.0f, 0.0f); glRotatef (30.0f, 0.0f, 1.0f, 0.0f); // for the Y*X*Z model glLoadIdentity (); glRotatef (30.0f, 0.0f, 1.0f, 0.0f); glRotatef (30.0f, 1.0f, 0.0f, 0.0f); glRotatef (30.0f, 0.0f, 0.0f, 1.0f); In any case, your code is still in our code base but commented out. If you or somebody else would like to take a look at this, you may find it in the file src/glm/mat4f.c (lines 402-458) and the test case in tests/glm/mat4f.c (lines 286-298) in revision 58. The issue is still open. -- Henri 'henux' Häkkinen |