POV-Ray : Newsgroups : povray.general : Convert 313 Cartesian Euler Angles to POV-Ray Coordinates Server Time22 Feb 2024 05:29:34 EST (-0500)
 Convert 313 Cartesian Euler Angles to POV-Ray Coordinates (Message 6 to 15 of 15)
 From: LAP Subject: Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates Date: 10 Sep 2022 11:20:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.631caa527d53bcda80f7e38f24a1f89d%40news.povray.org",
"headline": "Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates",
"dateCreated": "2022-09-10T15:20:00+00:00",
"datePublished": "2022-09-10T15:20:00+00:00",
"author": {
"@type": "Person",
"name": "LAP"
}
}
kurtz le pirate <kur### [at] gmailcom> wrote:
>
>  | a b c |     < a, b, c,            < a, d, g,
>  | d e f | -->   d, e, f,  -- or -->   b, e, h,
>  | g h i |       g, h, i,              c, f, i,
>                  0, 0, 0 >             0, 0, 0,>
>

Yes, but the orginal matrix is in Cartesian coordinates [x, y, z].

The POV Ray matrix operates on its own [x,y,z] coordinates which would be
equivalent to the Cartesian [y, z, -x].

Thus, the matrix needs to be changed to:

< d , g, -a,
e,  h, -b,
f,  i, -c,
0,  0,  0 >

So far this seems to work.

Another part of my problem was that I was also using POV Ray scaling and
translate commands which seem to really mess up the rotations.

From now on I will scale and translate with an external script and just use POV
Ray to rotate.  I can also translate with the POV Ray rotation matrix without
distortion because it is a part of the transformation.
```
 From: kurtz le pirate Subject: Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates Date: 10 Sep 2022 11:37:30 Message: <631caf3a\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#631caf3a%241%40news.povray.org",
"headline": "Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates",
"dateCreated": "2022-09-10T15:37:30+00:00",
"datePublished": "2022-09-10T15:37:30+00:00",
"author": {
"@type": "Person",
"name": "kurtz le pirate"
}
}
On 10/09/2022 17:16, LAP wrote:
>
> So far this seems to work.
>
> Another part of my problem was that I was also using POV Ray scaling and
> translate commands which seem to really mess up the rotations.

all tranformations are just **matrix operations**

for scaling :
| scaleX  0        0      0 |
MSc = | 0       scaleY   0      0 |
| 0       0       scaleZ  0 |
| 0       0       0       0 |

scaling point : MSc.pt

for translating :
| 1 0 0 dx |
MTr = | 0 1 0 dy |
| 0 0 1 dz |
| 0 0 0 1  |

translate : MTr.pt
(in povray matrix, the last line)

and, of corse, 'pt' is **also* a matrix

| x |
pt = | y |
| z |
| 1 ]

and the order of application of the transformations is important !

--
Kurtz le pirate
Compagnie de la Banquise
```
 From: kurtz le pirate Subject: Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates Date: 11 Sep 2022 06:07:54 Message: <631db37a\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#631db37a%241%40news.povray.org",
"headline": "Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates",
"dateCreated": "2022-09-11T10:07:54+00:00",
"datePublished": "2022-09-11T10:07:54+00:00",
"author": {
"@type": "Person",
"name": "kurtz le pirate"
}
}
On 10/09/2022 17:16, LAP wrote:
>
> Yes, but the orginal matrix is in Cartesian coordinates [x, y, z].
>
> The POV Ray matrix operates on its own [x,y,z] coordinates which would be
> equivalent to the Cartesian [y, z, -x].
>
> Thus, the matrix needs to be changed to:
>
> < d , g, -a,
>   e,  h, -b,
>   f,  i, -c,
>   0,  0,  0 >
>
> So far this seems to work.

Hum... yes this is because POVRay use *left-handed system*

If you want to use *right-handed system* you can change camera settings
See *2.3.1.1.7 Handedness* in
<http://www.povray.org/documentation/view/3.6.1/246/>

--
Kurtz le pirate
Compagnie de la Banquise
```
 From: Tor Olav Kristensen Subject: Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates Date: 17 Sep 2022 10:50:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.6325ddf67d53bcda864c7c4689db30a9%40news.povray.org",
"headline": "Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates",
"dateCreated": "2022-09-17T14:50:00+00:00",
"datePublished": "2022-09-17T14:50:00+00:00",
"author": {
"@type": "Person",
"name": "Tor Olav Kristensen"
}
}
"LAP" <nomail@nomail> wrote:
> I am attempting to use POV-Ray for rigid-body dynamics.
>
> I have software that produces rotation parameters as 313 Euler angles, psi,
> theta, and phi, and the associated 313 rotation matrix.  All this is done in 3D
> Euclidean (Cartesian) space.
>
> The problem I face is converting these Euclidean 313 parameters to work in
> POV-Ray coordinates.  In other words, I need to convert the Euclidean rotation
> matrix to a POV-Ray matrix so that I can propery rotate objects (and their
> textures).
>
> Since the basic coordinate transform is <x,y,z> Euclidean to <-z, x, y> I have
> tried to rearrange the components of the Euclidean 313 rotation matrix to
> duplicate this transform but the results are not correct.
>
> Given a rotation matrix in 3D Euclidean space:
>
> | 00 01 02 |
> | 10 11 12 |
> | 20 21 22 |
>
> What is the correct way of transforming this matrix so that it will rotate a
> POV-Ray object in the same way?

Hi

You may want to have a look at the code below.

The matrices.inc and vectors.inc files can be found in these libraries:

https://github.com/t-o-k/POV-Ray-matrices

https://github.com/t-o-k/Useful-POV-Ray-macros

I've had a look at how POV-Ray does things internally - and I have tried
to keep the matrices simlar to that, and to do the multiplcations in the
same order. But keep in mind that since POV-Ray uses a left handed
coordinate system, the signs of the rotation angles are opposite of the
rotation angles in a right handed coordinate system.

I based some of the code below on what I found in these articles:

https://en.wikipedia.org/wiki/Euler_angles#Conventions_by_extrinsic_rotations

https://en.wikiversity.org/wiki/PlanetPhysics/Euler_313_Sequence

--
Tor Olav
http://subcube.com
https://github.com/t-o-k

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.7;

#include "../vectors.inc"
#include "POV-Ray-matrices/matrices.inc"
// #include "matrices.inc"

global_settings { assumed_gamma 1.0 }

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#macro PrintVector3D(v0)

#debug concat("<", vstr(3, v0, ", ", 0, -1), ">")

#end // macro PrintVector3D

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#debug "\n\n"

#declare v0 = <+3, -4, +2>;
#debug "v0 = \n"
PrintVector3D(v0)
#debug "\n\n"

#declare MM_0R = M_Row_FromDir3D(v0);
#debug "MM_0R = \n"
M_Print(MM_0R)
#debug "\n\n"

#declare Psi = +30;
#declare Theta = -45;
#declare Phi = +15;

#declare vR =
vrotate(
vrotate(
vrotate(
v0,
Psi*z
),
Theta*x
),
Phi*z
)
;
#debug "vR = \n"
PrintVector3D(vR)
#debug "\n\n"

#declare Transform_313 =
transform {
rotate Psi*z
rotate Theta*x
rotate Phi*z
}

#declare vT = VectorTransform(v0, Transform_313);
#debug "vT = \n"
PrintVector3D(vT)
#debug "\n\n"

#declare MM_Rot_313_a = M_FromTransform(Transform_313);
#debug "MM_Rot_313_a = \n"
M_Print(MM_Rot_313_a)
#debug "\n\n"

#declare MM_R_a = M_Mult(MM_0R, MM_Rot_313_a);
#debug "MM_R_a = \n"
M_Print(MM_R_a)
#debug "\n\n"

#declare MM_Rot_Psi = M_Rotate3D_AroundZ(radians(Psi));  // 3
#declare MM_Rot_Theta = M_Rotate3D_AroundX(radians(Theta));  // 1
#declare MM_Rot_Phi = M_Rotate3D_AroundZ(radians(Phi));  // 3
#declare MM_Rot_313_b =
M_Mult(
M_Mult(
MM_Rot_Psi,
MM_Rot_Theta
),
MM_Rot_Phi
)
;
#debug "MM_Rot_313_b = \n"
M_Print(MM_Rot_313_b)
#debug "\n\n"

#declare MM_R_b = M_Mult(MM_0R, MM_Rot_313_b);
#debug "MM_R_b = \n"
M_Print(MM_R_b)
#debug "\n\n"

#error "No error, just finished!"

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

The result from running the code above:

v0 =
<3.000000, -4.000000, 2.000000>

MM_0R =
array[1][4] {
{  3.000000, -4.000000,  2.000000,  0.000000 }
}

vR =
<4.434831, 1.214589, 2.803043>

vT =
<4.434831, 1.214589, 2.803043>

MM_Rot_313_a =
array[4][4] {
{  0.745010,  0.565650, -0.353553,  0.000000 },
{ -0.641457,  0.462097, -0.612372,  0.000000 },
{ -0.183013,  0.683013,  0.707107,  0.000000 },
{  0.000000,  0.000000,  0.000000,  1.000000 }
}

MM_R_a =
array[1][4] {
{  4.434831,  1.214589,  2.803043,  0.000000 }
}

MM_Rot_313_b =
array[4][4] {
{  0.745010,  0.565650, -0.353553,  0.000000 },
{ -0.641457,  0.462097, -0.612372,  0.000000 },
{ -0.183013,  0.683013,  0.707107,  0.000000 },
{  0.000000,  0.000000,  0.000000,  1.000000 }
}

MM_R_b =
array[1][4] {
{  4.434831,  1.214589,  2.803043,  0.000000 }
}
```
 From: Tor Olav Kristensen Subject: Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates Date: 17 Sep 2022 10:55:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.6325df737d53bcda864c7c4689db30a9%40news.povray.org",
"headline": "Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates",
"dateCreated": "2022-09-17T14:55:00+00:00",
"datePublished": "2022-09-17T14:55:00+00:00",
"author": {
"@type": "Person",
"name": "Tor Olav Kristensen"
}
}
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "LAP" <nomail@nomail> wrote:
> > I am attempting to use POV-Ray for rigid-body dynamics.
> >
> > I have software that produces rotation parameters as 313 Euler angles, psi,
> > theta, and phi, and the associated 313 rotation matrix.  All this is done in 3D
> > Euclidean (Cartesian) space.
> >
> > The problem I face is converting these Euclidean 313 parameters to work in
> > POV-Ray coordinates.  In other words, I need to convert the Euclidean rotation
> > matrix to a POV-Ray matrix so that I can propery rotate objects (and their
> > textures).
> >
> > Since the basic coordinate transform is <x,y,z> Euclidean to <-z, x, y> I have
> > tried to rearrange the components of the Euclidean 313 rotation matrix to
> > duplicate this transform but the results are not correct.
> >
> > Given a rotation matrix in 3D Euclidean space:
> >
> > | 00 01 02 |
> > | 10 11 12 |
> > | 20 21 22 |
> >
> > What is the correct way of transforming this matrix so that it will rotate a
> > POV-Ray object in the same way?
>
> Hi
>
> You may want to have a look at the code below.
>...

Sorry. The include statements got messed up. They should be:

#include "vectors.inc"
#include "matrices.inc"

--
Tor Olav
http://subcube.com
https://github.com/t-o-k
```
 From: Tor Olav Kristensen Subject: Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates Date: 19 Sep 2022 14:30:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.6328b4b97d53bcdae12da8f789db30a9%40news.povray.org",
"headline": "Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates",
"dateCreated": "2022-09-19T18:30:00+00:00",
"datePublished": "2022-09-19T18:30:00+00:00",
"author": {
"@type": "Person",
"name": "Tor Olav Kristensen"
}
}
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "LAP" <nomail@nomail> wrote:
> > I am attempting to use POV-Ray for rigid-body dynamics.
> >
> > I have software that produces rotation parameters as 313 Euler angles, psi,
> > theta, and phi, and the associated 313 rotation matrix.  All this is done in 3D
> > Euclidean (Cartesian) space.
> >
> > The problem I face is converting these Euclidean 313 parameters to work in
> > POV-Ray coordinates.  In other words, I need to convert the Euclidean rotation
> > matrix to a POV-Ray matrix so that I can propery rotate objects (and their
> > textures).
> >
> > Since the basic coordinate transform is <x,y,z> Euclidean to <-z, x, y> I have
> > tried to rearrange the components of the Euclidean 313 rotation matrix to
> > duplicate this transform but the results are not correct.
> >
> > Given a rotation matrix in 3D Euclidean space:
> >
> > | 00 01 02 |
> > | 10 11 12 |
> > | 20 21 22 |
> >
> > What is the correct way of transforming this matrix so that it will rotate a
> > POV-Ray object in the same way?
>
> Hi
>
> You may want to have a look at the code below.
>...

In these expressions:

M_Mult(MM_0R, MM_Rot_313_a) and M_Mult(MM_0R, MM_Rot_313_b)

- in the code in my reply above, row vectors was multiplied by "313" rotation
matrices.

The code below shows how one can multiply the transposed of the "313" rotation
matrices with column vectors to achieve the same results (except that the
vectors are now column vectors instead of row vectors).

--
Tor Olav
http://subcube.com
https://github.com/t-o-k

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.7;

#include "vectors.inc"
#include "matrices.inc"

global_settings { assumed_gamma 1.0 }

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#macro PrintVector3D(v0)

#debug concat("<", vstr(3, v0, ", ", 0, -1), ">")

#end // macro PrintVector3D

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#debug "\n\n"

#declare v0 = <+3, -4, +2>;
#debug "v0 = \n"
PrintVector3D(v0)
#debug "\n\n"

#declare MM_0C = M_Col_FromDir3D(v0);
#debug "MM_0C = \n"
M_Print(MM_0C)
#debug "\n\n"

#declare Psi = +30;
#declare Theta = -45;
#declare Phi = +15;

#declare vR =
vrotate(
vrotate(
vrotate(
v0,
Psi*z
),
Theta*x
),
Phi*z
)
;
#debug "vR = \n"
PrintVector3D(vR)
#debug "\n\n"

#declare Transform_313 =
transform {
rotate Psi*z
rotate Theta*x
rotate Phi*z
}

#declare vT = VectorTransform(v0, Transform_313);
#debug "vT = \n"
PrintVector3D(vT)
#debug "\n\n"

#declare MM_Rot_313_a = M_FromTransform(Transform_313);
#debug "MM_Rot_313_a = \n"
M_Print(MM_Rot_313_a)
#debug "\n\n"

#declare MM_R_a = M_Mult(M_Transpose(MM_Rot_313_a), MM_0C);  // <--- NB!
#debug "MM_R_a = \n"
M_Print(MM_R_a)
#debug "\n\n"

#declare MM_Rot_Psi = M_Rotate3D_AroundZ(radians(Psi));  // 3
#declare MM_Rot_Theta = M_Rotate3D_AroundX(radians(Theta));  // 1
#declare MM_Rot_Phi = M_Rotate3D_AroundZ(radians(Phi));  // 3

#declare MM_Rot_313_b =
M_Mult(
M_Mult(
MM_Rot_Psi,
MM_Rot_Theta
),
MM_Rot_Phi
)
;
#debug "MM_Rot_313_b = \n"
M_Print(MM_Rot_313_b)
#debug "\n\n"

#declare MM_R_b = M_Mult(M_Transpose(MM_Rot_313_b), MM_0C);  // <--- NB!
#debug "MM_R_b = \n"
M_Print(MM_R_b)
#debug "\n\n"

#error "No error, just finished!"

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

The result from running the code above:

v0 =
<3.000000, -4.000000, 2.000000>

MM_0C =
array[4][1] {
{  3.000000 },
{ -4.000000 },
{  2.000000 },
{  0.000000 }
}

vR =
<4.434831, 1.214589, 2.803043>

vT =
<4.434831, 1.214589, 2.803043>

MM_Rot_313_a =
array[4][4] {
{  0.745010,  0.565650, -0.353553,  0.000000 },
{ -0.641457,  0.462097, -0.612372,  0.000000 },
{ -0.183013,  0.683013,  0.707107,  0.000000 },
{  0.000000,  0.000000,  0.000000,  1.000000 }
}

MM_R_a =
array[4][1] {
{  4.434831 },
{  1.214589 },
{  2.803043 },
{  0.000000 }
}

MM_Rot_313_b =
array[4][4] {
{  0.745010,  0.565650, -0.353553,  0.000000 },
{ -0.641457,  0.462097, -0.612372,  0.000000 },
{ -0.183013,  0.683013,  0.707107,  0.000000 },
{  0.000000,  0.000000,  0.000000,  1.000000 }
}

MM_R_b =
array[4][1] {
{  4.434831 },
{  1.214589 },
{  2.803043 },
{  0.000000 }
}
```
 From: Tor Olav Kristensen Subject: Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates Date: 19 Sep 2022 17:15:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.6328da077d53bcda998109289db30a9%40news.povray.org",
"headline": "Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates",
"dateCreated": "2022-09-19T21:15:00+00:00",
"datePublished": "2022-09-19T21:15:00+00:00",
"author": {
"@type": "Person",
"name": "Tor Olav Kristensen"
}
}
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> > "LAP" <nomail@nomail> wrote:
> > > I am attempting to use POV-Ray for rigid-body dynamics.
> > >
> > > I have software that produces rotation parameters as 313 Euler angles, psi,
> > > theta, and phi, and the associated 313 rotation matrix.  All this is done in 3D
> > > Euclidean (Cartesian) space.
> > >
> > > The problem I face is converting these Euclidean 313 parameters to work in
> > > POV-Ray coordinates.  In other words, I need to convert the Euclidean rotation
> > > matrix to a POV-Ray matrix so that I can propery rotate objects (and their
> > > textures).
> > >
> > > Since the basic coordinate transform is <x,y,z> Euclidean to <-z, x, y> I have
> > > tried to rearrange the components of the Euclidean 313 rotation matrix to
> > > duplicate this transform but the results are not correct.
> > >
> > > Given a rotation matrix in 3D Euclidean space:
> > >
> > > | 00 01 02 |
> > > | 10 11 12 |
> > > | 20 21 22 |
> > >
> > > What is the correct way of transforming this matrix so that it will rotate a
> > > POV-Ray object in the same way?
> >
> > Hi
> >
> > You may want to have a look at the code below.
> >...
>
> In these expressions:
>
> M_Mult(MM_0R, MM_Rot_313_a) and M_Mult(MM_0R, MM_Rot_313_b)
>
> - in the code in my reply above, row vectors was multiplied by "313" rotation
> matrices.
>
> The code below shows how one can multiply the transposed of the "313" rotation
> matrices with column vectors to achieve the same results (except that the
> vectors are now column vectors instead of row vectors).
>

I should probably mention that the transpose of a rotation matrix is the same
as it's inverse. (It's transpose is also the same as the rotation matrix
formed by changing the sign of all the rotation angles.)

| m00 m01 m02 |
| m10 m11 m12 |
| m20 m21 m22 |

(which I presume is for a right handed coordinate system) in POV-Ray with
POV-Ray's left handed coordinate system and with POV-Ray's "default" camera
vectors, then you can just transpose it and use it in a transform statement
like this:

transform {
matrix <
m00, m10, m20,
m01, m11, m21,
m02, m12, m22,
0,   0,   0
>
}

Since the inverse of a rotation matrix is the same as it's transpose,
this should give the same result:

transform {
matrix <
m00, m01, m02,
m10, m11, m12,
m20, m21, m22,
0,   0,   0
>
inverse
}

NB:
I have no idea what you mean by this:
"Since the basic coordinate transform is <x,y,z> Euclidean to <-z, x, y> ..."

Also:
You should be careful when you deal with angles in POV-Ray's trigonometric
functions and rotation statements. The trigonometric functions expect the angles
to be in radians, while the rotation statements expect them to be in degrees.
(My POV-Ray matrix library always expect the angles to be in radians.)

--
Tor Olav
http://subcube.com
https://github.com/t-o-k
```
 From: Tor Olav Kristensen Subject: Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates Date: 20 Sep 2022 11:10:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.6329d5a27d53bcda92b7f9e689db30a9%40news.povray.org",
"headline": "Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates",
"dateCreated": "2022-09-20T15:10:00+00:00",
"datePublished": "2022-09-20T15:10:00+00:00",
"author": {
"@type": "Person",
"name": "Tor Olav Kristensen"
}
}
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> > "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> > > "LAP" <nomail@nomail> wrote:
> > > > ...

> > > > Since the basic coordinate transform is <x,y,z> Euclidean to <-z, x, y> I have
> > > > tried to rearrange the components of the Euclidean 313 rotation matrix to
> > > > duplicate this transform but the results are not correct.
> > > > ...

> ...
> I have no idea what you mean by this:
> "Since the basic coordinate transform is <x,y,z> Euclidean to <-z, x, y> ..."
> ...

Now I think that I understand what you are on about here.
POV-Ray's rendering of your model relative to your screen (depth into or out
of the screen, left or right on the screen and up or down on the screen) is
probably not the same as your other software (or your mind) does it.

If so, I recommend that you do not rearrange components in the rotation matrix
or in position vectors for body parts, but instead change POV-Ray's camera
vectors.

If you want the camera's vectors to be aligned with POV-Ray's x, y and z axes,
you can use any of these camera vector combinations and still keep the left
handedness of POV-Ray:

(D: direction, R: right, U: up)

D: +x, R: +y, U: +z
D: +x, R: -z, U: +y
D: +x, R: -y, U: -z
D: +x, R: +z, U: -y

D: -x, R: +y, U: -z
D: -x, R: -z, U: -y
D: -x, R: -y, U: +z
D: -x, R: +z, U: +y

D: +y, R: +z, U: +x
D: +y, R: -x, U: +z
D: +y, R: -z, U: -x
D: +y, R: +x, U: -z

D: -y, R: +z, U: -x
D: -y, R: -x, U: -z
D: -y, R: -z, U: +x
D: -y, R: +x, U: +z

D: +z, R: +x, U: +y
D: +z, R: -y, U: +x
D: +z, R: -x, U: -y
D: +z, R: +y, U: -x

D: -z, R: +z, U: -y
D: -z, R: -y, U: -x
D: -z, R: -x, U: +y
D: -z, R: +y, U: +x

Example:

camera {
direction +z
right +x // or +4/3*x for the default aspect ratio
up +y
}

If you want to switch to a right handed camera, you can use any of these camera
vector combinations:

D: +x, R: +y, U: -z
D: +x, R: -z, U: -y
D: +x, R: -y, U: +z
D: +x, R: +z, U: +y

D: -x, R: +y, U: +z
D: -x, R: -z, U: +y
D: -x, R: -y, U: -z
D: -x, R: +z, U: -y

D: +y, R: +z, U: -x
D: +y, R: -x, U: -z
D: +y, R: -z, U: +x
D: +y, R: +x, U: +z

D: -y, R: +z, U: +x
D: -y, R: -x, U: +z
D: -y, R: -z, U: -x
D: -y, R: +x, U: -z

D: +z, R: +x, U: -y
D: +z, R: -y, U: -x
D: +z, R: -x, U: +y
D: +z, R: +y, U: +x

D: -z, R: +z, U: +y
D: -z, R: -y, U: +x
D: -z, R: -x, U: -y
D: -z, R: +y, U: -x

--
Tor Olav
http://subcube.com
https://github.com/t-o-k
```
 From: Tor Olav Kristensen Subject: Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates Date: 20 Sep 2022 11:35:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.6329dd127d53bcda92b7f9e689db30a9%40news.povray.org",
"headline": "Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates",
"dateCreated": "2022-09-20T15:35:00+00:00",
"datePublished": "2022-09-20T15:35:00+00:00",
"author": {
"@type": "Person",
"name": "Tor Olav Kristensen"
}
}
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> ...

Of course, some errors had to sneak in.

> ...
> D: -z, R: +z, U: -y

Should be:

D: -z, R: +x, U: -y

> ...
> D: -z, R: +z, U: +y

Should be:

D: -z, R: +x, U: +y

--
Tor Olav
http://subcube.com
https://github.com/t-o-k
```
 From: LAP Subject: Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates Date: 24 Sep 2022 13:05:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.632f37ba7d53bcda80f7e38f24a1f89d%40news.povray.org",
"headline": "Re: Convert 313 Cartesian Euler Angles to POV-Ray Coordinates",
"dateCreated": "2022-09-24T17:05:00+00:00",
"datePublished": "2022-09-24T17:05:00+00:00",
"author": {
"@type": "Person",
"name": "LAP"
}
}
> > >
> > > Given a rotation matrix in 3D Euclidean space:
> > >
> > > | 00 01 02 |
> > > | 10 11 12 |
> > > | 20 21 22 |
> > >
> > > What is the correct way of transforming this matrix so that it will rotate a
> > > POV-Ray object in the same way?
> >
> > Hi
> >
> > You may want to have a look at the code below.
> >...

I thank you for your time and effort.

After a lot of trial and error, I believe that I have found a solution.

A 3-1-3 set of Euler angles (or any other variation) gives rise to a rotation
matrix according the formulas found here (and other places):

https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix

As with any rotation matrix, the columns of the matrix correspond to the vectors
that result from rotating each Euclidean basis vector.  (Since rotations are
rigid each column vector is also a unit vector.)

Using the POV Ray transform Shear_Trans(A, B, C), where the vectors A, B, and C
are the column vectors of the Euclidean rotation matrix, I can orient the object
in POV Ray space in the same way as in Euclidean space.

Of course, the column vectors have to be adjusted for the Euclidean [x, y,z] to
POV Ray <x,y,z> coordinate transformation.  This is done as follows.

The Euclidean rotation matrix:

| 11 12 13 |
| 21 22 23 |
| 31 32 33 |

is used to create the POV Ray vectors in this manner:

A = <22, 32, -12>

B = <23, 33, -13>

C = <21, 31, -11>

Using these vectors in Shear_Trans(A, B, C) produces a rotation that is
equivalnt to using the 3-1-3 Euler angles in Euclidean space.

My plan is to perform all calculation with an external program and to feed the
data into POV Ray using variables.
```