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 and circular Transformations

The while loop used with a simple rotation movement:

#declare Ball =
sphere{ <0,0,0>,0.50
   texture{
     pigment{ color rgb<0.75,0,0>}
     finish{ phong 1 } }
} //----------------------------------
#declare Radius = 3.00;
#declare Nr = 0;      // start
#declare EndNr = 16;  // end
#while (Nr < EndNr)
object{ Petal
        translate<Radius,0.5,0>
        rotate<0,Nr* 360/EndNr,0>}
 #declare Nr = Nr + 1;// next Nr
#end // --------- end of loop -------



A "florale" version:
Scene file for POV-Ray: povloop4_4.pov
or povloop4_4.txt
Scene file for POV-Ray: povloop4_0.pov
or povloop4_0.txt

If we additionally rotate the spheres around
the z direction, we get a circleformed spiral:

#declare Ball =
sphere{<0,0,0>,0.25
       texture{
         pigment{ color rgb<1,0,0>}
         finish { phong 1}
       } //
} //----------------------------------
#declare R_major = 3.00;
#declare R_minor = 1.00;
#declare N_major =  10;
#declare N_minor = 430;

#declare Nr = 0;             // start
#declare EndNr=N_major*N_minor;// end
#while (Nr < EndNr)
object{Ball
       translate<R_minor,0,0>
       rotate<0,0,Nr * 360/N_minor>
       translate<R_major,0,0>
       rotate<0,Nr * 360/EndNr,0>}
 #declare Nr = Nr+1;//next Nr
#end // -------- end of loop -------
Scene file for POV-Ray povloop5.pov
or: povloop5.txt

 

If we continue this game we get a circleformed double spiral - the number of spheres increases very tremendous - in the following scenery there are about 25 000 balls on the field and about 17 MB RAM were used.

#declare Ball =
 sphere{<0,0,0>,0.1
        texture{see scene file}}}
//------------------------------------
#declare R_major = 3.50;
#declare R_minor = 1.00;
#declare R_inner = 0.30;
#declare N_maj = 14;
#declare N_min = 18;
#declare N_in  = 100;
//--------------------------------
#declare Nr = 0;    // start loop
#while (Nr < N_maj*N_min*N_in)
object{Ball
 translate<0,0,R_inner>
 rotate<0,Nr * 360/N_inner,0>
 translate<R_minor,0,0>
 rotate<0,0,Nr * 360/(N_min*N_in)>
 translate<R_major,0,0>
 rotate<0,Nr*360/(N_maj*N_min*N_in),0>
 }
 #declare Nr=Nr+1;// next Nr
#end // ----------- end of loop --
Scene file for POV-Raypovloop6.pov
or: povloop6.txt


top

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