// Intersection de cylindres de révolution #include "colors.inc" #include "glass.inc" camera { orthographic location <5,2,-10> // look_at <0,-0.5,0>} light_source {<-5,12,-25> White*0.7 } light_source {<6,8,-25> White*0.95 shadowless } #declare eps=0.03; //--------- cylindres ------------- #macro cyl_cyl(r1,r2,beta) #declare baseext1=cylinder { <0,-2,0>,<0,2,0>,r1}; #declare baseint1=cylinder { <0,-2-0.0001,0>,<0,2+0.0001,0>,r1-eps}; #declare baseext2=cylinder { <-2,0,0>,<2,0,0>,r2 rotate z*beta}; #declare baseint2=cylinder { <-2-0.0001,0,0>,<2+0.0001,0,0>,r2-eps rotate z*beta}; #declare ext1=difference{ object{ baseext1} object{ baseint1} clipped_by {object { baseext2 inverse} } }; #declare ext2=difference{ object{ baseext2} object{ baseint2} clipped_by {object { baseext1 inverse} } }; #declare mil1= object { baseext1 clipped_by { baseext2} } ; #declare mil2= object {baseext2 clipped_by { baseext1 } }; union{ union { object { mil1 pigment { rgb <1,0.1,0.1>*1.3} finish {ambient 0.1 reflection 0.3 specular 0.5 } } object { mil2 pigment { rgb <1,1,0>*1.2} finish {ambient 0.1 reflection 0.3} } } // partie transparente union { object {ext1} object {ext2 } texture { T_Glass3 } interior { ior Crown_Glass_Ior}//ior Air_Ior } finish { ambient 0.1 reflection 0.08 specular 0.2 } } rotate <0,0,0> } // fin union #end //----------------- cônes-cylindres ------------------- #macro cone_cyl(Rcyl,beta,scaley,tx,ty,tz) #declare coneext=union { cone {<0,-3,0>,1.5,<0,0,0>,0} } // cone {<0,3,0>,1.5,<0,0,0>,0} } #declare coneint=union { cone {<0,-3-0.0001,0>,1.5-eps,<0,-eps,0>,0} } // cone {<0,4+0.0001,0>,2-eps,<0,eps,0>,0} } #declare cylext=cylinder { <-2,0,0>,<2,0,0>,Rcyl rotate z*beta scale y*scaley translate }; #declare cylint=cylinder { <-2,0,0>,<2,0,0>,Rcyl-eps rotate z*beta scale y*scaley translate }; #declare ext1=difference{ object{ coneext} object{ coneint} clipped_by {object { cylext inverse} } }; #declare ext2=difference{ object{ cylext} object{ cylint} clipped_by {object { coneext inverse} } }; #declare mil1= object { coneext clipped_by { cylext} } ; #declare mil2= object { cylext clipped_by { coneext } }; union{ union { object { mil1 pigment { rgb <1,0.1,0.1>*1.3} finish {ambient 0.1 reflection 0.3 specular 0.5 } } object { mil2 pigment { rgb <1,1,0>*1.2} finish {ambient 0.1 reflection 0.3} } } // partie transparente union { object {ext1} object {ext2 } texture { T_Glass3 } interior { ior Crown_Glass_Ior}//ior Air_Ior } finish { ambient 0.1 reflection 0.08 specular 0.2 } } rotate <0,0,0> } // fin union #end //-------------- affichage -------------------- union { object { cyl_cyl(1,0.95,-30) translate <-5,5.5,0> } object { cyl_cyl(1,1,10) translate <0,5.5,0> } object { cyl_cyl(0.95,1,-30) translate <5,5.5,0> } /* */ object { cone_cyl(0.75,0,1,0,-1.677050983,0) translate <-5,+1,1> // clipped_by { box{<-7,-4,-4>,<-3,5,4> }} rotate <0,-20,0> } object { cone_cyl(0.75,90,1,0.75,-1,0) rotate y*20 translate <0,1,-1> clipped_by { box{<-2,-4,-4>,<2,1.5,5> }} } object { cone_cyl(1,63.435,1,0.368,-1.5,0) translate <4.5,1,-2.6> clipped_by { box{<3,-2,-4>,<8,6,4> }} rotate <0,-20,0> } /* */ union { plane { z , 2 pigment{ PaleGreen*1.2}} box{<-10,-2.3,-3>,<10,-2.01,2> pigment{Copper*1.3 }} box{<-10,3.2,-1.5>,<10,3.5,2> pigment{ Copper*1.5 }} finish { ambient 0.2 diffuse 0.8 specular 0.8 } } translate -2.9*y rotate <0,-26.566,0> }