0

How to draw a shape like below using fractals in tikZ?

Fractal Triangle

Laura
  • 159

1 Answers1

5

I couldn't resist. This Metapost version might give you some ideas of how to do things in TikZ if that's your chosen approach.

enter image description here

prologues := 3;
outputtemplate := "%j%c.eps";

vardef decorate(expr line, ttl) = 
   if ttl > 0:
     save m, p; 
     pair m; m = point 1/6 of line rotatedabout(point 1/2 of line, 90);
     path p; p = point 0 of line -- m -- point 1 of line;
     draw p;
     decorate(subpath(0,1) of p, ttl-1);
     decorate(subpath(1,2) of p, ttl-1);
   fi
enddef;

beginfig(1);
n = 3;
path base; base = for i=1 upto n: up scaled 4cm rotated (360/n*i) -- endfor cycle;
draw base;
for i=1 upto length(base):
  decorate(subpath (i-1,i) of base, 4);   
endfor
endfig;
end.

If you crank up the number of iterations a bit you get some simple fractal self-similarities. Here is it with 5 sides in the base shape and using a depth of 12.

enter image description here

Thruston
  • 42,268