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

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

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

Ring_Sphere

Ring_Sphere


   Ring Sphere
 
general syntax:
object{ Ring_Sphere (Rmaj_H, Rmaj_V, Rmin_H, Rmin_V,
                     Number_of_Rings_horizontal,
                     Number_of_Rings_vertical)
        texture{ ... ... }
      } // end of object ------------------------
What to fill in:
Rmaj_H, Rmaj_V = major radius of the horizontal and vertical rings,
Rmin_H, Rmin_V = minor radius of the horizontal and vertical rings and
Number_of_Rings_horizontal, Number_of_Rings_vertical.
Sample:
#include "shapes_lo.inc"
object{Ring_Sphere  (1.00, 1.02, 0.025, 0.025, 12, 16)
        texture { pigment{color  <1,1,1>}
                  finish {ambient 0.1 diffuse 0.7
                          phong 1 reflection 0.25}
                } // end of texture
        scale <1,1,1>
        rotate <-20,0,-7>
        translate <0,1.00,0>
      } // end of object ------------------------------------ 


Macro in detail

Two while loops of rings, each radius is calculated by cos function:

//-----------------------------------------------  macro Ring_Sphere(...)
#macro Ring_Sphere (Rmaj_H, Rmaj_V, Rmin_H, Rmin_V,
                    Number_of_Rings_horizontal, Number_of_Rings_vertical)
#if (Rmin_H > 0)
#declare RingsH1 =
union{
#declare AngleD = 180/ Number_of_Rings_horizontal;
#declare Nr = -90+AngleD; #declare EndNr = 90;

#while (Nr < EndNr)
 #declare RingR = Rmaj_H*cos(radians(Nr));
 #declare RingH = Rmaj_H*sin(radians(Nr));
 torus{RingR,Rmin_H
       translate<0, RingH,0>}
#declare Nr = Nr + AngleD;
#end // --------------- end of loop
#declare LastR= RingR;
}//-----------------
#end // of "#if (Rmin_H > 0)"

#if (Rmin_V > 0)
#declare RingsV1 =          // vertical
union{
#declare Nr = 0; #declare EndNr = Number_of_Rings_vertical
#while (Nr < EndNr)
 torus{Rmaj_V-Rmin_V,Rmin_V
       rotate<90,0,0>
       rotate<0, Nr*360/EndNr,0>}
#declare Nr = Nr + 1;
#end // --------------- end of loop
}//---------------------------------
#end // of "#if (Rmin_V > 0)"

union{ #if (Rmin_H > 0) object{ RingsH1} #end
       #if (Rmin_V > 0) object{ RingsV1} #end
       sphere{<0, Rmaj_H,0>,Rmin_H}
       sphere{<0,-Rmaj_H,0>,Rmin_H}
      }
#end //--------------------------------  end of macro Ring_Sphere(...)

Here some variations of that macro:
 
Ring_Sphere
Ring_Sphere
"Ring_Sphere(1.00, 1.02, 0.005, 0.005, 32, 46)" "Ring_Sphere(1.03, 1.00, 0.015, 0.005, 30, 15)"





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

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