Descriptions and Samples for the POV-Ray Raytracer by Friedrich A. Lohmüller
    deutsche Version

Winding stair case overview Mast

Ladder

with "macro" and while loop

objects:    "cylinder"
methods: "declare", "local", "union", "#macro", "while"

the following "macro" produces a ladder. Here we have to define the radius of the lateral cylinders, the radius of the steps, the half width of the steps as well as the height of the ladder and distance of the steps. The number of steps is calculated by the height and the distance in this "macro". The steps are placed with a while loop.

// Definition of the dimensions and texture:

//--------------------------------- Dimensions 
#declare LR1 = 0.025; // radius latteral
#declare LR2 = 0.010; // radius of the steps 
#declare LW = 0.23-LR1;// half width 
#declare LH = 3.20;   // height
#declare Step_Distance = 0.25; 
//------------------------------------ texture
#declare Texture_L =
 texture{pigment{color White}
         finish {ambient 0.15 
                 diffuse 0.85 phong 1}}

// The "macro" itself:

//------------------------------------- Ladder
#macro Ladder (R1_L,R2_L,W_L,H_L, Step_Dist) 
#local Step_Totals = int(H_L / Step_Dist);
#local Step = cylinder{<-W_L,0,0>,<W_L,0,0>,R2_L}

#local Nr  = 0;             // start
#local EndNr = Step_Totals; // end
union{
#while (Nr < EndNr) 
 object{Step  
        translate<0,(Nr+0.5)*Step_Dist,0>} 
 #declare Nr = Nr + 1;  // next Nr
#end // --------------- end of loop 
// cylinders latteral:
cylinder{<0,0,0>,<0,H_L,0>,R1_L 
         translate< W_L,0,0>} 
cylinder{<0,0,0>,<0,H_L,0>,R1_L 
         translate<-W_L,0,0>} 
 }// end of union
#end // end of macro  "Ladder (...) 
//--------------------------------------------

// Calling the "macro" object:

object{ Ladder(LR1,LR2,LW,LH, Step_Distance)
             texture{Texture_L}
      } 
//---------------------------------------- end
Ladder
complete
scene description
for POV-Ray:
".txt" file
".pov" file

Winding stair case overview Mast

© Friedrich A. Lohmüller, 2003    emailemail: (legacy email redacted)