POV-Ray : Newsgroups : povray.advanced-users : Get Euler angles from unit vector? : Re: Get Euler angles from unit vector? Server Time
29 Apr 2024 14:30:24 EDT (-0400)
  Re: Get Euler angles from unit vector?  
From: Le Forgeron
Date: 28 Sep 2018 02:42:18
Message: <5badcd4a$1@news.povray.org>
Le 28/09/2018 à 03:27, Mike Horvath a écrit :
> Two important questions I have (that may not be explained in the docs), 
> is how to convert a 3x3 rotation matrix to POV-Ray syntax, and how to 
> determine the inverse matrix?
> 
> 
> Mike



you only have to input a 3x4 ( column x line), but the math beyond use a 
4x4 matrix with a fourth column set to
{ 0,
   0,
   0,
   1 }
(the 4x4 is important, when combining transformation, a 4x4 * 4x4 -> 
4x4, whereas it make no sense with 3x4 )

The fourth line is the translation

http://wiki.povray.org/content/Reference:Transformations#Matrix

To input a 3x3 rotation matrix
( A B C
   D E F
   G H I )

into povray, it's "simply"

( A B C
   D E F
   G H I
   0 0 0 )

With A to I being the naughty variations of 
"cos(phi)*sin(theta)*cos(gamma)" as usual.

To get the inverse matrix, I'm lazy:

#declare Forward = transform { matrix < .... > } };
#declare Backward = transform { Forward inverse };

As long as the forward matrix is not degenerated, that should do the job.


Post a reply to this message

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