Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
    POV-Ray Examples - How To Make Objects for POV-Ray
Italiano Italiano
Français français
Deutsch Deutsch

Home
- POV-Ray Tutorial
  - POV-Ray Examples
   Index of Content
  - Geometry
  - Architecture
  - Engineering
    - Ladder
    - Pylons
    - Railing
    - Bridge
    - Tubes
    - Tube Fork
    - Tube Stopcock
    - Chain
    - Coil of Wire
    - Torpedo
    - Cruise Missile
    - Rocket
    - Wheel
    - Truck
    - Propeller
    - Airplanes
    - Canoe
    - Guitar Body
    - 7-Segment Display
    - Ribbon Cable
    - Cable Harness
                                       
 
Pylon

Pylon

Objects: box, cylinder, sphere.
Methods: #declare, #local, union, #macro, #while.

The assembly of this pylon:
 
A segment of this mast is made by a horizontal frame out of tubes ("cylinder") with spheres in the corners 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.

//--------------------- Dimensionen -------
#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>}
 // diagonal:
 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) }
 //vertical:
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  //--------------- 
Gittermast  Rahmen
 
 
Gittermast vertikal
 
 
Gittermast Element

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

//--------------------Textures ----------
#declare Texture1 =
 texture{
   pigment{ color rgb<1,1,1>}
   finish { diffuse 0.9 phong 1}}
#declare Texture2 =
 texture{
   pigment{ color rgb<1,1,1>*0.7}
   finish { diffuse 0.9 phong 1}}
//---------------------------------------
// Base:
box{ <-1,0,-1>,< 1,0.05,1>
      scale <W+0.1,1,W+0.1>
      texture{Texture2}}
//-------- Construction with while loop
// 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 
Pylon  640x480

Scene file
for POV-Ray
g_mastm1.pov or
g_mastm1.txt

 
Ready-made POV-Ray objects as
include files and example files you'll find
at the POV-Ray Objects Page
top

© Friedrich A. Lohmüller, 2009
www.f-lohmueller.de