Geometrische Körper aus meiner Include-Datei "shapes3.inc"
( ehemals "shapes_lo.inc"):
Segment_of_Object
|
Syntax:
object{ Segment_of_Object( Mein_Object,
Segment_Angle
) //------------
texture{ ... ... }
scale<1,1,1>
rotate<0,0,0>
translate<0,0,0>
} // end of object ---------------- |
Mein_Object = ein beliebiges deklariertes Objekt,
Segment_Angle = Winkel des Segments, links-händig orientiert!
Beispiel:
#declare My_Test_Object =
difference{
sphere{ <0,0,0>, 2.75
texture{ pigment{ color rgb<0.5,1,0>}
finish { phong 1}
} // end of texture
} // end of sphere -------------------
sphere{ <0,0,0>, 2.25
texture{ pigment{ color rgb<1,0.6,0>}
finish { phong 1}
} // end of texture
} // end of sphere -------------------
cylinder{ <0,-3.5,0>,<0,3.5,0>, 1.5
texture{ pigment{ color rgb<1,1,1>}
finish { phong 0.5}
} // end of texture
} // end of cylinder ---------------
scale<1,0.6,1>
} // end of difference -----------------------
//--------------------------------------------
#include "shapes3.inc"
//--------------------------------------------
object{ Segment_of_Object(My_Test_Object,-235)
texture{ pigment{ color rgb<1,1,1>}
finish { phong 1}
} // end of texture
}
// ------------------------------------------- |
|
Ein anderes Beispiel:
|
The original object
|
Segment_Angle = 225
|
Das Makro im Detail:
Zur Technik des Ausschneidens mit 2 Quadern vergleiche die Erklärungen zu den vorherigen Makros.
Die Größe der Quader, die man hier zum Ausschneiden des Segmentes verwendet, werden hier
mittels der Funktionen "min_extent ( Object )" und
"max_extent ( Object )" automatisch bestimmt:
//-----------------------------Segment_of_Object macro()
#macro Segment_of_Object( SEgment_OBject, Segment_Angle)
#local D = 0.0001; // just a little bit
#if (Segment_Angle = 0)
#local Segment_Angle = D;
#end
#if (abs(Segment_Angle) >= 360)
#local Segment_Angle = mod (Segment_Angle, 360);
#end
#local O_min = min_extent ( SEgment_OBject );
#local O_max = max_extent ( SEgment_OBject );
#local O_max_x = max (O_min.x, O_max.x);
#local O_max_z = max (O_min.z, O_max.z);
#local R_max = 1.5*max(O_max_x,O_max_z);
#if (Segment_Angle > 0)
#local Box_z = R_max+D;
#else
#local Box_z = -R_max+D;
#end
intersection{
object{ SEgment_OBject }
#if (abs(Segment_Angle) >= 180)
union{
#end // then use union!
box{<-R_max+D,O_min.y-D,0>,<R_max+D,O_max.y+D,-Box_z>
}// end of box
box{<-R_max+D,O_min.y-D,Box_z>,<R_max+D,O_max.y+D,0>
rotate<0, Segment_Angle,0>
}// end of box
#if (abs(Segment_Angle) >= 180)
} // end of union
#end // end of union, if union is used!
} // end of intersection
#end // -------------- end of macro Segment_of_Object() |
|
|