// Vordefinierte Texturen, Festlegung der Kamera, Lichtquellen, Koordinatensystem u.a. // A. Filler, 2003 // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // Beschreibung der Kamera // --------------------------------------------------------------------------- camera { orthographic location <60*intervall*cos(winkel*pi/180), 20*intervall, 60*intervall*sin(winkel*pi/180)> right x*4/3*2.7*intervall up y*2.7*intervall look_at <0.0, -intervall/10, 0.0> } // --------------------------------------------------------------------------- // Lichtquellen // --------------------------------------------------------------------------- light_source { <2.5*intervall, 2*intervall, -5*intervall> color rgb <1, 1, 1> } light_source { <0,10*intervall,2*intervall> color rgb <1, 1, 1> } // --------------------------------------------------------------------------- // Definition von Materialien und Oberflächen (Texturen) // --------------------------------------------------------------------------- #include "colors.inc" #include "textures.inc" #include "stones1.inc" #include "metals.inc" #declare holz = DMFWood6 #declare stein = T_Stone9 #declare silber = T_Silver_4D #declare blau_matt = texture { pigment { color rgb < 0.3, 0.3, 1.0> } finish { ambient 0.2 diffuse 0.7 phong 0.2 phong_size 20 reflection 0 } } #declare blau_glanz = texture { pigment { color rgb < 0.1, 0.1, 1.0> } finish { ambient 0.05 diffuse 0.3 phong 0.4 phong_size 50 reflection 0.4 } } #declare rot_matt = texture { pigment { color rgb < 1, 0.2, 0.2> } finish { ambient 0.2 diffuse 0.7 phong 0.2 phong_size 20 reflection 0 } } #declare rot_glanz = texture { pigment { color rgb < 1, 0, 0> } finish { ambient 0.05 diffuse 0.3 phong 0.4 phong_size 50 reflection 0.4 } } #declare gruen_matt = texture { pigment { color rgb < 0.15, 1, 0.15> } finish { ambient 0.2 diffuse 0.7 phong 0.2 phong_size 20 reflection 0 } } #declare gruen_glanz = texture { pigment { color rgb < 0, 1, 0> } finish { ambient 0.05 diffuse 0.3 phong 0.4 phong_size 50 reflection 0.4 } } #declare mattweiss = texture { pigment { color rgb < 1, 1, 1> } finish { ambient 0.6 diffuse 0.4 phong 0 reflection 0 roughness 0.8 crand 0.03} } #declare schwarz = texture { pigment { color rgb < 0.1, 0.1, 0.1> } finish { ambient 0.7 diffuse 0.5 phong 0.05 phong_size 15 reflection 0 roughness 0.8 crand 0.1} } #declare silbergrau = texture { pigment { rgbt<0.3,0.3,0.3,0> } finish { ambient 0.0 diffuse 0.2 reflection 0.4 brilliance 1 specular 0.4 roughness 0.1 }}; #declare blau_transp = texture{ pigment{rgbf<0.4,0.4,1,0.4>} finish{ ambient 1.0 diffuse 0.8 phong 0 reflection 0.0} } #declare gruen_transp = texture{ pigment{rgbf<0.4,1,0.4,0.4>} finish{ ambient 1.0 diffuse 0.8 phong 0 reflection 0.0} } #declare rot_transp = texture{ pigment{rgbf<1,0.4,0.4,0.4>} finish{ ambient 1.0 diffuse 0.8 phong 0 reflection 0.0} } #declare schachbrett = texture { pigment { checker color rgb < 0.7, 0.7, 1 >, color rgb < 0.2, 0.2, 0.2 > } finish { ambient 1.0 brilliance 2 diffuse 0.7 metallic specular 0.90 roughness 1/20 phong 0.45 reflection 0 } scale intervall*0.5 } // --------------------------------------------------------------------------- // Objekte und Makros zur Analytischen Geometrie // --------------------------------------------------------------------------- // Bereitstellung einiger Texturen // --------------------------------------------------------------------------- #declare vektortextur = silbergrau; #declare Material_Strecke_blau = texture{ pigment{rgb<0.1,0.1,1>} finish{ambient 0.2 diffuse 0.3 phong 0.5 reflection 0.4} } // --------------------------------------------------------------------------- // Makro für die Darstellung von Ortsvektoren // --------------------------------------------------------------------------- #macro ortsvektor (V , textur) #declare vektorbetrag=sqrt(V.x*V.x+V.y*V.y+V.z*V.z); // Betrag des Vektors berechnen #declare PFEIL=union{ cylinder{<0,0,0> intervall/60} cone{ intervall/30 0 } texture {textur} no_shadow }; #declare NX=vnormalize(V); #declare NY=vnormalize(vcross(NX,z)); #declare NZ=vnormalize(vcross(NX,NY)); object {PFEIL matrix < NX.x , NX.y , NX.z , NY.x , NY.y , NY.z , NZ.x , NZ.y , NZ.z , 0 , 0 , 0 > } #end // --------------------------------------------------------------------------- // Makro für die Darstellung von Verbindungsvektoren zwischen zwei Punkten // --------------------------------------------------------------------------- #macro verbindungsvektor (P, Q , textur) #declare V=Q-P; #declare vektorbetrag=sqrt(V.x*V.x+V.y*V.y+V.z*V.z); // Betrag des Vektors berechnen #declare PFEIL=union{ cylinder{<0,0,0> intervall/60} cone{ intervall/30 0 } texture {textur} no_shadow } ; #declare NX=vnormalize(V); #declare NY=vnormalize(vcross(NX,z)); #declare NZ=vnormalize(vcross(NX,NY)); object {PFEIL matrix < NX.x , NX.y , NX.z , NY.x , NY.y , NY.z , NZ.x , NZ.y , NZ.z , P.x , P.y , P.z > } #end // --------------------------------------------------------------------------- // Makro für die Darstellung von Strecken // --------------------------------------------------------------------------- #macro strecke (P, Q , textur) #declare V=Q-P; #declare vektorbetrag=sqrt(V.x*V.x+V.y*V.y+V.z*V.z); // Länge der Strecke berechnen #declare Streckenzylinder=cylinder{<0,0,0> intervall/118 texture {textur} no_shadow }; #declare NX=vnormalize(V) ; #declare NY=vnormalize(vcross(NX,z)) ; #declare NZ=vnormalize(vcross(NX,NY)) ; object {Streckenzylinder matrix < NX.x , NX.y , NX.z , NY.x , NY.y , NY.z , NZ.x , NZ.y , NZ.z , P.x , P.y , P.z > } #end // --------------------------------------------------------------------------- // Makro für die Darstellung eines Koordinatensystems mit Achsenbezeichnungen // --------------------------------------------------------------------------- #macro koordinatensystem ( achsenlaenge ) #declare kstextur = texture { pigment { rgbf<0.1,0.1,0.2,0.5> } finish { ambient 0.0 diffuse 0.1 reflection 0.05 brilliance 1 specular 0.3 roughness 0.2 } } ; #declare KSFont="cyrvetic.ttf" ; #declare KSSchriftgroesse=achsenlaenge/5 ; union{ // x-Achse: cylinder{-x*1.15*achsenlaenge , x*achsenlaenge, achsenlaenge/120} cone{ x*1.15*achsenlaenge, 0 , x*achsenlaenge, achsenlaenge/48} // y-Achse: cylinder{-y*1.15*achsenlaenge , y*achsenlaenge, achsenlaenge/120} cone{ y*1.15*achsenlaenge, 0 , y*achsenlaenge, achsenlaenge/48} // z-Achse: cylinder{-z*1.15*achsenlaenge , z*achsenlaenge, achsenlaenge/120} cone{ z*1.15*achsenlaenge, 0 , z*achsenlaenge, achsenlaenge/48} // Achsenbezeichnungen: text{ttf KSFont "x",0.1,0 scale KSSchriftgroesse translate <1.08*achsenlaenge,-achsenlaenge/7,0>} text{ttf KSFont "y",0.1,0 scale KSSchriftgroesse translate <-achsenlaenge/8,1.04*achsenlaenge,0>} text{ttf KSFont "z",0.1,0 scale KSSchriftgroesse translate } texture {kstextur} no_shadow } #end #declare ks = koordinatensystem (intervall) // --------------------------------------------------------------------------- // Makro für die Erzeugung von Ebenen als "isosurface objects" aus einer Gleichung in drei Variablen // --------------------------------------------------------------------------- #macro ebenegl (A,B,C,D,textur) #undef fe_X #declare fe_X = function(x,y,z) { A*x + B*y + C*z + D } ; isosurface { function { fe_X(x,y,z) } contained_by { box { -0.9*intervall, 0.9*intervall } } // container shape //threshold 0.0 // optional threshold value for isosurface [0.0] accuracy 0.01 // accuracy of calculation [0.001] max_gradient 60 // maximum gradient the function can have [1.1] //evaluate 1, 1.2, 0.99 // evaluate the maximum gradient //max_trace 1 // maybe increase for use in CSG [1] //all_intersections // alternative open // remove visible container surface texture { textur } no_shadow } #end