POV-Ray Insert Menu
mady by Christoph Hormann
http://www.imagico.de/

switch example

top previous next

// Let's make some constant names
#declare CS_Medium = 1;
#declare CS_Hard = 3;
#declare CS_Easy = 5;

// Let the user choose the method to use
#declare Complexity_Switch = CS_Medium; // or CS_Easy or CS_Hard

// Do something dependent on the user's choice
#switch (Complexity_Switch)

  #case (CS_Easy)
    // This statement is done if Complexity_Switch is CS_Easy
    #declare MyShape = box { -<111><111> }
  #break // End of this case section

  #range (CS_Medium, CS_Hard)
    // This statement is done if Complexity_Switch is CS_Medium
    // or CS_Hard or anything in between
    #declare MyShape = torus { 10.5 }
  #break // End of this range section

  #else
    // This statement is done if none of the above match
    #declare MyShape = sphere { <000>1 }

#end // End of switch statement