POV-Ray : Newsgroups : povray.binaries.images : Local rotations Server Time
14 Nov 2024 16:24:42 EST (-0500)
  Local rotations (Message 1 to 1 of 1)  
From: Urs Holzer
Subject: Local rotations
Date: 10 Aug 2006 07:26:57
Message: <44db17fe@news.povray.org>
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

Preview of image 't2.png'
t2.png

Preview of image 't3.png'
t3.png


 

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