|
Re: IDLgrModel, rotation angles [message #38122 is a reply to message #38121] |
Mon, 23 February 2004 11:49  |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
lyubo wrote:
>
> Hello,
>
> I have a transformation matrix and I must find the amount of rotation
> in degrees. How can I do that? Any help would be appreciated.
>
Forget previous reply; I was being too complicated. A much simpler
expression for the rotation angle in degrees is:
!RADEG*ACOS(0.5D*(TRACE(rot)-1.0D))
Warning: if the rotation angle is small, the trace might exceed 3.0 due
to round-off error; if it's close to 180 degrees, the trace might be
less than -3.0, for the same reason. If you're sure that roundoff is the
only possible cause of such a problem, the following modification avoids
that problem:
!RADEG*ACOS((0.5D*(TRACE(rot)-1.0D)) <1.0 >(-1.0))
|
|
|
Re: IDLgrModel, rotation angles [message #38123 is a reply to message #38121] |
Mon, 23 February 2004 10:27  |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
lyubo wrote:
>
> Hello,
>
> I have a transformation matrix and I must find the amount of rotation
> in degrees. How can I do that? Any help would be appreciated.
>
> Thank you,
>
> Lyubo
The eigenvalues of a pure rotation matrix are
EXP(COMPLEX(0,-theta))
1.0
EXP(COMPLEX(0,theta))
where theta is the rotation angle in radians. Therefore,
!RADEG*MAX(IMAGINARY(ALOG(HQR(ELMHESS(rot)))))
Will give you back the rotation angle of rot in degrees.
|
|
|