Initialisation du projet mp-scratch
[mp-scratch.git] / doc / figures / Ex-Serpinski.mp
1 prologues:=2;
2
3 def sierpinskiN (expr a, b, n) =
4   if n = 0:
5     draw a--(b rotatedabout(a,60))--b--cycle;
6   else:
7     sierpinskiN(a, 0.5[a,b], n-1);
8     sierpinskiN(0.5[a,b], b, n-1);
9     sierpinskiN(0.5[a,b rotatedabout(a,60)],0.5[a rotatedabout(b,-60),b], n-1);
10   fi;
11 enddef;
12
13 beginfig(1);
14   z0 = origin;
15   z1 = z0 shifted (0,-500);
16   sierpinskiN (z0, z1, 8);
17 endfig;
18
19 end

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.