# Yingri Guan

## 23 Jan 2014

I am always fascinated by the complexity of fractals. I was inspired to create a 3D fractal. However, the design came out to be a little disappointment as I wished to have more intricate structures in the design.

This parametric design made reference to the design by Espen Skjervold.
Code:

```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 //Referenced Espen Skjervold's work 2013       //constants maxX=20; //< -- less important, size of the biggest object sizeFactor=2.3; //<-- The size factor between an object and its child objects. The smaller the factor, the larger the children will be.     fractal(4); // <--- render the fractal with n number of levels       //Recursive method module fractal(levels, i=1, xPos=0, yPos=0, zPos=0) {   currentFactor=pow(sizeFactor,i); x=maxX/currentFactor;     if (i<=levels) {     //top fractal(levels, i+1, xPos , yPos , zPos); fractal(levels, i+1, xPos , yPos , zPos); fractal(levels, i+1, xPos*2 , yPos*2 , zPos*0.5); fractal(levels, i+1, xPos*0.7 , yPos*0.5 , zPos*0.4 ); fractal(levels, i+1, xPos +x/2, yPos + x/2, zPos + x/2); fractal(levels, i+1, xPos -x/2, yPos + x/2, zPos + x/2); fractal(levels, i+1, xPos +x/2, yPos - x/2, zPos + x/2); fractal(levels, i+1, xPos -x/2, yPos - x/2, zPos + x/2);   //bottom fractal(levels, i+1, xPos , -yPos , -zPos ); fractal(levels, i+1, xPos , yPos , -zPos ); fractal(levels, i+1, xPos*3 , yPos*3 , -zPos*3 ); fractal(levels, i+1, xPos*0.2 , yPos*0.4 , -zPos*0.5 ); fractal(levels, i+1, xPos*1.3 , yPos*1.5 , -zPos*2 ); fractal(levels, i+1, xPos*0.7 , yPos*0.5 , -zPos*0.4 ); fractal(levels, i+1, xPos +x/2, yPos + x/2, -zPos - x/2); fractal(levels, i+1, xPos -x/2, yPos + x/2, -zPos - x/2); fractal(levels, i+1, xPos +x/2, yPos - x/2, -zPos - x/2); fractal(levels, i+1, xPos -x/2, yPos - x/2, -zPos - x/2);     makeCube(x, xPos, yPos, zPos, i); }       }     //The actual rendering of each object module makeCube(x, xPos, yPos, zPos, level) {   union() {   translate([xPos+x/2, yPos, zPos]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos-x/2, yPos, zPos]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos, yPos+x/2, zPos]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos, yPos-x/2, zPos]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos, yPos, zPos+x/2]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos, yPos, zPos-x/2]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos, yPos*0.5, -zPos]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos, yPos*0.5, zPos]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos, yPos, -zPos*0.5]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos, yPos, zPos*0.5]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos*0.5, yPos, -zPos]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos*0.5, yPos, zPos]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos*0.5, yPos*0.5, -zPos]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos*0.5, yPos*0.5, zPos]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos*2, yPos*2, -zPos]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos*2, yPos*2, zPos]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos, yPos*2, -zPos*2]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   translate([xPos, yPos*2, zPos*2]) color(["Coral"]) cube((x)/1.4, center=true, \$fn=10 );   } }```