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

Ladder overview Canoe in the water

Mast

with/without "macro" and with #while loop

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

A segment or the mast is made by a horizontal frame out of tubes ("cylinder") with spheres at the ends and also by some vertical and diagonal tubes. This single segment has no tubes at his upper end, there the next segment will be added.

//----------------------------- Dimensions
#declare R1 = 0.050; // main radius
#declare R2 = 0.025; // diagonals radius
#declare W = 1.00-R1;// half width(outline!)
#declare H = 2.00;   // height
//------------------------- horizontal frame
#macro Square_Q(R1_, W_ )
union{
 cylinder{<-W_,0,0>,<W_,0,0>,R1_ translate<0,0,-W_>}
 sphere  {<0,0,0>,R1_ translate<W,0,-W_>}
} #end //-----------------

#macro Square (R10, W0)
union{
 object{ Square_Q(R10, W0) rotate<0,0*90,0>}
 object{ Square_Q(R10, W0) rotate<0,1*90,0>}
 object{ Square_Q(R10, W0) rotate<0,2*90,0>}
 object{ Square_Q(R10, W0) rotate<0,3*90,0>}
     } #end  //-----------------------------
//----------------------- vertical elements:
#macro V_Element (R10, R20, W0, H0)
union{
 cylinder {<0,0,0>,<0,H0,0>,R10
                       translate<-W0,0,-W0>}
 // diagonals:
 cylinder{<-W0,0,0>,<W0,H0,0>,R20
                     translate<0,0,-W0+R20>}
 cylinder{<W0,0,0>,<-W0,H0,0>,R20
                     translate<0,0,-W0-R20>}
   } #end //--------------------------------

#macro Element_4 (R11, R21, W1, H1)
union{
object{ Square (R11, W1) }
 //verticals:
object{V_Element(R11,R21,W1,H1) rotate<0,0*90,0>}
object{V_Element(R11,R21,W1,H1) rotate<0,1*90,0>}
object{V_Element(R11,R21,W1,H1) rotate<0,2*90,0>}
object{V_Element(R11,R21,W1,H1) rotate<0,3*90,0>}
translate<0,R1,0>} #end  //-------------------- 
mast horizontal frame
mast vertical elements
mast segment

This mast segment can be used much more flexible if it is definded as a "macros". By this all sizes are freely to choose. A sample you will find in the source code of the following scenery. Changed parts are printed in "strong" style in the following text.
The mast is constructed by identical segments with a while loop:

//------------------------- textures --------
#declare Texture1 =
 texture{
   pigment{color White}
   finish {ambient 0.45 diffuse 0.55 phong 1}}
#declare Texture2 =
 texture{
   pigment{color White*0.7}
   finish {ambient 0.45 diffuse 0.55 phong 1}}
//--------------------------------------------
// base:
box {<-1,0,-1>,< 1,0.05,1>
      scale <W+0.1,1,W+0.1> texture{Texture2}}
//------------ Zusammenbau mit While-Schleife
// tower:
#declare Nr = 0;    // start
#declare EndNr = 8; // end

union{
#while (Nr <EndNr)
   object{ Element_4(R1, R2, W, H)
           texture{Texture1}
           translate<0,Nr*H,0>}
 #declare Nr = Nr + 1;  // next Nr
#end // --------------- end of loop
object{ Square (R1, W)   texture{Texture1}
        translate<0,Nr*H+R1,0>}
translate<0,0.05,0> }
//-------------------------------------- end
mast  640x480

complete
scenery
description
for POV-Ray(.pov)


or as a .txt file.


Ladder overview Canoe in the water

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