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
                                       
 
Steel_Bridge_1

How To Make a
Steel Bridge Framework

Objects: Round_Box, cylinder.
Methods: #local, #declare, union, #macro, #while loops, #if, shearing by matrix.
This example shows how to make the framework of a truss bridge for railroad / railway (Warren or Neville type). It is possible to use variable sizes for the dimensions of the bridge.

The Construction in details:
 
Step 0: First we declare the basic variables for the dimensions of the bridge (textures are up to you!):
#local L =10.00; // bridge length        .
#local H = 2.50; // bridge height
#local W = 1.50; // bridge width
#local BD = 0.50, // beam diameter
#local BR = 0.10; // beam border radius
Step 1: Then we calculate the number of subdivisions and their lenght for an equidistance distibution of the segments. We also declare the shearing factor (How to calculte see the opposite image):
 // number of subdivisions:
#local NSub = int(L/H);
// distance for equidistant distribution:      .
#local SubDistance = L/NSub;
// shearing factor:
#local S_Factor = 0.5*SubDistance/H;
Step 2: Now we make a pair of diagonal beams:
union{ // pair of diagonals
 object{
   Round_Box(<-BD/2,0,-BD/2>,<BD/2,H,BD/2>,BR,0)
   matrix< 1, 0, 0, //  matrix-shear_y_to_x
              S_Factor, 1, 0,
              0, 0, 1,
              0, 0, 0>
 } // -----------------------------------------
 object{
   Round_Box(<-BD/2,0,-BD/2>,<BD/2,H,BD/2>,BR,0)
   matrix< 1, 0, 0, //  matrix-shear_y_to_x
             -S_Factor, 1, 0,
              0, 0, 1,
              0, 0, 0>
   translate<SubDistance,0,0>
 } // -----------------------------------------
}// end union pair of diagonals

shearing
How to calculate the shearing factor S.
pair of diagonals
pair of sheared diagonals.
Step 3: Now we place the diagonals by a while loop (green). For uneven numbers we mirror the beam in x and move it by 'SubDistance/2' in x (red). We also add a bottom beam and a top beam to get a complete side beam:
// number of subdivisions:
#local NSub = int(L/H);
// distance for equidistant distribution:      .
#local SubDistance = L/NSub;
// shearing factor:
#local S_Factor = 0.5*SubDistance/H;
//-----------------------------------------
#local Side_Beam =
union{ // side strut
  #local Nr = 0; // start counter at zero!
  #while (Nr < 2*NSub )
  object{
   Round_Box(<-BD/2,0,-BD/2>,
             <BD/2,H+2*BR,BD/2>,BR,0)
   matrix< 1, 0, 0, //  matrix-shear_y_to_x
              S_Factor, 1, 0,
              0, 0, 1,
              0, 0, 0>
   #if( Nr/2 != int(Nr/2 )) // uneven numbers
      scale<-1,1,1>
      translate<SubDistance/2,0,0>
   #end
   translate<Nr*SubDistance/2 + BD/2,-2*BR,0>
  } // --------------------------------------
  #local Nr = Nr + 1 ;
  #end // end of loop
  //-----------------------------------------
  // bottom strut
  object{
   Round_Box(<0,-BD,-BD/2>,<L+BD,0,BD/2>,BR,0)
  }
  // top strut
  object{
   Round_Box(<SubDistance/2,-BD,-BD/2>,
             <L-SubDistance/2+BD,0,BD/2>,BR,0)
   translate<0,H,0>
  }
} // end of union side strut
// ---------------------------------
object{ Side_Beam  translate<0,0,0>}
diagonals
The diagonals by a while loop.
side strut
The object{ Side_Beam }

Step 4: The macro Steel_Bridge_Framework_1
Two side beam, some floor beams and diagonals and some additonals stringers complete the bridge. We add all together in a macro to keep the construction as flexible as possible!
//--------------------------------------//////////
#macro Steel_Bridge_Framework_1(
                        Len, // bridge length
                        H, // bridge height
                        W, // bridge width
                        BD,// beam diameter
                        BR,// beam border radius
                      )// ------------------------
// -----------------------------------------------
// ------------------------------- default texture
#ifndef( Steel_Bridge_1_Texture_1 )
#declare Steel_Bridge_1_Texture_1 =
         texture { pigment{ color rgb<1,1,1>*0.5}
                   normal { bumps 0.25 scale 0.35 }
                   finish { phong 1 }
                 } // end of texture
#end // ------------------------------------------
#local L = Len-BD; // inner bridge lenght
//------------------------------------------------
// number of subdivisions:
#local NSub = int(L/H);
// equidistant distribution:
#local SubDistance = L/NSub;
// shearing factor:
#local S_Factor = 0.5*SubDistance/(H+2*BR);

//------------------------------------------------
#local Side_Beam =
union{
 #local Nr = 0; // start counter at zero!
 #while (Nr < 2*NSub )
  object{ Round_Box(<-BD/2,0,-BD/2>,
                    <BD/2,H+2*BR,BD/2>,BR,0)
          texture{ Steel_Bridge_1_Texture_1 }
          matrix< 1,0,0, // matrix-shear_y_to_x
                     S_Factor, 1, 0,
                     0,0,1,
                     0,0,0>
          #if( Nr/2 != int(Nr/2 )) // uneven numbers
            scale<-1,1,1>
            translate<SubDistance/2,0,0>
          #end

          translate<Nr*SubDistance/2+BD/2,-2*BR,0>
        } // -------------------------------------

 #local Nr = Nr + 1 ;
 #end // end

 // bottom strut
 object{ Round_Box(<0,-BD,-BD/2>,<L+BD,0,BD/2>,BR,0)
         texture{ Steel_Bridge_1_Texture_1 }
        }
 // top strut
 object{ Round_Box(<SubDistance/2,-BD,-BD/2>,
                   <L-SubDistance/2+BD,0,BD/2>,BR,0)
         texture{ Steel_Bridge_1_Texture_1 }
         translate<0,H,0>
       }
} // end of union
// -----------------------------------------------
// ---------------------------------- final union:
#union{
 object{ Side_Beam translate<0,0,-W/2+BD/2> }
 object{ Side_Beam translate<0,0,-W/2+BD/2>
                              scale<1,1,-1> }
 object{Round_Box(<0,-BD/2,-BD/3>,<L+BD,0,BD/3>,BR,0)
        texture{ Steel_Bridge_1_Texture_1 }
        translate<0,0,-W/4+BD>
       }
 object{Round_Box(<0,-BD/2,-BD/3>,<L+BD,0,BD/3>,BR,0)
        texture{ Steel_Bridge_1_Texture_1 }
        translate<0,0, W/4-BD>
       }
 #local Nr = 0; // start counter at zero!
 #while (Nr <= NSub )
    // foot traversals
    object{ Round_Box(<-BD/2,-BD,-W/2>,
                      <BD/2,0,W/2>,BR,0)
            texture{ Steel_Bridge_1_Texture_1 }
            translate<Nr*SubDistance + BD/2,0,0>
          }
    // foot diagonals
    #if( Nr < NSub )
    object{ Round_Box(<-BD/4,-BD,-W/2+BD/2>,
                      <BD/4,-BD/2,W/2-BD/2>,BR,0)
          texture{ Steel_Bridge_1_Texture_1 }
          matrix< 1,0,0, //  matrix-shear_y_to_x
                     0,1,0,
                     1*(SubDistance-BD)/(W-BD),0,1,
                     0,0,0>
          #if((Nr/2) = int(Nr/2)) // even numbers
              scale<1,1,-1>
          #end
          translate<(Nr+0.5)*SubDistance+BD/2,0,0>
        }
    #end // end diagonals
 #local Nr = Nr + 1 ;
 #end // end loop
} // end final union
#end // ----------------------------- end of macro
//--------------------------------------//////////

//------------------------------------------------
object{ Steel_Bridge_Framework_1(
                       10.00, // bridge length
                        2.00, // bridge height
                        4.00, // bridge width
                        0.30, // beam diameter
                        0.05,// beam border radius
                      )// ------------------------

  rotate<0, 0,0> translate<0,0.0,0>
} //----------------------------------------------
Note: For a more comfortable use of this as a ready-made object it should be put in an include file as demonstrated in the opposite sample files!





floor beams and diagonals




floor beams and diagonals
The floor beams, diagonals and stringers.



floor beams and diagonals
The complete framework of the truss bridge.






















floor beams and diagonals
The framework of a truss bridge.
Include file for POV-Ray: "Steel_Bridge_Framework_1.inc"
and scene file for POV-Ray: "Steel_Bridge_Framework_1_1.pov"

 
Download of all ready-made POV-Ray objects
zipped up (with all include files, example files and with
the according Insert Menu Add-ons for comfortable use!)
at the POV-Ray Objects
top

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