3
sketch _ DrGeoSketch new .
4
sketch centerTo: 1@0; scale: 200.
7
build _ [ :triangle :depth| | vertrices middles nextTriangles|
9
(Delay forMilliseconds: 10) wait.
10
vertrices _ triangle mathItem points.
11
middles _ vertrices withIndexCollect: [:point : index | point + (vertrices atWrap: index + 1) / 2 ].
12
sketch domain deleteMathItem: triangle mathItem.
13
nextTriangles _ OrderedCollection new.
15
add: (sketch polygon: {vertrices first. middles first. middles third });
16
add: (sketch polygon: {middles first. vertrices second. middles second});
17
add: (sketch polygon: {middles third. middles second. vertrices third}).
18
nextTriangles do: [ :aTriangle | build value: aTriangle value: depth - 1]
23
value: (sketch polygon: { 0 @3 sqrt. 1@0 . -1@0})