Geometrische Körper aus meiner Include-Datei "shapes3.inc"
( ehemals "shapes_lo.inc"):
Here some variations of that macro:
|
Ring_Sphere, Kugel aus Ringen
Syntax:
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
= Hauptradius der horizontalen und vertikalen Ringe,
Rmin_H, Rmin_V
= Nebenradius der horizontalen und vertikalen Ringe,
Number_of_Rings_horizontal
= Anzahl der horizontalen Ringe,
Number_of_Rings_vertical
= Anzahl der vertikalen Ringe.
Beispiel:
#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(1.00, 1.02, 0.005, 0.005, 32, 46)" |
"Ring_Sphere(1.03, 1.00, 0.015, 0.005, 30, 15)" |
Das Makro im Detail:
Zwei while-Schleifen von Ringen, deren Radien mittels der Kosinus-Funktion berechnet werden:
//---------------------------- 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() |
|
|