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").
Segment_of_Object

Segment_of_Object
general syntax:

object{ Segment_of_Object( MY_OBJECT,
                           Segment_Angle
                         ) //------------
        texture{ ... ... }
        scale<1,1,1>
        rotate<0,0,0>
        translate<0,0,0>
      } // end of object ----------------
MY_OBJECT = any declared, csg-able object and
Segment_Angle = the angle in degrees lefthanded orientated!

Example:
#declare My_Test_Object =
difference{
 sphere{ <0,0,0>, 2.75
         texture{ pigment{ color rgb<0.5,1,0>}
                  finish { phong 1}
                } // end of texture
       }  // end of sphere -------------------
 sphere{ <0,0,0>, 2.25
         texture{ pigment{ color rgb<1,0.6,0>}
                  finish { phong 1}
                } // end of texture
       }  // end of sphere -------------------
 cylinder{ <0,-3.5,0>,<0,3.5,0>, 1.5
           texture{ pigment{ color rgb<1,1,1>}
                    finish { phong 0.5}
                  } // end of texture
         } // end of cylinder  ---------------
  scale<1,0.6,1>
} // end of difference -----------------------
//--------------------------------------------
#include "shapes3.inc"
//--------------------------------------------
object{ Segment_of_Object(My_Test_Object,-235)
        texture{ pigment{ color rgb<1,1,1>}
                 finish { phong 1}
               } // end of texture
      }
// -------------------------------------------
Another example:
Segment_of_Object Segment_of_Object
The original object Segment_Angle = 225

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 Segment_of_Object()

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