/* /* Tracé approché de la surface minimale de Schwarz P, 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,4,-20> look_at<0,0,0> right 4/3*x angle 15 rotate 2.1*y } //} // light_source { <-5,20,-10> White shadowless } light_source { <10,20,-10> color White shadowless} light_source { <4,-20,-15> color Red*0.7 shadowless} background{Black} //=================================== #declare T_pierre= 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.01} finish {ambient 0.4 diffuse 0.2 reflection 0.2 roughness 0.0001 specular 0.7 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.01} finish {ambient 0.4 diffuse 0.2 reflection 0.2 roughness 0.0001 specular 0.7 phong 0.8 phong_size 200 } }; // axes ---------------------- #declare axes=union{ #declare g=1.8 ; #declare r1=0.025; #declare k=4;// longueur fleche=k*r1 #declare co=1.8;// rayon base=co*r1 union{ cylinder{ 0,,r1 } cone{ ,co*r1,,0 } pigment { Red } } //transmit 0.3 union{ cylinder{ 0,<0,g,0>,r1 } cone{ <0,g,0>,co*r1,<0,g+k*r1,0>,0 } pigment { Green } } union{ cylinder{<0,0,0>,<0,0,g>,r1 } cone{ <0,0,g>,co*r1,<0,0,g+k*r1>,0 } pigment {Blue } } }; //=================================== //------------------------------------------- #macro mm(uu,vv) #end //--------------- dM/duu ------------- #macro dmu(uu,vv) <-1 , vv , vv-1 > #end //--------------- dM/dvv ------------- #macro dmv(uu,vv) < 1 , uu , uu -1> #end // ---------------------------------------- #declare base= union{ // methode math #local umin = 0.; #local umax = 1; #local vmin =0; #local vmax = 1; #local uiter = 40; #local viter = 40; #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 } ; // ---------------------------------------- #macro base1(umin,umax) union{ // methode math #local vmin =0; #local vmax = 1; #local uiter = 40; #local viter = 40; #local iu = (umax-umin)/uiter ; #local iv = (vmax-vmin)/viter; #local uu = umin; #while (uu+iu<=umax) //boucle externe #local vv = uu; // -iu #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 } #end // ---------------------------------------- #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>); #declare r=0.015; // 0; // //--- bords ---- #declare b1= 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,0),r} sphere{mm(1,1),r} translate <0,1,1> }; #macro be(tex) union{ object{base translate <0,1,1> texture{ tex } } object{b1 pigment{rgb <0,0.8,0>} finish {ambient 0.4 diffuse 0.25 reflection 0.2 phong 0.8 phong_size 150 }}} #end //--- patchs verticaux --- #macro be1(tex) object{base1(0,1) translate <0,1,1> rotate-90*z Shear_Trans(<1,0,0>,<0,1,0>,<0,0,-1>) translate <-2,2,2> texture{ tex }} #end #macro beV(tex) object{base translate <0,1,1> rotate-90*z Shear_Trans(<1,0,0>,<0,1,0>,<0,0,-1>) translate <-2,2,2> texture{ tex }} #end //--- 4 patchs horizontaux en couronne ---- #macro couronne1(tex1,tex2) union{ object{ be(tex1)} object{ be(tex1) rotate 90*y} object{ be(tex1) rotate 180*y} object{ be(tex1) rotate -90*y} } #end //--- couronne incomplete --- #macro couronne1a(tex1,tex2) union{ object{ be(tex1) rotate 90*y} object{ be(tex1) rotate 180*y} object{ be(tex1) rotate -90*y} } #end //--- 4 demi-patchs verticaux aux en couronne ---- #macro couronne2(tex1,tex2) union{ object{ be1(tex2)} object{ be1(tex2) rotate 90*y} object{be1(tex2) rotate 180*y} object{ be1(tex2) rotate 270*y} } #end //--- 4 patchs verticaux aux en couronne ---- #macro couronne1V(tex1,tex2) union{ object{ beV(tex2)} object{ beV(tex2) rotate 90*y} object{beV(tex2) rotate 180*y} object{ beV(tex2) rotate 270*y} } #end #macro couronne2V(tex1,tex2) union{ object{ be2V(tex2)} object{ be2V(tex2) rotate 90*y} object{be2V(tex2) rotate 180*y} object{ be2V(tex2) rotate 270*y} } #end //-------------- cellule cubique --------- #macro cellcube(tex2,tex1) union{ object{ couronne1(tex1,tex2) } object{ couronne1V (tex1,tex2) } object{ couronne1(tex1,tex2) Shear_Trans(<1,0,0>,<0,-1,0>,<0,0,1>) translate 4*y} } #end //-------------- cellules étoilées --------- #macro cellule(tex2,tex1) union{ //object{ axes} object{ couronne2(tex1,tex2)} object{ couronne2(tex1,tex2) rotate 90*x } object{ couronne2(tex1,tex2) rotate 180*x } object{ couronne2(tex1,tex2) rotate 270*x } object{ couronne1a(tex1,tex2)} object{ couronne1a(tex1,tex2) rotate 90*x } object{ couronne1a(tex1,tex2) rotate 180*x } object{ couronne1a(tex1,tex2) rotate 270*x } object{ couronne2(tex1,tex2) rotate -90*y rotate 90*z } object{ couronne2(tex1,tex2) rotate -90*y rotate -90*z } } #end #macro p_cellule(tex2,tex1) object{cellule(tex2,tex1) scale 0.99} #end //--------------- COUCHES-------------------------- #macro couches(p,q,r,tex2,tex1) //******si taille =1 cellules normales sinon petites ******** union{ #local cx=0 ; #while(cx<=p) #local cy=0 ; #while(cy<=q) #local cz=0; #while(cz<=r) #if(mod(cx,2)=1) object{cellule(tex2,tex1) translate <4*cx,2*cy,4*cz>} #else object{cellule(tex2,tex1) translate <4*cx,2*cy,4*cz>} #end #local cz=cz+1; #end #local cy=cy+1; #end #local cx=cx+1; #end } #end #macro couchescube(p,q,r,tex2,tex1) //******si taille =1 cellules normales sinon petites ******** union{ #local cx=0 ; #while(cx<=p) #local cy=0 ; #while(cy<=q) #local cz=0; #while(cz<=r) #if( mod(cy,2)=0 ) object{cellcube(tex2,tex1) translate <4*cx,2*cy,4*cz>} #else object{cellcube(tex1,tex2) translate <-2+4*cx,2*cy,-2+4*cz>} #end #local cz=cz+1; #end #local cy=cy+1; #end #local cx=cx+1; #end } #end #declare T1=texture{ T_Glass3 pigment{rgb <1,0.7,0.7> } finish {ambient 0.4 diffuse 0.25 reflection 0.2 phong 0.8 phong_size 150 } } #declare T2=texture{ T_Glass3 pigment{Yellow } finish {ambient 0.4 diffuse 0.25 reflection 0.2 phong 0.8 phong_size 150 } } //--------------- Traçage ----------------- //============= cellule cube comme Duarte pour Ferreol =========================== union{ //object{axes} object{ couchescube(0,0,0,T_pierre,T_pierre1) } scale 1.2 rotate <-5,95,-4> translate <0,-2.4,0> } //============= couches de cellule etoile =========================== /*union{ object{ couches(1,1,1,T_pierre,T_pierre,1) } object{ couches(1,1,1,T_pierre1,T_pierre1,0) translate <2,2,2> } translate -3*<1,1,1> scale 0.33 rotate <-0,10,0> } */