Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
Geometric Shapes in POV-Ray
Italiano Italiano
Français français
Deutsch Deutsch

Home
- POV-Ray Tutorial
 
Geometric Shapes
   Overview

Objects in "shapes3.inc"
- Segment_of_CylinderRing
- Segment_of_Torus
- Segment_of_Object
- Egg
- Egg_Shape
- Facetted_Egg
- Facetted_Egg_Shape
- Facetted_Sphere
- Ring_Sphere
- Column_N
- Column_N_AB
- Pyramid_N
- Pyramid_N_AB
- Round_Pyramid_N_out
- Round_Pyramid_N_in
- Round_Cylinder_Tube
- Rounded_Tube_AB
- Rounded_Tube
>Round_N_Tube_Polygon
- Round_Conic_Torus
- Round_Conic_Prism
- Half_Hollowed_Rounded_Cyl1
- Half_Hollowed_Rounded_Cyl2

 
                               
Geometric object definded in my include file "shapes3.inc" (formerly "shapes_lo.inc").
Round_N_Tube_Polygon
Round_N_Tube_Polygon
general syntax:
object{ Round_N_Tube_Polygon( N,
                           Tube_R,
                           InCircle_R,
                           Edge_R,
                           Filled,
                           Merge_On
                         ) //---------
        texture{ ... ... }
        scale<1,1,1>
        rotate<0,0,0>
        translate<0,0,0>
      } // end of object -------------
N = number of tube segments,
Tube_R = radius of the tube,
InCircle_R = incircle radius (tube sections to center),
Edge_R = major radius of torus segments in corners.
Filled: 1 = filled; 0 = only wireframe (filling percentage)
Merge_On: 0 = union; 1 = merge (if transparent).
Round_N_Tube_Polygon_demo_2
Example secene file ".txt" or ".pov"
Round_N_Tube_Polygon_demo_1
Example secene file ".txt" or ".pov"

Round_N_Tube_Polygon
Round_N_Tube_Polygon
Example:
#include "shapes3.inc"
object{ Round_N_Tube_Polygon( 6, // N,
                            0.1, // Tube_R,
                           0.85, // Base_Width,
                           0.25, // Edge_R
                              1, // Filled,
                              1, // Merge_On
                               ) //------------
        texture{ pigment{ color rgbf<1,1,1,0>}
                 finish { phong 1
                          reflection{0.4} }
               } // end of texture
        scale <1,1,1>
        rotate <0,0,0>
        translate<01,0,0>
      } // end of object ----------------------
Facetted_Spheres
Variations on "Round_N_Tube_Polygon(...)"

Macro in detail
//--------------------- Round_N_Tube_Polygon()
#macro Round_N_Tube_Polygon( N_in,
                             Tube_R,
                             Base_Width,
                             Edge_R
                             Filled,
                             Merge_On
                           ) // -----------------
//-----------------------------------------------
#local N = N_in;
#if( N < 3) #local N = 3; #end
//-----------------------------------------------
#local D = 0.000001; // just a little bit
// to avoid coincident surfaces! //--------------
#local Edge_Angle = 360/N ;
#local Linear_Half_Len =
  (Base_Width-Edge_R)*tan(radians(Edge_Angle/2));
//-----------------------------------------------
#local Edge_Part =
#if( Filled > 0)
 #if( Merge_On = 1 )
 merge{
 #else
 union{
 #end // #if(Merge_On = 1 )
#end // #if(Filled > 0)
object{ Segment_of_Torus( Corner_R,
                            Tube_R,
                       -Edge_Angle )
        rotate<-90,0,0>
        translate
          <Base_Width-Corner_R,Linear_Half_Len,0>
      } // end of Torus_Segment(...)

#if( Filled > 0)
cylinder{ <0,0,-Tube_R*Filled>,
          <0,0,Tube_R*Filled>, Corner_R
          translate
          <Base_Width-Corner_R,Linear_Half_Len,0>
        }
}// end union or merge
#end // #if(Filled > 0)
//-----------------------------------------------
#if (Corner_R != Base_Width)

#local Linear_Part =
#if( Filled > 0)
 #if( Merge_On = 1 )
 merge{
 #else
 union{
 #end // #if(Merge_On = 1 )
#end // #if(Filled > 0)

cylinder { <0,-Linear_Half_Len-D,0>,
           <0,Linear_Half_Len+D,0>,Tube_R
           translate<Base_Width,0,0>
         } // end of cylinder

//----------------------//
#if( Filled > 0)
// linear prism in z-direction
prism{ -Tube_R*Filled-D ,Tube_R*Filled+D , 6
   <-D, 0.00>,  // first point
   < Base_Width-Corner_R-D,-Linear_Half_Len-D>,
   < Base_Width           ,-Linear_Half_Len-D>,
   < Base_Width           , Linear_Half_Len+D>,
   < Base_Width-Corner_R-D, Linear_Half_Len+D>,
   <-D, 0.00>  // last point = first point!
   // turns prism in z direction:
   rotate<-90,0,0> scale<1,1,-1>
 } // end of prism ------------------------------

}// end union or merge
#end // #if(Filled_On = 1)
//----------------------//
#end // #if (Corner_R != Base_Width)
//-----------------------------------------------
#if (Corner_R != Base_Width)
#local One_Segment =
 #if(Merge_On = 1 )
 merge{
 #else
 union{
 #end
        object {Linear_Part}
        object {Edge_Part}
      } // end union or merge
#else
 #local One_Segment =
        object {Edge_Part}
#end
//-----------------------------------------------
// final union or merge
#if(Merge_On = 1 )
merge{
#else
union{
#end
  #local Nr = 0;     // start
  #local EndNr = N; // end
  #while (Nr < EndNr)
    object{One_Segment rotate<0,0,Nr * 360/EndNr>}
  #local Nr = Nr + 1;    // next Nr
  #end // ---------------  end of loop
} // end union or merge
//-----------------------------------------------
#end // -------- end of macro Round_Tube_Ring_N()

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