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

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

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

Segment_of_Object

Segment_of_Object


    Segment_of_Object
 
general syntax:
object{  Segment_of_Object (My_Object, Segment_Angle)
        texture{ ... ... }
      } // end of object ------------
With:
My_Object = any declared object and
Segment_Angle = the angle in degrees lefthanded orientated!

Sample:
#declare My_Test_Object =
difference{
 sphere{ <0,0,0>, 2.75
         texture { pigment{ color rgb< 0.5, 1.0, 0.0>}
                   finish { ambient 0.1 diffuse 0.85  phong 1}
                 } // end of texture
       }  // end of sphere ----------------------------------------
 sphere{ <0,0,0>, 2.25
         texture { pigment{ color rgb< 1, 0.6, 0> }
                   finish { ambient 0.1 diffuse 0.85  phong 1}
                 } // end of texture
       }  // end of sphere ----------------------------------------
 cylinder{ <0,-3.5,0>,<0,3.5,0>, 1.50
           texture { pigment { color rgb< 1, 1, 1>}
                     finish  { ambient 0.15 diffuse 0.85 phong 0.5}
                   } // end of texture
         } // end of cylinder  ------------------------------------
  scale<1,0.6,1>
} // end of difference --------------------------------------------

//-----------------------------------------------------------------
#include "shapes_lo.inc"
object{ Segment_of_Object (My_Test_Object,-235)

         texture { pigment{ color rgb<1,1,1>}
                   finish { ambient 0.1 diffuse 0.85  phong 1}
                 } // end of texture
      }
// ---------------------------------------------------------------- 


Macro in detail

For the method of cuting out the segment by two rectangular parallelepipeds see my explanations of the previous macros.
The size of the two rectangular parallelepipeds used here is calculated with the functions "min_extent ( Object )" and "max_extent ( Object )" automatically:
//--------------------------------------------------- Segment_of_Object macro
#macro  Segment_of_Object ( SEgment_OBject, Segment_Angle)
#local D = 0.0001; // just a little bit
#if (Segment_Angle = 0) #local Segment_Angle = D; #end
#if (abs(Segment_Angle) >= 360)
    #local Segment_Angle = mod (Segment_Angle, 360); #end

#local O_min = min_extent ( SEgment_OBject );
#local O_max = max_extent ( SEgment_OBject );

#local O_max_x = max (O_min.x, O_max.x);
#local O_max_z = max (O_min.z, O_max.z);

#local R_max = 1.5*max(O_max_x,O_max_z);

#if (Segment_Angle > 0)
   #local Box_z = R_max+D;
#else
   #local Box_z = -R_max+D;
#end

 intersection{
  object{ SEgment_OBject }

  #if (abs(Segment_Angle) >= 180)
  union{
  #end // then use union!

   box { <-R_max+D,O_min.y-D,0>,< R_max+D, O_max.y+D,-Box_z>
       }// end of box

   box { <-R_max+D,O_min.y-D, Box_z>,<R_max+D, O_max.y+D,0>
         rotate<0, Segment_Angle,0>
        }// end of box

  #if (abs(Segment_Angle) >= 180)
   } // end of union
  #end // end of union, if union is used!

} // end of intersection

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

Another example:
 
Segment_of_Object Segment_of_Object
The original object Segment_Angle = -225






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

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