Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller Geometric Shapes in POV-Ray Italiano Français 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_CylinderRing

general syntax:
 ```object{ Segment_of_CylinderRing( R_out, R_in, Height_in_Y, Segment_Angle ) //--------------- texture{ ... ... } scale <1,1,1> rotate<0,0,0> translate<0,0,0> } // end of object ---------```
R_out = the outer radius of the cylindrical ring,
R_in = the inner radius of the cylindrical ring,
Height = the height of the ring segment,
Segment_Angle = the angle in degrees lefthanded orientated!
For Segment_Angle = 0 we get a closed ring or a tube.
Examples:
 ```#include "shapes3.inc" // ------------------------------------------------- object{ Segment_of_CylinderRing( 3.75,2.25,0.2,-300) texture{ Chrome_Metal finish { phong 1} } // end of texture } // ----------------------------------------- object{ Segment_of_CylinderRing( 1.75,1.5,2.0,-270) texture{ pigment {color White*1.1} finish { phong 1 } } // end of texture } // ----------------------------------------- object{ Segment_of_CylinderRing( 2.5, 3.0, 1.0, -80) texture{ pigment{ color rgb< 0.7, 1, 0.0> } finish { phong 1 reflection 0.2} } // end of texture } // ----------------------------------------- object{ Segment_of_CylinderRing( 1.1, 0.8, 1.5, 0) texture{ pigment{ color rgb< 1,0.7, 0.0> } finish { phong 1 reflection 0.2} } // end of texture } // -----------------------------------------```

Macro in detail:
First we subtract from a cylinder with the radius R_out a smaller cylinder with the radius R_in by making an intersection of the first cylinder with the inverse of the second cylinder. Then 2 boxes rotated against another were used to cut out the wanted segment.
For this we have to consider two cases:
1. abs(Segment_Angle) <= 180 degrees (just an intersection of the torus and the two boxes) and
2. abs(Segment_Angle) > 180 degrees (an intersection of the torus and the union of the two boxes):

The following images show how this macro works
(the boxes are visualizised in texture glass):

abs(Segment_Angle) <= 180 degrees
R_out = 1.25, R_in = 0.75, Angle =-145
abs(Segment_Angle) > 180 degrees
R_out = 1.25, R_in = 0.75, Angle =-215
 ```//--------------------------- Segment_of_CylinderRing() #macro Segment_of_CylinderRing( R_out, R_in, Height, Segment_Angle ) //------------ #local D = 0.0001; // just a little bit #if (Height = 0 ) #local Height = D; #end #if (Height < 0 ) #local D = -D; #end #if (R_out < R_in) #local X=R_out; #local R_out=R_in; #local R_in=X; #end #if (Segment_Angle < 0) #local Negativ_Flag = 1; #local Segment_Angle = -Segment_Angle; #else #local Negativ_Flag = 0; #end #if (Segment_Angle >= 360) #local Segment_Angle = mod (Segment_Angle, 360); #end intersection{ cylinder { <0,0,0>,<0,Height,0>, R_out } // end of outer cylinder ---------- cylinder { <0,-D,0>,<0,Height+D,0>, R_in inverse } // end of inner cylinder ---------- #if (Segment_Angle > 0) // ----------------------- #if (Segment_Angle >= 180) union{ #end // then use union! box { <-R_out+D,-D,0>,< R_out+D, Height+D, R_out+D> }// end of box box { <-R_out+D,-D,-R_out+D>,< R_out+D, Height+D,0> rotate<0,-Segment_Angle,0> }// end of box #if (Segment_Angle >= 180) } // end of union #end // end of union, if union is used! #if (Negativ_Flag = 0) rotate<0,-Segment_Angle,0> scale<-1,1,-1> #end // of "#if (Negativ_Flag = 0)" ------------ #end // of "#if (Segment_Angle > 0)" ------------ } // end of intersection #end // --------- end of macro Segment_of_CylinderRing()```