In povray.general, Greg asked how to rotate an object around its "local"
axis. In POV-Ray, transformations are always done relative to the
global coordinate system.
If you want to do transformations of an object relative to the
"coordinatesystem of the object", simply do all transformations in
reverse order.
Look at these 3 images.
The long gray cylinders are the global coordinate system. The red,
green, blue cylinders are the x,y,z axis relative to the box. (I
created them pointing in y,x,z direction and then transformed them the
same way as the box.) The magenta-yellow cylinder is here to highlight
an axis and is oriented the same way in all three images.
In the first image, the box is rotated by 20 degrees around the z-axis:
rotate x*20
In the second image, I rotated the box around its local z-axis by 10
degrees by simply putting the new transformation before all others
instead after them:
rotate z*10
rotate x*20
In image three I went further and translated the box by -x relative to
its local coordinate system. The transformations in this image are:
translate x*-1
rotate z*10
rotate x*20
I hope this helps.
By the way: You don't need to be a mathematician to find out why this
works. Try to imagine what actually happens ...
Greetings
Urs
Post a reply to this message
Attachments:
Download 't1.png' (17 KB)
Download 't2.png' (17 KB)
Download 't3.png' (18 KB)
Preview of image 't1.png'
![t1.png](/povray.binaries.images/attachment/%3C44db17fe%40news.povray.org%3E/t1.png?ttop=443866&toff=4300&preview=1)
Preview of image 't2.png'
![t2.png](/povray.binaries.images/attachment/%3C44db17fe%40news.povray.org%3E/t2.png?ttop=443866&toff=4300&preview=1)
Preview of image 't3.png'
![t3.png](/povray.binaries.images/attachment/%3C44db17fe%40news.povray.org%3E/t3.png?ttop=443866&toff=4300&preview=1)
|