You are here

Creating Photo-realistic Images and Animations

Author(s): 
Michael Grady (Southern Utah Univ.)

A Pentagon:

We'll construct our dodecahedron from twelve congruent pentagons. Suitable coordinates for the 20 vertices of a dodecahedron centered at the origin are as follows:

\((\pm 1, \pm 1, \pm 1)\)
\((0, \pm 1/\phi, \pm\phi)\)
\((\pm 1/\phi, \pm\phi, 0)\)
\((\pm\phi, 0, \pm 1/\phi)\)

where \(\phi = (1+\sqrt5)/2\) is the golden ratio [3].

The POV-Ray scene description language is “Turing Complete”, which means it is capable of expressing any algorithm expressible by the familiar programming languages like C++ or Java. It has branching and looping constructs and allows the description of functions. Functions are most often defined in POV-Ray using the macro construct. We use the macro construct below to define a function called “Pentagon” which takes the coordinates of five points in space as input then constructs a pentagon as output. The union construct allows primitive objects to be gathered into a single compound object. The spheres are added at the endpoints to make the joints smooth. Two constants,   and   are declared and used to make the code more readable. The code below creates one of the pentagons that form the final scene. Save it as dodec-04.pov and render it (Figure 5). (Changes from dodec-03.pov above are indicated in boldface.)

 

pentagon with texture
Figure 5: A pentagon constructed from five cylinders

The Final Scene:

The only thing left is to add the remaining 11 pentagons. Note that we have declared a dodecahedron to be the union of twelve pentagons. The code is given below -- save it as dodec-05.pov and render it (Figure 6). (Changes from dodec-04.pov are indicated in boldface.)

 

dodecahedron
Figure 6: The Final Scene

Michael Grady (Southern Utah Univ.), "Creating Photo-realistic Images and Animations," Convergence (September 2010), DOI:10.4169/loci003351