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

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

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

Facetted_Sphere

Facetted_Sphere


   Facetted Sphere
 
general syntax:
object{ Facetted_Sphere (Quarter_Meridian_Segments, Equatorial_Segments)
        texture{ ... ... }
      } // end of object ------------------------
With:
Quarter_Meridian_Segments = number of segments in one quarter of a meridian,
Equatorial_Segments = number of segments along the equator.
The radius of the outline is scaled to 1 unit.
Example:
#include "shapes_lo.inc"
object{ Facetted_Sphere (6, 16 )
        texture {pigment{color rgb <1,1,1>}
                 finish {ambient 0.08 diffuse 0.82 phong 0.1}
                }
        scale <1,1,1> rotate <0,0,0>
        translate < 0, 1, 0>
      } // end of object ------------------------------------ 


Macro in detail

This is realisized by an intersection of prisms with a sphere-like faccetted outline at one end:

Facetted_Sphere
Facetted_Sphere
Facetted_Sphere - 1 prism element of the intersection
Facetted_Sphere (6, 12 ) = intersection of 12 prism elements

// ---------------------------------------------------- macro Facetted_Sphere
#macro Facetted_Sphere (Quarter_Meridian_Segments, Equatorial_Segments)
     //Facettierte_Kugel (Viertelskreis_Teilung, Equatorial_Teilung)

#local Facets_Silhouette =
 prism {
   -2 ,2 ,
   2*Quarter_Meridian_Segments+4
   < -2,-1.00 >,

   #local Nr    = -Quarter_Meridian_Segments;
   #local EndNr =  Quarter_Meridian_Segments;
   #while (Nr < EndNr+1)
     #local Angle_degrees = Nr* 90/EndNr;
     #local Angle_radians = radians(Angle_degrees);
   < cos(Angle_radians) , sin(Angle_radians)>,

   #local Nr = Nr + 1 ;
   #end
   < -2, 1 >,
   < -2,-1 >

 rotate<-90,0,0> scale<1,1,-1> //turns prism in z direction!
 } // end of prism object ----------------------------------------

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

 object{ Facets_Silhouette rotate<0,Nr * 360/EndNr,0>}

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

} // end of intersection

#end // --------------------------- end of macro Facetted_Sphere(...)

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





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

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