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

macro "Segment_of_Object (...)" overview my macro objects macro "Column_N (...)"

This shape is definded as "macro" in my include file "shapes_lo.inc":

Round_Tube_Ring_N

Round_Tube_Ring_N


   Round_Tube_Ring_N
 
general syntax:
object{ Round_Tube_Ring_N (N, Tube_R, Base_Width, Edge_R)
        texture{ ... ... }
      } // end of object ------------------------
With N = number of tube segments,
Tube_R = radius of the tube,
Base_Width = distance of linear tube sections from center,
Edge_R = the major radius of the torus segments in the edges.
Sample:
#include "shapes_lo.inc"
//#macro Round_Tube_Ring_N (N, Tube_R, Base_Width, Edge_R)
object{ Round_Tube_Ring_N (3, 0.05, 0.40, 0.25)
        texture { pigment{ color rgb<1,0.7,0.2>}
                  finish { ambient 0.15 diffuse 0.85
                           phong 1 reflection 0.4}
                } // end of texture
        scale <1,1,1>
        rotate <0,0,0>
        translate<0.4,1.5,0>
      } // end of object ---------------------------------- 


Macro in detail

This macro uses the macro "Torus_Segment":
//--------------------------------- Round_Tube_Ring_N (...) macro
#macro Round_Tube_Ring_N (N, Tube_R, Base_Width, Edge_R)
#if (Edge_R > Base_Width) #declare Edge_R=Base_Width; #end
#if (N < 3 ) #declare N = 3; #end
#declare Edge_Angle = 360/N ;
#declare Linear_Half_Len =
         (Base_Width-Edge_R)*tan(radians(Edge_Angle/2));

#declare Edge_Part =
object{ Torus_Segment( Edge_R, Tube_R, Edge_Angle)
        rotate <-90,0,0>
        translate <Base_Width-Edge_R,Linear_Half_Len,0>
      } // end of Torus_Segment(...) ----------------------------

#if (Edge_R != Base_Width)
#declare Linear_Part =
cylinder { <0,-Linear_Half_Len,0>, <0,Linear_Half_Len,0>, Tube_R
           translate <Base_Width,0,0>
         } // end of cylinder -----------------------------------
#end

#if (Edge_R != Base_Width)
 #declare One_Segment =
 union{
        object {Linear_Part}
        object {Edge_Part}
      }
#else
 #declare One_Segment =
        object {Edge_Part}
#end

union{
 #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 // --------------------- end of macro Round_Tube_Ring_N (...)

Here some variations of that macro:
 
Facetted_Spheres
Variations on "Round_Tube_Ring_N(...)"





macro "Segment_of_Object (...)" overview my macro objects macro "Column_N (...)"

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