/* Tracé approché de la surface minimale de Schwarz D, le quadrilatère de base étant une partie de paraboloïde hyperbolique La surface obtenue est très lissée car on utilise des smooth_triangles Alain Esculier - Janvier 2011 */ #include "colors.inc" #include "transforms.inc" camera { orthographic location <-0,0,-20> look_at<0,-0.,0> right 4/3*x angle 15 rotate 2*y} // } // light_source { <-8,20,-20> color White } // spotlight radius 20 falloff 30 point_at <4,2,2>} light_source { <10,15,-30> color White shadowless} light_source { <8,-20,-15>*4 color <1,0.9,0.4> shadowless} background{Black} //================ textures =================== #declare T_pierre2= texture{ pigment{ crackle color_map{[0.0 rgb<1,1,0.7>][1.0 rgb<0.5,0.3,0>] } scale 0.1 } normal{ crackle 1 turbulence 0.5 scale 0.01 accuracy 0.5} finish {ambient 0.4 diffuse 0.25 reflection 0.1 phong 0.8 phong_size 200 } }; #declare T_pierre1= texture{ pigment{ crackle color_map{[0.0 rgb<0.7,1,1>][1.0 rgb<0,0.5,0.3>] } scale 0.1 } normal{ crackle 1 turbulence 0.5 scale 0.01 accuracy 0.5} finish {ambient 0.4 diffuse 0.25 reflection 0.1 phong 0.8 phong_size 200 } }; //=================================== #macro mm(uu,vv) <1/2*vv-1/2, 1/2*uu-1/2, -1/2*uu*vv+1/2 > #end //--------------- dM/duu ------------- #macro dmu(uu,vv) <0 , 1/2 , -vv/2 > #end //--------------- dM/dvv ------------- #macro dmv(uu,vv) < 1/2 , 0 , -uu/2> #end #declare prec1=10; //10 // ---------------------------------------- #declare base0= union{ // methode math #local umin = 0.; #local umax = 1; #local vmin =0; #local vmax = 1; #local uiter = prec1; #local viter = prec1; #local iu = (umax-umin)/uiter ; #local iv = (vmax-vmin)/viter; #local uu = umin; #while (uu+iu<=umax) //boucle externe #local vv = vmin; #while (vv+iv<=vmax) //boucle interne //POINTS #local m1=mm(uu,vv); #local n1=vcross(dmu(uu,vv),dmv(uu,vv)); #local uu=uu+iu; #local m2=mm(uu,vv); #local n2=vcross(dmu(uu,vv),dmv(uu,vv)); #local vv=vv+iv ; #local m3=mm(uu,vv); #local n3=vcross(dmu(uu,vv),dmv(uu,vv)); #local uu=uu-iu ; #local m4=mm(uu,vv); #local n4=vcross(dmu(uu,vv),dmv(uu,vv)); #local vv=vv-iv; //TRIANGLES smooth_triangle{ m1,n1, m2,n2, m3,n3 } smooth_triangle{ m1, n1, m3, n3 m4, n4 } #local vv = vv+iv; #end // fin boucle interne #local uu = uu+iu ; #end } ; // ---------------------------------------- #declare prec2=40; // 40; #declare base1h= union{ // methode math #local n=prec2; #local pmin = 0.; #local pmax = 1; #local iu = (pmax-pmin)/n ; #local iv = (pmax-pmin)/n; #local uu = pmin; #while (uu+iu<=pmax) //boucle externe #local vv = 0; #while (vv+iv<=pmax-uu) //boucle interne //POINTS #local m1=mm(uu,vv); #local n1=vcross(dmu(uu,vv),dmv(uu,vv)); #local uu=uu+iu; #local m2=mm(uu,vv); #local n2=vcross(dmu(uu,vv),dmv(uu,vv)); #local vv=vv+iv ; #local m3=mm(uu,vv); #local n3=vcross(dmu(uu,vv),dmv(uu,vv)); #local uu=uu-iu ; #local m4=mm(uu,vv); #local n4=vcross(dmu(uu,vv),dmv(uu,vv)); #local vv=vv-iv; //TRIANGLES smooth_triangle{ m1,n1, m2,n2, m3,n3 } smooth_triangle{ m1, n1, m3, n3 m4, n4 } #local vv = vv+iv; #end // fin boucle interne #local uu = uu+iu ; #end } ; #declare base1b= union{ // methode math #local n=prec2; #local pmin = 0.; #local pmax = 1; #local iu = (pmax-pmin)/n ; #local iv = (pmax-pmin)/n; #local uu = pmin; #while (uu+iu<=pmax) //boucle externe #local vv =pmax-uu-iv; #while (vv+iv<=pmax) //boucle interne //POINTS #local m1=mm(uu,vv); #local n1=vcross(dmu(uu,vv),dmv(uu,vv)); #local uu=uu+iu; #local m2=mm(uu,vv); #local n2=vcross(dmu(uu,vv),dmv(uu,vv)); #local vv=vv+iv ; #local m3=mm(uu,vv); #local n3=vcross(dmu(uu,vv),dmv(uu,vv)); #local uu=uu-iu ; #local m4=mm(uu,vv); #local n4=vcross(dmu(uu,vv),dmv(uu,vv)); #local vv=vv-iv; //TRIANGLES smooth_triangle{ m1,n1, m2,n2, m3,n3 } smooth_triangle{ m1, n1, m3, n3 m4, n4 } #local vv = vv+iv; #end // fin boucle interne #local uu = uu+iu ; #end } ; // ################### FAIRE r=0 POUR ELIMINER LES BORDS DANS LES TRACES ################### #declare r=0.015; // 0; // #declare bordsbase=union{ cylinder{mm(0,0), mm(0,1),r} cylinder{mm(0,1), mm(1,1),r} cylinder{mm(1,1), mm(1,0),r} cylinder{mm(1,0), mm(0,0),r} sphere{mm(0,0),r} sphere{mm(0,1),r} sphere{mm(1,1),r} sphere{mm(1,0),r} pigment{rgb <0,0.7,0>} finish {ambient 0.4 diffuse 0.2 reflection 0.1 phong 0.8 phong_size 150 } }; #declare symXY=Shear_Trans(<1,0,0>,<0,1,0>,<0,0,-1>); #declare symZX=Shear_Trans(<1,0,0>,<0,-1,0>,<0,0,1>); #macro base(tex) union{ object{ base0 texture{tex}} object{bordsbase}} #end // T_pierre1 #macro basesym(tex) object{base0 Axis_Rotate_Trans(<0,-1,1>, 180) texture{tex} } #end // T_pierre2 #macro hexa(t1,t2) union{ object{base(t1) Axis_Rotate_Trans(<1,1,1>, 240)} object{base(t1)} object{base(t1) Axis_Rotate_Trans(<1,1,1>, 120)} object{basesym(t2)} object{basesym(t2) Axis_Rotate_Trans(<1,1,1>, 120)} object{basesym(t2) Axis_Rotate_Trans(<1,1,1>, 240)} // object{basesym} translate <1/2,1/2,1/2> } #end #macro cellule(t1,t2) union{ object{hexa(t1,t2)} object{hexa(t1,t2) rotate 180*y} object{hexa(t1,t2) Shear_Trans(<1,0,0>,<0,-1,0>,<0,0,1>) rotate 90*y} object{hexa(t1,t2) Shear_Trans(<1,0,0>,<0,-1,0>,<0,0,1>) rotate -90*y} } #end #macro motif(t1,t2) union{ object{cellule(t1,t2) } object{cellule(t1,t2) rotate 90*y translate <1,1,-1> } object{cellule(t1,t2) rotate 90*y translate <-1,1,1> } object{cellule(t1,t2) rotate 90*y translate <1,-1,1> } object{cellule(t1,t2) rotate 90*y translate <-1,-1,-1> } /**/ } #end /**/ #macro motif1(t1,t2) difference{object{ motif(t1,t2)} sphere{0,1.135 inverse}} #end //--------------- autre cellule ----------------- #macro baseh(tex) object{ base1h Axis_Rotate_Trans(<0,-1,1>, 180) texture{tex}} #end // T_pierre2 #macro baseb(tex) object{ base1b Axis_Rotate_Trans(<0,-1,1>, 180) texture{tex}} #end // T_pierre2 #macro hexatr(t1,t2) union{ object{base(t1) Axis_Rotate_Trans(<1,1,1>, 240)} object{base(t1)} object{base(t1) Axis_Rotate_Trans(<1,1,1>, 120)} object{baseb(t2)} object{baseb(t2) Axis_Rotate_Trans(<1,1,1>, 120)} object{baseb(t2) Axis_Rotate_Trans(<1,1,1>, 240)} // object{basesym} translate <1/2,1/2,1/2> } #end #macro celluletr(t1,t2) union{ object{hexatr(t1,t2)} object{hexatr(t1,t2) rotate 180*y} object{hexatr(t1,t2) Shear_Trans(<1,0,0>,<0,-1,0>,<0,0,1>) rotate 90*y} object{hexatr(t1,t2) Shear_Trans(<1,0,0>,<0,-1,0>,<0,0,1>) rotate -90*y} } #end #macro demihaut(tex) object{baseh(tex) rotate 90*y translate <-1/2,1.5,1/2> } #end #macro demibas(tex) object{baseh(tex) Shear_Trans(<1,0,0>,<0,-1,0>,<0,0,1>) rotate 180*y translate <1/2,-3/2,1/2>} #end #macro newcellule(t1,t2) union{ object{celluletr(t1,t2)} object{demihaut(t2)} object{demihaut(t2) Axis_Rotate_Trans(<-1,1,1>, 120) } object{demihaut(t2) Axis_Rotate_Trans(<-1,1,1>, 240) } object{demihaut(t2) rotate 180*y} object{demihaut(t2) rotate 180*y Axis_Rotate_Trans(<1,1,-1>, 120) } object{demihaut(t2) rotate 180*y Axis_Rotate_Trans(<1,1,-1>, 240) } object{demibas(t2) } object{demibas(t2) Axis_Rotate_Trans(<1,-1,1>, 120) } object{demibas(t2) Axis_Rotate_Trans(<1,-1,1>, 240) } object{demibas(t2) rotate 180*y } object{demibas(t2) rotate 180*y Axis_Rotate_Trans(<-1,-1,-1>, 120) } object{demibas(t2) rotate 180*y Axis_Rotate_Trans(<-1,-1,-1>, 240) } }#end #macro big_cell(t1,t2, avechaut,avecbas) union{ // object{axes scale 2} object{newcellule(t1,t2) } object{newcellule(t1,t2) Axis_Rotate_Trans(<1,-1,0>, 180) translate <1,1,-1> } #if(avechaut= 0) object{newcellule(t1,t2) Axis_Rotate_Trans(<0,1,1>, 180) translate <-1,1,1> } #end object{newcellule(t1,t2) Axis_Rotate_Trans(<0,1,1>, 180) translate <1,-1,1> } #if(avecbas= 0) object{newcellule(t1,t2) Axis_Rotate_Trans(<0,1,1>, 180) translate <-1,-1,-1> } #end } #end #macro rangees(t1,t2) union{ object{big_cell(t1,t1,0,0) } object{big_cell(t1,t2,0,0) rotate 90*y translate <1,3,1>} object{big_cell(t1,t2,1,0) rotate 90*y translate <-1,3,-1>} // object{big_cell(t1,t2,0,1) translate <2,0,2>} object{big_cell(t1,t2,0,1) rotate 180*y translate <-2,0,-2>} // object{big_cell(t2,t2,0,0) rotate 90*y translate <-1,-1,3>} //object{big_cell(t2,t2,0,0) rotate 90*y translate <1,-1,-3>} /* */ // object{big_cell(t1,t2,0,0) translate <1,-3,-1>} // vers le bas } #end //------------------------------------------------ #declare sc=0.99; #macro p_newcellule(t1,t2) object{newcellule(t1,t2) scale sc } #end #macro p_big_cell(t1,t2, avechaut,avecbas) union{ // object{axes scale 2} object{p_newcellule(t1,t2) } object{p_newcellule(t1,t2) Axis_Rotate_Trans(<1,-1,0>, 180) translate <1,1,-1> } #if(avechaut= 0) object{p_newcellule(t1,t2) Axis_Rotate_Trans(<0,1,1>, 180) translate <-1,1,1> } #end object{p_newcellule(t1,t2) Axis_Rotate_Trans(<0,1,1>, 180) translate <1,-1,1> } #if(avecbas= 0) object{p_newcellule(t1,t2) Axis_Rotate_Trans(<0,1,1>, 180) translate <-1,-1,-1> } #end } #end #macro p_rangees(t1,t2) union{ object{p_big_cell(t1,t1,0,0) } object{p_big_cell(t1,t2,0,0) rotate 90*y translate <1,3,1>} object{p_big_cell(t1,t2,1,0) rotate 90*y translate <-1,3,-1>} object{p_big_cell(t1,t2,0,1) translate <2,0,2>} object{p_big_cell(t1,t2,0,1) rotate 180*y translate <-2,0,-2>} // // object{p_big_cell(t2,t2,0,0) rotate 90*y translate <-1,-1,3>} object{p_big_cell(t2,t2,0,0) rotate 90*y translate <1,-1,-3>}/* */ // object{p_big_cell(t1,t2,0,0) translate <1,-3,-1>} // vers le bas } #end // ################### FAIRE r=0 AU-DESSUS POUR ELIMINER LES BORDS DANS LES TRACES ################### //--------------- Traçages intérieur ou intérieur-extérieur ----------------- union{ object{rangees(T_pierre1,T_pierre2) } // l'exterieur( mettre la même texture si intérieur-extérieur ) // object{p_rangees(T_pierre1,T_pierre1) translate <0,-2,0> } // l'intérieur ( à enlever pour avoir lasurface seule scale 0.4 rotate 40*y rotate -22*x rotate -4*z translate <0.2,+0.,0> } /**/ /* //--------------- Traçage une cellule et les 4 voisines -------------------------------- union{ object{newcellule(T_pierre1,T_pierre2) } object{newcellule(T_pierre1,T_pierre2) Axis_Rotate_Trans(<1,-1,0>, 180) translate <1,1,-1> } object{newcellule(T_pierre1,T_pierre2) Axis_Rotate_Trans(<0,1,1>, 180) translate <-1,1,1> } object{newcellule(T_pierre1,T_pierre2) Axis_Rotate_Trans(<0,1,1>, 180) translate <1,-1,1> } object{newcellule(T_pierre1,T_pierre2) Axis_Rotate_Trans(<0,1,1>, 180) translate <-1,-1,-1> } scale 0.8 rotate 110*y } */