Introduction to the scenery description langage of the POV-Ray Raytracer         - page 9 -
by Friedrich A. Lohmüller
Italiano Italiano
Français français
Deutsch Deutsch

Home
- POV-Ray Tutorials
 
  
POV-Ray Introduction
   Content  -  INDEX
 
  0. Working with POV-Ray:
      "Insert Menu Add-on".
  1. Basics
      on writing texts.
  2. 3D Coordinates,
      Floats and Vectors
  3. Scene Structur
      #include files,
      camera, light_source.
      Types of light sources
  4. Basic Objects plane, sphere,
      box, cylinder, cone, torus.
      Other Shapes
      height_field, text, etc.
  5. Transformations
      Streching, Turning,
      Moving and others.
      CSG: union,
      difference, intersection.
  6. Color + Surfaces       texture, pigment, normal, finish
  7. #declare, #local,
      #macro .. #end,
      #include,
      re-usable objects.
>8. #while Loops
  9. Efficiency,
      speed, flexibility,
      modulare working
      adapting from 3.1 to 3.5;3.6
      adapting from 3.5;3.6 to 3.7
      POV-Ray + Windows Vista.
 
  - Insert Menu Add-on
    & Download
                                       

IIIV. # while loop - automatic serial production

With this mechanism it is possible, like in every modern programming language, to do automatic serial productions in a very simple way.
Here is a sample:

#declare Nr = 0;   // start value for Nr
#while ( Nr < 30 ) // as long as the value of Nr is smaller then 30,
                    //do the following commands:
     sphere{<1,0,0>,0.25
            rotate<0,Nr * 360/30 ,0>
            texture{pigment{color rgb>1,0.65,0<}
                    finish {ambient 0.1 diffuse 0.85 phong 1.0} } }
  #declare Nr = Nr + 1;     // increase the value of Nr by 1

#end // this draws a full circle of 30 spheres (Nr.0 to Nr.29)!!!!

And this is, what it looks like:
while demo1

Further Samples and more detailed explanations: see under "While-loops with POV-Ray".
top

© Friedrich A. Lohmüller, 2009
email email: Friedrich.Lohmueller_at_t-online.de
homepage:http://www.f-lohmueller.de