#include "colors.inc" #include "macros2.inc" #include "determchaos.inc" // Deterministic iterated fractals scene file // // Use determchaos.ini to render this scene file. Currently, sets 2, 3, 5 and // 6 are not set up to be rendered; the only valid clock values are 1, 4, 7, // 8, 9, 10 and 11. // // How these fractals work: start with a box, or sphere, or tetrahedron, or // whatever arbitrary space to generate the fractal in. Define a set of rules // (transformations) for making copies of this space within itself. Within // each of those, repeat the process. Once the size of the copy gets below a // certain size limit, fill in the region. For example, if the rule was start // with a cube, and within the cube place 20 copies of itself--each scaled by // 1/3--such that the new cubes tile along the edges of the old cube, you // would be generating a menger sponge. Or if you took a tetrahedron, made // copies--each scaled by 1/2--and placed them at the corners of the old // tetrahedron, ad infinitum, you would be generating a sierpinski // tetrahedron. // The macro------------------------------------------------------------------ #declare Num = 0; #macro Iterate(Rules,Scale,Trans,Sc,MSiz,FRad) #local ctr = 0; #while (ctr < dimension_size(Rules,1)) #if (Sc*Scale[ctr] > MSiz) Iterate(Rules,Scale,transform{transform Trans transform Rules[ctr]},Sc*Scale[ctr],MSiz,FRad) #else sphere { 0,FRad,1 transform Trans transform Rules[ctr] } #declare Num = Num + 1; #end #local ctr = ctr + 1; #end #end // the scene------------------------------------------------------------------ // Iterate() parameters: // // 1: transformation array to make copies of fractal region // // 2: scale array; each element should be the scale factor // of the corresponding transformation-array element // // 3: previous transforms (pass a null transform) // // 4: current scale (pass the radius of the uppermost region) // // 5: maximum radius of blob components (terminal regions) // // 6: radius of blob components, as a multiplier for radius // of parent region #declare Null = transform { translate <0,0,0> } blob { #if (clock=1) Iterate(R_01,S_01,Null,1,.01,2) threshold .35 rotate 30*y sturm #end //Iterate(R_02,S_02,Null,1,1/512,5) threshold .45 rotate 30*y //Iterate(R_03,S_03,Null,1,.01,6) threshold .45 rotate 30*y #if (clock=4) Iterate(R_04,S_04,Null,1,.0125,6) threshold .75 rotate 30*y rotate 30*x #end //Iterate(R_05,S_05,Null,1,1/256,2.5) threshold .35 #if (clock=7) Iterate(R_07,S_07,Null,1,.03,2) threshold .55 rotate <-42,22,-75> #end #if (clock=8) Iterate(R_08,S_08,Null,1,.01,2) threshold .4 rotate <12,52,90> #end #if (clock=9) Iterate(R_09,S_09,Null,1,.01,3) threshold .4 rotate <30,120,0> #end #if (clock=10) Iterate(R_10,S_10,Null,1,.02,3) threshold .667 rotate <46,14,72> #end #if (clock=11) Iterate(R_11,S_11,Null,1,.02,2) threshold .5 rotate <0,35,15> #end #render concat("\n",str(Num,6,0)," blob components generated.\n") pigment { #if (clock=1|clock=4) bozo color_map { [0.0 SteelBlue*1.15][1.0 Plum*.90] } scale .75 #end //01 04 #if (clock=7) bozo color_map { [0.0 OldGold][1.0 GreenCopper*1.15] } scale .75 #end //07 #if (clock=8) bozo turbulence .5 color_map { [0.0 MandarinOrange*.75][1.0 Firebrick*1.15] } scale .5 #end //08 #if (clock=9) bozo color_map { [0.0 SteelBlue*1.3*.6+White*.4][1.0 White] } scale .4 #end //09 #if (clock=10) bozo color_map { [0.0 MandarinOrange*.75][0.5 Firebrick*1.15][1.0 Light_Purple*.65] } scale .4 #end //10 #if (clock=11) bozo turbulence 1 color_map { [0.0 GreenCopper*1.3][0.4 MediumForestGreen*1.1*.8+Gray55*.2][1.0 MediumWood*1.1] } scale .5 } finish { ambient .15 diffuse .7 #end //11 } } #if (clock=1) sphere { 0,2.5 hollow no_shadow pigment { color GreenCopper } finish { ambient .1 diffuse .3 reflection 0.6 } } #end //01 #if (clock=4) sphere { 0,2.85 hollow no_shadow pigment { color GreenCopper } finish { ambient .1 diffuse .3 reflection 0.6 } } #end //04 #if (clock=7) sphere { 0,3 hollow no_shadow pigment { color SteelBlue*1.2 } finish { ambient .1 diffuse .2 reflection 0.7 } } #end //07 #if (clock=8) sphere { 0,3.5 hollow no_shadow pigment { color Wheat*.75 } finish { ambient .1 diffuse .2 reflection 0.7 } } #end //08 #if (clock=9) sphere { 0,2.5 hollow no_shadow pigment { color CadetBlue } finish { ambient .1 diffuse .3 reflection 0.6 } } #end //09 #if (clock=10) sphere { 0,2.85 hollow no_shadow pigment { color DustyRose } finish { ambient .1 diffuse .3 reflection 0.6 } } #end //10 #if (clock=11) sphere { 0,2.5 hollow no_shadow pigment { color Copper } finish { ambient .1 diffuse .3 reflection 0.6 } } #end //11 #if (clock=1|clock=9) camera { location <0,.5,-3>*.6 up <0,8/9,0> right <4/3,0,0> look_at <0,0,0> } light_source { <0,.5,-3>*.6 color Gray25 } #end //01 09 #if (clock=4) camera { location <0,.5,-3>*.9 up <0,8/9,0> right <4/3,0,0> look_at <0,0,0> } light_source { <0,.5,-3>*.9 color Gray25 } #end //04 #if (clock=7) camera { location <0,.5,-3>*.9 up <0,(4/3)*(9/16),0> right <4/3,0,0> look_at <0,0,0> } light_source { <0,.5,-3>*.9 color Gray25 } #end //07 #if (clock=8) camera { location <0,.5,-3> look_at <0,0,0> angle 40 } light_source { <0,.5,-3> color Gray25 } #end //08 #if (clock=10) camera { location <0,.5,-3>*.75 up <0,4/3,0> right <4/3,0,0> look_at <0,0,0> } light_source { <0,.5,-3>*.75 color Gray25 } #end //10 #if (clock=11) camera { location <0,.5,-3>*.65 up <0,8/9,0> right <4/3,0,0> look_at <0,0,0> } light_source { <0,.5,-3>*.65 color Gray45 } #end //11 light_source { <-300,400,-600> color White } light_source { <400,200,-500> color Gray50 } light_source { <50,-100,400> color Gray80 } // code to generate wireframe visualisation of transformation set /*camera { location <0,.5,-3>*1.2 look_at <0,0,0> } light_source { <-300,400,-600> color White } light_source { <400,200,-500> color Gray50 } light_source { <50,-100,400> color Gray80 } light_source { <0,.5,-3>*1.2 color Gray30 } background { color White } #macro roundbox(P1,P2,R) #local T=0; #local X1=P1.x;#local Y1=P1.y;#local Z1=P1.z; #local X2=P2.x;#local Y2=P2.y;#local Z2=P2.z; #if (X1>X2) #declare T=X2; #declare X2=X1; #declare X1=T; #end #if (Y1>Y2) #declare T=Y2; #declare Y2=Y1; #declare Y1=T; #end #if (Z1>Z2) #declare T=Z2; #declare Z2=Z1; #declare Z1=T; #end merge { cylinder { ,,R } cylinder { ,,R } cylinder { ,,R } cylinder { ,,R } cylinder { ,,R } cylinder { ,,R } cylinder { ,,R } cylinder { ,,R } cylinder { ,,R } cylinder { ,,R } cylinder { ,,R } cylinder { ,,R } sphere { ,R } sphere { ,R } sphere { ,R } sphere { ,R } sphere { ,R } sphere { ,R } sphere { ,R } sphere { ,R } bounded_by { box { , } } } #end #local Rad = .02; union { #local ctr=0; #while (ctr,<1,1,1>,Rad/S_11[ctr]) //box { -1,1 pigment { color RGB() } transform R_11[ctr] } #local ctr=ctr+1; #end object { roundbox(<-1,-1,-1>,<1,1,1>,Rad) pigment { color Gray70 } } rotate <-20,30,0> }*/