That was the naieve answer!!!
Thinking about it more:

For an arbitrary vector [i,j,k], the rotation about the z axis:

Vector2f v1 = new Vector2f(i,j);
Vector2f v2=  new Vector2f(mat.moo*i + m01*j + mat.m02*k,
                           mat.m10*i + m11*j + mat.m12*k);

double rotation = Math.acos(v1.dot(v2)/(v1.length()*v2.length()));

trap any length == zero (vector == origin) errors;

cheers,

David Turland



----- Original Message -----
From: David Turland <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 24, 2000 11:58 AM
Subject: Re: [JAVA3D] rotational component


> Andreea
>
> try:
>
> double angle = Math.atan(mat.m10/mat.m00);
>
> where mat is your matrix3f
>
> might need to faff about with signs
>
> Answer easy to find by manually multiplying a vector perpedicular to z
axis
> ([1,0,0] will do nicely) by the matrix and seeing what happens when the
> resulting vector is projected onto xy plane (z=0)
>
> cheers,
>
>
> David Turland
>
>
> ----- Original Message -----
> From: Pondrom, Pierre L <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, March 23, 2000 11:16 PM
> Subject: Re: [JAVA3D] rotational component
>
>
> > It depends on the order in which the matrix was built.
> > You can use atan2() and asin() on 2 elements of the matrix
> > and back out the angle used, but you have to know
> > how the matrix was built in order to pick the right elements.
> >
> >
> >
> > > ----------
> > > From:         Andreea Francu[SMTP:[EMAIL PROTECTED]]
> > > Reply To:     Discussion list for Java 3D API
> > > Sent:         Thursday, March 23, 2000 10:48 AM
> > > To:   [EMAIL PROTECTED]
> > > Subject:      [JAVA3D] rotational component
> > >
> > > I have a Matrix3f object and I need to retrive the rotational
component
> > > around the z axis. Any idea how to do that?
> > >
> > > Thanks,
> > >
> > > Andreea
> > >
> > >
> ==========================================================================
> > > =
> > > 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".
> > >
> >
> >
>
===========================================================================
> > 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".
>
>
===========================================================================
> 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".

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