Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- midpoints =
- NestList[Mean[{{0, 0}, {1, 0}, #}] &, {1/2, Sqrt[3]/2}, 10];
- iter[n_] :=
- Graphics[Join[{White, EdgeForm[Black]},
- Table[
- {Polygon[{{0, 0}, {1, 0}, midpoints[[i]]}],
- Polygon[{midpoints[[i]], midpoints[[i - 1]], {1, 0}}],
- Red,
- Polygon[{midpoints[[i]], midpoints[[i - 1]], {0, 0}}]}
- , {i, 2, n}]
- ]];
- iter[1] =
- Graphics[{White, EdgeForm[Black],
- Polygon[{{0, 0}, {1, 0}, {1/2, Sqrt[3]/2}}]}];
- Manipulate[iter[n], {n, 1, 10, 1}]
Advertisement
Add Comment
Please, Sign In to add comment