Descrizioni ed esempi per il raytracer POV-Ray di Friedrich A. Lohmüller
Oggetti Geometrici di POV-Ray
English English English
Français français
Deutsch Deutsch

Home
- POV-Ray Tutorial
 
Oggetti Geometrici
  Indice

Oggetti 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

 
                                       
Questo oggetto è definito con una macro nel mio include file "shapes3.inc" ( precedentemente "shapes_lo.inc" ).
Ring_Sphere
Qui qualche variazione di questa macro:
Ring_Sphere
Ring_Sphere, una sfera d'anelli.
Sintassi generale:
object{ Ring_Sphere(
          Rmaj_H, Rmaj_V,
          Rmin_H, Rmin_V,
          Number_of_Rings_horizontal,
          Number_of_Rings_vertical
        ) //------------------------
        texture{ ... ... }
      } // end of object -----------
Rmaj_H, Rmaj_V
= raggio majore degli annelli orizzontali e verticali,
Rmin_H, Rmin_V
= raggio minore degli annelli orizzontali e verticali,
Number_of_Rings_horizontal
= il numero di annelli orizzontali,
Number_of_Rings_vertical
= il numero di annelli verticali.

Esempio:
#include "shapes3.inc"
object{Ring_Sphere
        (1.00,1.02, 0.025,0.025, 12, 16)
        texture{ pigment{color<1,1,1>}
                 finish{phong 1
                        reflection 0.25}
               } // end of texture
        scale <1,1,1>
        rotate <-20,0,-7>
        translate <0,1.00,0>
      } // end of object ---------------
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 nel dettaglio
Due while loops d'annelli, tutti i raggi sono calculati con la funzione coseno:
//----------------------------  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)&(Number_of_Rings_horizontal>0))
#declare RingsH1 =
union{
#local AngleD = 180/(Number_of_Rings_horizontal+1);
#local Nr = -90+AngleD; #local EndNr = 90;

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

#if((Rmin_V > 0) & (Number_of_Rings_vertical > 0))
#local RingsV1 =          // vertical
union{
#local 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>}
#local Nr = Nr + 1;
#end // --------------- end of loop
}//---------------------------------
#end // of "#if((Rmin_V>0)&(Number_of_Rings_vertical>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 of union
#end //---------- end of macro Ring_Sphere()

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