#version 3.7; global_settings { assumed_gamma 2.} #include "colors.inc" #include "metals.inc" #include "glass.inc" light_source { <-10, 20,-30> color White } light_source { <10, 15, -20> color White shadowless } light_source { <10, -30, -20> color Coral shadowless } background{ Black } // rgb<.6,.6,.65>*1.4} // White} // // camera{ location < 0, 0,-20> look_at < 0, 0, 0> right 16/9 *x rotate -2*y // } //==================================================================================================== //================================= #declare axes= union{ #local g=1.8 ; #local r1=0.025; #local k=4;// longueur fleche=k*r1 #local 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 } } }; //================================= //----------- texture verre ---------------- #declare T_Verre= texture{ T_Glass3 pigment{ Red transmit 0.4} finish {ambient 0.4 diffuse 0.5 roughness 0.000001 } }; //----------- texture verre brouillé ---------------- #declare T_VerreBrouille= texture{ T_Glass3 pigment{ Aquamarine transmit 0.7} // White transmit 0.8} normal{ bumps 1 noise_generator 3 accuracy 0.2} scale 0.01 finish {ambient 0.2 diffuse 0.7 roughness 0.001 phong 0.7 phong_size 20 } }; //----------- texture rouge brillant ---------------- #macro T_CoulBrillante(coul,tr) texture { pigment {coul transmit tr } finish { phong 1.0 phong_size 10 ambient 0.2 diffuse 0.8 reflection 0. }} #end //----------- texture zinc ---------------- #declare T_Zinc = texture{ T_Gold_3D normal { agate 0.5 // crackle //granite 1 turbulence 0.8 scale 0.2 accuracy 0.006 } finish {ambient 0.3 diffuse 0.5 reflection 0.2 specular 0.8 roughness 0.0001} }; //----------- texture acier ---------------- #declare T_Acier = texture { T_Glass3 // pigment { Cyan*0.5 transmit 0.3 } // Blue*0.5 transmit 0.3 } // Aquamarinel*0.5 transmit 0.3 } // Coral*0.5 transmit 0.3 } // color <1,1,1>*0.4 } pigment { color <0.9,0.95,1>*0.4 } finish { ambient 0.1 reflection 0.2 roughness 0.000002 diffuse 0.8 phong 0.6 phong_size 20.0 } }; #declare monfinish=finish{ ambient 0.3 diffuse 0.6 reflection 0. roughness 0.01 phong 0.6 phong_size 10}; #macro tex(col,trans) texture{ T_Glass3 pigment{col transmit trans } finish {ambient 0.1 diffuse 0.5 reflection 0.2 roughness 0.0001 phong 0.7 phong_size 10 } } #end //==================================================================================================== #declare a=2; #macro pt(uu,vv) //--------- équation 2 --------------------- #local xx= 2*(cos(uu)+uu*sin(uu))*cosh(vv)/(uu*uu+pow(cosh(vv),2)); #local yy= 2*(sin(uu)-uu*cos(uu))*cosh(vv)/(uu*uu+pow(cosh(vv),2)); #local zz= vv-sinh(2*vv)/(uu*uu+pow(cosh(vv),2)); //--------- équation 1 --------------------- /* #local xx= a*(cos(uu)+uu*sin(uu))*sin(vv)/(1+uu*uu*sin(vv)*sin(vv)); #local yy= a*(sin(uu)-uu*cos(uu))*sin(vv)/(1+uu*uu*sin(vv)*sin(vv)); #local zz=a/2*ln(tan(vv/2))+a*cos(vv)/(1+uu*uu*sin(vv)*sin(vv)); */ /* surface kuen forme non classique : mettre avec les 3 lignes précédentes #if(vv >0 & vv/2 < pi/2) #local zz=a/2*log(tan(vv/2))+2*cos(vv)/(1+uu*uu*sin(vv)*sin(vv)); #else #if(vv<=0) #local zz=a/2*ln(tan(keps/2))+a*cos(vv)/(1+uu*uu*sin(vv)*sin(vv)); #else #local zz=a/2*ln(tan(pi/2-keps/2))+a*cos(vv)/(1+uu*uu*sin(vv)*sin(vv)); #end #end */ #end //================== macro ============= #macro surf(umin,umax,vmin,vmax,uiter,viter) union{ #local iu=(umax-umin)/uiter; #local iv=(vmax-vmin)/viter; #for(m,0,uiter-1,1) //boucle sur uu #local uu = umin+m*iu; #for(n,1,viter-2,1) //boucle sur vv #local vv = vmin+n*iv; #local p1=pt(uu,vv); #local uu=uu+iu; #local p2=pt(uu,vv); #local vv=vv+iv ; #local p3=pt(uu,vv); #local uu=uu-iu ; #local p4=pt(uu,vv); #local vv=vv-iv; //Calcul des normales #local cf=2; // 2 initialement #local uu=uu+cf*iu ; #local k1=pt(uu,vv); #local uu=uu-cf*iu ; #local vv=vv+cf*iv; #local k2=pt(uu,vv); #local vv=vv-cf*iv ; #local uu=uu-cf/2*iu ; #local k3=pt(uu,vv); #local uu=uu+cf/2*iu; #local vv=vv-cf/2*iv ; #local k4=pt(uu,vv); #local vv=vv+cf/2*iv; #local n1=vcross(k2-p4,k1-p2); #local n2=vcross(p4-p3,k2-p4); #local n3=vcross(k3-p1,k2-p4); #local n4=vcross(p3-p2,k1-p2); #local n5=vcross(p1-p2,p3-p2); #local n6=vcross(k3-p1,p4-p1) ; #local n7=vcross(k1-p2,k4-p1); #local n8=vcross(k4-p1,p1-p2) ; #local n9=vcross(k4-p1,k3-p1); //TRIANGLES object{ smooth_triangle{ p1,n5+n6+n8+n9, p2,n4+n5+n7+n8, p3,n1+n2+n4+n5 } } object{ smooth_triangle{ p1, n5+n6+n8+n9, p3, n1+n2+n4+n5 p4, n2+n3+n5+n6 } } // #local vv = vv+iv; #end // fin boucle vv #end //fin boucle uu } //--- fin union #end //--- fin de la macro surf //==================================== #declare uusteps =350; //**Nombre de pas u #declare vvsteps =200; //**Nombre de pas v steps #declare keps= 0.015; // ----- équation 1 ----------- /*#declare umin =-1.43*pi; #declare umax =1.43*pi; #declare vmin =keps; #declare vmax = pi-keps; */ // ----- équation 2 ----------- #declare umin =-1.43*pi; #declare umax =1.43*pi; #declare vmin =-4.8; #declare vmax = 4.6; //------------------------------------------------------- #macro generatrices(M ,N,npas,r,colu,colv) union{ /* // -------------- equ. 1 ------------ // #declare rectif= 0.0074; #declare vmin =keps+rectif; // #declare vmax = pi-keps-rectif; */ union{ #for(i,0,M-1) #local pasGu=(umax-umin)/M; #for(j,0,npas-1) #local pasv=(vmax-vmin)/npas; cylinder{ pt(umin+i*pasGu,vmin+j*pasv), pt(umin+i*pasGu,vmin+(j+1)*pasv),r } sphere{ pt(umin+i*pasGu,vmin+j*pasv),r } #end #end tex(colu,0) /* // ------ equ. 1 ------------ //#declare vmin =keps-rectif; #declare vmax = pi-keps+rectif; ---- */ } union{ #for(j,0,N-1) #local pasGv=(vmax-vmin)/N; #for(i,1,npas-2) #local pasu=(umax-umin)/npas; cylinder{pt(umin+i*pasu,vmin+j*pasGv), pt(umin+(i+1)*pasu,vmin+j*pasGv),r} sphere {pt(umin+i*pasu,vmin+j*pasGv),r} #end #end tex(colv,0) } /**/ } #end //==================================== /* #declare lasurf= union{ object{ surf(umin,umax,vmin,vmax, uusteps, vvsteps) tex( Red,0.42) // } }; */ #declare tabcol=array[2]{Coral*0.95,Aquamarine*0.8}; // [3] {Blue*1.2,White,Red}; // mettre tabcol[mod(i,3)],0) // [2]{Gold*0.8,Aquamarine*0.5}; // union{ #local M=31; #local N=50; #local nb=vvsteps; #local r=0.007; /* object{ generatrices(M ,N,nb,r,Green*0.5,Red) } //----------- surface unie --------- object{ lasurf } */ //----------- surface en bandes-coordonnées --------- #declare pasGu=(umax-umin)/M; #for(i,0,M-1) object{ surf(umin+i*pasGu,umin+(i+1)*pasGu,vmin,vmax, 20, vvsteps ) T_CoulBrillante(tabcol[mod(i,2)],0) } //tex(tabcol[mod(i,2)],0) } // // #end scale 6.4 // 6.5 rotate 100*y rotate -15*x rotate 0*z translate <-2,0,0> } text { ttf "times.ttf" "AE" 0.3,0 pigment {White*0.8} scale 0.3 rotate <-5,5,0> translate <0.85,-0.7,-1>*7 finish{ ambient 0.2 diffuse 0.3} }