Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
About Loops with POV-Ray     
Italiano Italiano
Français français
Deutsch Deutsch

Home
- POV-Ray Tutorial

  Loops in POV-Ray
  1. For + While
       Comparison
  2. Linear
      Transformations
  3. Circular
      Transformations
  4. Moebius etc.
>5. Screws
       & Spirals
  6. Twisting
       Spirals
  7. Snails
       & Ammonites
  8. Spherical Spirals 1
  9. Spherical Spirals 2
 10. Fibonacci Spirals
                                       
 
 
  - Download

Loops with Screws and Spirals

The superposition of the rotation of a sphere and a translation along the axis of this rotation results into a screw formed placing of the elements:

#declare Ball =
sphere{<0,0,0>,0.35 scale <1,1,1>
       texture{
        pigment{ color rgb<1,0.55,0>}
        finish { phong 1}}}
//-------------------------------------
#declare Radius = 3.00;
#declare N_rev  = 3;//NumberOFrevolution
#declare N_p_rev=50;//ElementsPERrev.
#declare H_p_rev=0.8;//Heightdiff./rev.
#declare H = H_p_rev/N_p_rev;
//-----------------------------------
#declare Nr = 0;              //start
#declare EndNr = N_rev*N_p_rev;// end
#while (Nr < EndNr)
object{ Ball
        translate<Radius,Nr*H,0>
        rotate<0,Nr*360/N_p_rev,0>}
 #declare Nr = Nr+1;  // next Nr
#end // ------------ end of loop -----
Scene file for POV-Ray: povloop7.pov
or: povloop7.txt

If we increase the number of elements per revolution the single elements are morphing into a new shape. The pitfall of this technic: The number of elements and with this the need of RAM as well as the time for calculation
is increasing very fast:
here we have 2500 cylinders per revolution!

//------------------------------------
#declare N_p_rev=2500;
//------------------------------------
Scene file for POV-Ray: povloop8.pov
or: povloop8.txt

If we add to a rotation on zero level a constant radial translation, we get a spiralformed shape:

#declare Ball =
sphere  {<0,0,0>,0.45
texture{pigment{color rgb<1,0.6,0>}
         finish { phong 1}}}
//---------------------------------
#declare Radius0  = 0.0;
#declare N_rev    =   4;
#declare N_p_rev  = 500;
#declare D_p_rev  = 1.0;
#declare D = D_p_rev/N_p_rev;
//--------------------------------
#declare Nr = 0;           //start
#declare EndNr=N_rev*N_p_rev;//end
#while (Nr< EndNr)
 object{Ball
        translate<Radius0+Nr*D,0,0>
        rotate<0,Nr*360/N_p_rev,0>
       }
 #declare Nr = Nr + 1; // next Nr
#end // --------- end of loop -----
Scene file for POV-Ray: povloop9.pov
or: povloop9.txt

top

© Friedrich A. Lohmüller, 2014
http://www.f-lohmueller.de