/* -------------------------- Entry: 0033 WWW: Title: Sierpinski Lens Author: Instead of generating the Sierpinski triangle by storing an array of midpoints and other complicated nonsense, I just gave each sub-triangle half the circumscribed radius of the previous one, and moved its position as the function of an angle. ---------------------------*/ camera{location -z*4 angle 60 right x up y rotate<0,0,-30>} global_settings{max_trace_level 30} sky_sphere { pigment { mandel 500 color_map{[0 color rgb<1,1,1>][.15 color rgb<.3,.7,1>][.3 color rgb<.2,.2,.5>][1 color rgb<.5,.8,1>]} translate translate <-.024,-.015,0> translate<-.0002,-.002,0> rotate<0,0,-18> scale 30 } } light_source{<30,30,-20> color rgb 1} #declare mat2= material{ texture{ pigment{ color rgbf<.9,.99,.8,1> } finish{ phong .9 phong_size 200 ambient 1 reflection {.01,.3} conserve_energy } } interior{ior 1.05} } #macro tri(a,b,r,i) intersection{ sphere{,r} prism { linear_sweep linear_spline -100,100, 4, , , , } rotate<-90,0,60> translate<-.1,-.1,0> } #if(i>0) #local inew=i-1; #local rnew=r/2; tri(a+r*cos(radians(210)),b+r*sin(radians(210)),rnew,inew) tri(a-r*cos(radians(210)),b+r*sin(radians(210)),rnew,inew) tri(a,b+r,rnew,inew) #end #end #declare tris=object{ merge{ tri(0,0,1,5) material{mat2} } } object{tris}