TITLE: Spirals NAME: Wong Chee Fah COUNTRY: Malaysia EMAIL: wongcf@cyberway.com.sg TOPIC: Physics & Math COPYRIGHT: I SUBMIT TO THE STANDARD RAYTRACING COMPETITION COPYRIGHT. JPGFILE: spiral.jpg ZIPFILE: spiral.zip RENDERER USED: POV-Ray 3.01 (MSDos) TOOLS USED: Adobe Photoshop 4 - for image compression RENDER TIME: 2h 45m 23s (9923s) HARDWARE USED: Pentium 133MHz, 64MB EDO, S3 Virge 4MB EDO IMAGE DESCRIPTION: A christmas tree made from spirals of spheres DESCRIPTION OF HOW THIS IMAGE WAS CREATED: This is one of the first few images I've created using POV-Ray. I was going through the various modellers and utilities for POV-Ray when I came upon SPIRAL v2.20 by Truman Brown. The output from the program uses CTDS also by Truman Brown. I read through the documentation and decided to attempt an implementation of the same program using POV-Ray alone. This saves the trouble of having to switch between programs. I've not used SPIRAL at all so I'm not sure if the implementation produces the same result (One thing I do know is that CTDS connects points using spheres and cones while mine omits the cylinders). Since my source code includes parametric equations I feel that it is of some relevance to the Math topic. Anyway, the code is included for you to judge. I used parametric equations to creat the spirals. The parameters for the spirals are entered at the beginning using #declare statements. With While loops and conditionals statements, the position and size of each sphere is calculated. The equations for the coordinate of a spiral are as follows :- x = R1-((R1-R2)*t)*sin(2pi*r*t) 0 <= t <= 1 y = H*t 0 <= t <= 1 z = R1-((R1-R2)*t)*cos(2pi*r*t) 0 <= t <= 1 These equations describe a spiral that rises from the x-z plane with a radius of R1, to a height of H, and ends in r revolutions with a radius of R2, as t is varied from 0 to 1. Besides the obvious choices of spiral height, number of revolutions, starting and ending radii, the user can define other parameters such as spiral direction (clockwise or anti-clockwise), and number of spirals. In addition, minor spirals are also available and are just as configurable. Basically, the minor spirals coil around the major spiral. The users have a choice of showing both the major and minor spirals or only one of either or none at all (although I can't see the purpose of the last choice). The whole tree is built by first building a single instance of the major and minor spirals. The position of each sphere in the major and minor spiral are calculated. With the calculated positions, a minor group is formed by repeating the translation and rotation of a minor sphere to its minor position. The number of repetitions depends on the number of minor spirals defined. The group is then translated to the major position. Note that even if the major is not to be shown as it is in this case, the position of each sphere in the major spiral still has to be calculated so that the spheres in minor spirals can be translated to the correct position. To build the whole spiral, a union operation is applied over a while loop that creats the groups. Once that is done the spiral is placed in the scene and copied with rotation about the y-axis. The number of copies depends on the number of major spiral defined. A y-gradient color map texture is applied and the scene is then completed with a camera and a light source. PS. Thanks to Truman Brown for his SPIRAL utility - the origin of the idea for this scene. By the way, I tried 'growing' the tree by building some 120-frame animation clips. The tree can be 'grown' by using the clock variable. One example is given below. Enjoy. #declare Show_Major = 0 // Show Major Spiral ( Default = 1 ) // 0 for No, 1 for Yes #declare Dir_Major = 1 // Major Spiral Direction ( Default = 1 ) // 0 for Anti-Clockwise, 1 for Clockwise #declare R1 = 60*clock // Start Radius of Major Spiral #declare R2 = 0 // End Radius of Major Spiral #declare H = 200*clock // Major Spiral Height #declare Rev = 3*clock // Number of Major Revolutions #declare Start_Rad_Maj = 5*clock// Starting Radius of Major Sphere #declare End_Rad_Maj = clock // Ending Radius of Major Sphere #declare Num_Maj = 360*clock // Number of Spheres per Major Spiral #declare S_Num_Maj = 4 // Number of Major Spirals #declare Show_Minor = 1 // Show Minor Spiral ( Default = 1 ) // 0 for No, 1 for Yes #declare Dir_Minor = 0 // Minor Spiral Direction ( Default = 1 ) // 0 for Anti-Clockwise, 1 for Clockwise #declare R3 = 15*clock // Start Radius of Minor Spiral #declare R4 = 0 // End Radius of Minor Spiral #declare Turns = 2*clock // Number of Turns per Major Revolution #declare Start_Rad_Min = 5*clock// Starting Radius of Minor Sphere #declare End_Rad_Min = 0 // Ending Radius of Minor Sphere #declare Num_Min = 1 // Number of Spheres generated per Major Sphere #declare S_Num_Min = 4*clock // Number of Minor Spirals per Major Spiral