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

macro "Round_Tube_Ring_N (...)" overview my macro objects macro "Egg_Shape (...)"

These shapes are definded as "macro" in my include file "shapes_lo.inc":

Column_N

Column_N
A column with N edges

Pyramid_N

Pyramid_N
A pyramid with N edges


    Regular Column with N Edges
 
general syntax:
object{ Column_N (N, Radius, Height)
        texture{ ... ... }
      } // end of object ------------
Here N >2 = the number of edges,
Radius = means the half width and
Height is the total height of the column.





Sample:
#include "shapes_lo.inc"
object{ Column_N (14, 1.8, 1.30 )
        texture { pigment{color rgb<1,1,1>}
                  finish {ambient 0.05
                          diffuse 0.95
                          phong 1}
                } // end of texture
      } // end of object ------------------
    Regular Pyramid with N Edges
          also truncated

 
general syntax:
object{ Pyramid_N (N, Radius1, Radius2, Height)
        texture{ ... ... }
      } // end of object ------------
Here N >2 = the number of edges,
Radius1 = means the half base width,
Radius2 = means the half top width and
Height is the total height of the pyramid.
If we choose Radius2 = 0 the pyramid will not be truncated.
 
Sample:
#include "shapes_lo.inc"
object{ Pyramid_N (14, 1.8, 1.30, 1.00 )
        texture { pigment{color rgb<1,1,1>}
                  finish {ambient 0.05
                          diffuse 0.95
                          phong 1}
                } // end of texture
      } // end of object ------------------


Macros in detail

To show how it works we start with the Pyramid_N macro :

//--------------------------------------------------------- Pyramid_N macro
#macro Pyramid_N (N, Radius1, Radius2, Height)
//-------------------------------------------------------------------------
#local D= 0.00001;

intersection{
 #local Nr = 0;    // start
 #local EndNr = N; // end
 #while (Nr < EndNr)

  // linear prism in z-direction:
  prism { -2.00 ,2.00 , 5 // from z1, to z2 , number of points (first = last)
         <-2.00, 0.00>, < 1.00,  0.00>,
         < 0.00+Radius2/Radius1,1.00>,
         <-2.00,1.00>, <-2.00, 0.00>
         rotate<-90,0,0> scale<1,1,-1> //turns prism in z direction!
         scale <Radius1+Nr*D,Height+Nr*D,Radius1+Nr*D>
         rotate<0,Nr * 360/EndNr,0>
     } // end of prism ----------------------------------------------------

 #local Nr = Nr + 1;    // next Nr
 #end // ----------------  end of loop
} // end of intersection

#end // ------------------------------------------------------ end of macro

If we start this macro with N = 1 the result will be a degenerated intersection out of just one prism.
So all we have to do is turn around the y axis these elements by 360/N and intersect them all:

 
Samples one prism Samples intersection of prisms
N = 1, Radius1 = 1.70, Radius2 = 1.10, Height= 1.50 N = 11, Radius1 = 1.70, Radius2 = 1.10, Height= 1.50

A Column with N edges is nothing else than a truncated pyramid with top radius = base radius, so the following macro will work together with the above macro:


//--------------------------------------------- Column_N macro
#macro Column_N  (N, Radius, Height )
//------------------------------------------------------------
object{ Pyramid_N (N, Radius, Radius, Height )
      }
#end // ---------------------------------------- end of  macro
Samples column Samples column
N = 3, Radius = 1.00, Height= 0.50 N = 14, Radius = 1.80, Height= 1.30
Samples column Samples column
N = 7, Radius = 2.00, Height= 1.00 N = 7, Radius1 = 2.00, Height= 1.00




macro "Round_Tube_Ring_N (...)" overview my macro objects macro "Egg_Shape (...)"

© Friedrich A. Lohmüller, 2010
email email: (legacy email redacted)
homepage:www.f-lohmueller.de