Hi Roland,

rotation around the axis of the coordinate system (not around the local CS of the 
object in question) can be done in the
following way. The object is at (0,0,0). If not, you first have to do some 
CS-transformations.
First cancel the current transform (currentT3D) by multiplying it with its inverse 
matrix. Next multiply the matrix
consisitng of the rotation around the axis in question (rot). Now transform it back 
into its old orientation:

currentT3D * (inverse of currentT3D) * rot * currentT3D =>
rot * currentT3D.

Just multiply the transform3d describing the rotation in question from left to the 
current transform. If you want apply all 3
rotations (rotx...rotz):
currentT3D.mul(rotx, currentT3D);
currentT3D.mul(roty, currentT3D);
currentT3D.mul(rotz, currentT3D);

that's all.

Gernot



On Tue, 2 May 2000 17:49:30 +0200, roland kofler wrote:

>I want to perform an combined rotation in a fixed coordination system.
>If you rotate an object around X using a transformation matrix, the object's
>coord-system also rotates. A second performed rotation around Y or Z will
>rotate around Y' or Z', the new axes. This is called nested rotation (e.g.
>flight simulators).
>
>To perform non-nested rotations, i.e. rotation in a fixed coordination
>system, you have to recalculate the old Z axis.
>i do it like this:
>
>*get the rotation matrix component of the X- rotation.
>*invert the matrix (a inverted matrix would do the same rotation in the
>  opposit direction)
>*get the Z-Column (this is the old Z-axis in terms of the new coordination
>   system)
>*rotate around Z-Column
>
>For the 2. rotation I use setRotation(AxisAngle4d). It works fine when I
>make rotations divisible through PI/2 (90�).
>Rotations like PI/4 don't behave like they should. This is the reason why I
>suspect that setRotation(AxisAngle4d) doesn't work well.
>
>can anyone help me please with this problem? Thank you.
>roland kofler
>
>related code fragment:
>
>rotationX.rotX(_rot.x);
>// rotate about X
>
>transrotation.mul(rotationX);
>
>// rotate about Y
>if (_rot.y != 0) {
>         rotationY = new Transform3D();
>         rotationX.get(e_);
>         e_.invert();
>         e_.normalize();
>         e_.getColumn(1,help);
>         System.out.println(" {e_ (.)(1)} :"+help.toString());
>         e_Achse = new AxisAngle4d(help, (1.0d)*_rot.y);
>         rotationY.setRotation(e_Achse);
>         transrotation.mul(rotationY);
>}
>
>
>// rotate about Z
>
>if (_rot.z != 0 ){
>         rotationZ = new Transform3D(transrotation);
>         rotationZ.get(e_);
>         e_.invert();
>         e_.getColumn(2,help);
>         System.out.println(" {e_ (.)(2)} :"+ help.toString());
>         e_Achse = new AxisAngle4d(help, (1.0d)*_rot.z);
>         rotationZ.setIdentity();
>         rotationZ.setRotation(e_Achse);
>         transrotation.mul(rotationZ);
>}
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JAVA3D-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".

[EMAIL PROTECTED]

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to