POV-Ray : Newsgroups : povray.advanced-users : finding the rotation vector of the transformation between two reference fra= : Re: finding the rotation vector of the transformation between two reference= Server Time
4 Oct 2024 17:03:54 EDT (-0400)
  Re: finding the rotation vector of the transformation between two reference=  
From: chrissounette
Date: 9 Apr 2007 20:05:01
Message: <web.461ad37047487f055ffa356d0@news.povray.org>
"Grassblade" <nomail@nomail> wrote:
> "chrissounette" <nomail@nomail> wrote:
>
> Hmm, you want to have a conversion between the two? If A1 is the matrix of
> the first object, and A2 is the second, you are looking for X such that:
> A1*X=A2 sooo X= A1^(-1)*A2. I think.

Thanks, but it is not so simple. In fact, let consider two orthogonal triads
of unit vectors I = [Forward_1, Right_1, Up_1] and J = [Forward_2, Right_2,
Up_2] with same origin O. Determining the ZYX angles, also known as
Roll-Pitch-Yaw angles, to denote the rotational relationship between the
vectors of these two triads requires to compute first the rotation matrix R
as follow:

[Forward_2 | Right_2 | Up_2] = R * [Forward_1 | Right_1 | Up_1].
-> R = [Forward_2 | Right_2 | Up_2] * [Forward_1 | Right_1 | Up_1]^(-1).

Then the inverse solution to a given rotation matrix R [r11,r12,r13;
r21,r22,r23; r31,r32,r33] can be obtained by:

Roll  = Atan2(r21,r11)
Pitch = Atan2(-r31,sqrt(r32^2+r33^2));
Yaw   = Atan2 (r32,r33);

I'm not expert in Povray yet, and I was wondering if there is a macro
available to do implement this solution ??? If not, I would appreciate if
somobody could help me writing such macro :-)

Thanks,
Chris


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.