Euler Rotation Order
Blitz3D Forums/Blitz3D Programming/Euler Rotation Order
| ||
Hello friends. I have a very hard question for you! Blitz, to rotate entites, uses the Euler order: YXZ So first rotates over Y, then X, then Z. Suppose i need to apply the same rotation to other system, that has the order: XYZ. How can i get the values of the rotation i need that makes both systems to have the same final rotation? For example: I rotate in bliz 45,45,0 What values should i need to pass to the second system so the object is rotated in the same way? rotate X?,Y?,Z? in function of 45,45,0 |
| ||
Does the other system have a command like Blitz3D's TurnEntity? If yes then the simplest solution is to have the other system do three turns in the proper order. You may also have to change the sign of some angles. The other system may make different assumptions about which turns are positive. |
| ||
Thanks Floyd, i guess that the other system had turnentity, but it doesn't. What i am trying is to create an EulerToMatrix functions that takes YXZ order, but i can't get it to work:void EulerToMatrizYXZ (float *R,float x, float y, float z) { float A,B,C,D,E,F; A = cos(x); B = sin(x); C = cos(y); D = sin(y); E = cos(z); F = sin(z); R[0] = C*E - F*B*D; R[1] = -F*C - E*B*D; R[2] = -A*D; R[3] = A*F; R[4] = A*E; R[5] = -B; R[6] = F*B*C+D*E; R[7] = -F*D+E*B*C; R[8] = A*C; } but doesn't work... |
| ||
Matty helped me with this in the slot wheels problem I had... I think there is something in the sticky post at the top of this forum from mark on the geometry... Sorry that is not more help. RZ |
| ||
Ok, i have found the way (doing old school matrix multiplications), here is the correct rotation matrix for YXZ Euler Rotation Order:void EulerToMatrixYXZ (floa R,float x, float y, float z) { floatl A,B,C,D,E,F; A = cos(x); B = sin(x); C = cos(y); D = sin(y); E = cos(z); F = sin(z); mat[0] = C*E - F*B*D; mat[1] = -F*C - E*B*D; mat[2] = -A*D; mat[4] = A*F; mat[5] = A*E; mat[6] = -B; mat[8] = F*B*C+D*E; mat[9] = -F*D+E*B*C; mat[10] = A*C; mat[3] = mat[7] = mat[11] = mat[12] = mat[13] = mat[14] = 0; mat[15] = 1; } |