Hello,

i'm trying to get the rotation angle of a Matrix3D to global x,y,z Axis.

This is my code :

public Vector3f getMyRotAngle()
    {
        Vector3f                vec     =   null;
        javax.vecmath.Quat4f    angle   =   new javax.vecmath.Quat4f();
        //float[]                     a       =   null;
        angle.set ( this.getDrehMatrix () );
        double xwinkel   =   Math.round ( Math.toDegrees( Math.asin(
angle.x ) * 2 ) );
        double ywinkel   =   Math.round ( Math.toDegrees( Math.asin(
angle.y ) * 2 ) );
        double zwinkel   =   Math.round ( Math.toDegrees( Math.asin(
angle.z ) * 2 ) );

        if ( xwinkel < 0 )
        {
            xwinkel += 360.0d;
        }

        if ( ywinkel < 0 )
        {
            ywinkel += 360.0d;
        }

        if ( zwinkel < 0 )
        {
            zwinkel += 360.0d;
        }

        return new Vector3f( (float) xwinkel, (float) ywinkel, (float)
zwinkel );
    }

Unfortounatly i'm getting wrong angle values when i'm leaving a plane.
For example :
I'm drawing a line in 3D, as long as i do only curves in one direction (
Hor or Ver ) erverything is fine. But if i mix HOR and VER curves i got
wrong values....
What 's wrong in my code ?

thx
tom

===========================================================================
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