HPB rotation to rotation around axis

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/11/2003 at 15:51, xxxxxxxx wrote:
Hi,
how can I convert rotation of object (obtained using GetRot(), i.e. HPB vector) to rotations around x,y,z axis? I've been trying to do it this way:
Matrix mrz = Matrix::rotateZ(rz);
Matrix mry = Matrix::rotateY(ry);
Matrix mrx = Matrix::rotateX(rx);
return mrz * mry * mrx;where the matrices are 4x4 OpenGL matrices and rotate{X,Y,Z} are rotations around axis X, Y and Z respectively and the argument is in radians. It's same as this sequence of OpenGL calls:
glRotatef(rad2deg(rz),0,0,1);
glRotatef(rad2deg(ry),0,1,0);
glRotatef(rad2deg(rx),1,0,0);Is this correct or does Cinema4D use different semantics? I can't make it work...
Thanks!

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/11/2003 at 07:47, xxxxxxxx wrote:
Why use XYZ rotations? GL directly allows to set a Matrix. (If you still need the rotation thingy, take a look at GraphicsGems 4, they have source code for calculating rotations from a matrix).
Matrix mg=op>GetMg();
Real c[16];
c[0] = mg.v1.x;
c[1] = mg.v1.y;
c[2] = mg.v1.z;
c[3] = 0;
c[4] = mg.v2.x;
c[5] = mg.v2.y;
c[6] = mg.v2.z;
c[7] = 0;
c[8] = mg.v3.x;
c[9] = mg.v3.y;
c[10] = mg.v3.z;
c[11] = 0;
c[12] = mg.off.x;
c[13] = mg.off.y;
c[14] = mg.off.z;
c[15] = 1;
glLoadMatrixf(c);

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/11/2003 at 04:35, xxxxxxxx wrote:
Quote: _Why use XYZ rotations? GL directly allows to set a Matrix.
>
> * * *
_
Why, because I need them, I didn't say I'm using OpenGL. Besides, the matrix would still not be usable in OpenGL because c4d uses lefthanded coordinate system and OpenGL uses right handedone.
I figured it out in the meantime, so in case anybody ever needs something similar, it's like this:
C4d uses lefthanded system. HPB rotation translates to rotation about axes in this way: H is rotation around (0,1,0) axis (yaxis, the angle is negated), P around (1,0,0) and B around (0,01). Accounting for OpenGL's righthanded system, the rotations will become
rx = p
ry = h
rz = b
When applying the rotation, the order is rotY(ry)*rotX(rx)*rotZ(rz)