Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
    Conditional Statements -
Deutsch Deutsch

Home
- POV-Ray Tutorial

  - Conditional
    Statements

  Branching
  #if(...) ... #else ... #end
    - in loops
    - in macros
    > in animations
    - turning on/off of parts
  #switch(...) #case(..) ...
          #range(..) ... #end
    - selection by tables

  Check for Existence
    #ifdef(...) #ifndef(...)
    - Check in include files
    - Defaults in include files

  Loops
 Prechecked, Postchecked,
 Count-controlled, Early-Exit
    #while(...)... #end
    #for(...)... #end
    - Samples:
    - Loops with POV-Ray
    - Loops, Sine, Cosine
    - Random with POV-Ray
                                       

Branching in Animations

Sample for the use of a single branching by #if for controlling the flowing in animations with "clock":

// camera ------------------------
#declare Jump_Start  = 0.5;
#declare Jump_Height = 7;

#if (clock < Jump_Start )
 #declare Camera_Y = 1.00;
#else
 #declare Camera_Y = 1.00
   + Jump_Height*
     0.5*(1-cos(4*pi*(clock-Jump_Start)));
#end

camera{ angle 38
        location <3,Camera_Y,-20>
        right x*image_width/image_height
        look_at <-3,3,5>
        rotate<0,-360*(clock+0.1),0>
      }
#if ... #else ... #end
The base scene for this camera fly you can find here

top

© Friedrich A. Lohmüller, 2010
homepage:www.f-lohmueller.de