Home | Computer Graphics | Adventures in Ray Tracing |     Share This Page

All content Copyright © 2005, P. Lutus. All rights reserved.

Click me for 3D
Click above image for 3D ()

Orientation in POV-space
Click me for 3D
Three-space orientation diagram ()
Before trying to create our first image, let's discover how one describes positions and rotations in three-space. Because this is the most basic kind of knowledge for working with 3D computer graphics, you will find this time well spent. Please examine the graphic on this page, and if you possibly can, view it in 3D using anaglyphic glasses. In this case, a true 3D view is more than a luxury — it greatly improves one's comprehension of the numerous symbols and arrows.

By convention, the dimensions of three-space are identified using the letters X, Y and Z. X is the left-right dimension, Y is up and down, and Z is depth (near and far, if you will). Let's say you have an object in a computer graphic scene and you want to move, or "translate" it, as they say. Notice about the diagram on this page that there are three large, straight arrows pointing outward from the center, labeled X, Y and Z. Each of these arrows indicates the direction an object would move if that coordinate were to have a positive number added to it.

For example, if we add 5 to the Y coordinate, the object would move upward by 5 units. The same rule applies to X and Z, with an X move to the right, and a Z move toward the distance, for the given addition of 5.

Remember that "translation" is the formal name for moving objects along the three dimensions. Apart from being accepted terminology, this is the term used in POV-Ray scene description files, so it's best to remember it.

Here is a POV-Ray scene description file entry for translation:

translate <-0.5, 0, -0.3>
The list of numbers for the "translate" command represent <X,Y,Z>, in that order. The example entry above means "move .5 units to the left (because the X number is negative), and .3 units toward the 'in' direction (because the Z number is negative)." Translation entries are in the same units as the entire scene, and they are signed numbers, numbers that can be positive or negative.

Moving now to rotation, please notice the smaller arrows in the diagram, those with curved tails. At this point a 3D view is a valuable aid in sorting out these small details in my diagram. Each of these smaller arrows indicates which direction a rotation would take for a positive number.

Here is a POV-Ray scene description file entry for rotation:

rotate <0, 20, 0>
This list of numbers are in units of degrees, 360 degrees being a full circle, and the values are in the order <X,Y,Z>, just as for translation. So this entry means "rotate the object around the Y axis by 20 degrees", and the rotation wil be in the direction of the little arrow wrapped around the Y axis in the diagram. By the way, it is rare than one specifies a rotation around more than one axis at a time, because the outcome depends in some cases on the order of evaluation, unlike translation, where the order doesn't matter.

There is another way to sort out the direction of rotation for any of the dimensions, one that doesn't require a diagram viewed in 3D — it's called the "left-hand rule." To see how this works, put your left hand out in front of you and stick your thumb outward. Now wrap your fingers around your palm. At this point, your fingers are pointing in the direction of rotation for positive angles, and your thumb is pointing in the direction for positive translations, for the Z axis. If you point your thumb upward, you have the relationship for the Y axis, and if you point to the right, you have the X axis. Pretty low-tech, eh? This is how people worked out this kind of geometry before they started putting computers in toasters.

To be sure you are getting this relationship, point your left hand, with fingers wrapped around your palm, along each of the dimensions shown in the diagram on this page. If, for each dimension, your fingers are pointing in the same direction as the little arrow with the curved tail, then you are doing it right.
 

Home | Computer Graphics | Adventures in Ray Tracing |     Share This Page