Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

How to Generate the Sierpinski Triangle [5/10]

5. Cleaning up the Sierpinski Triangle

The drawing of the Sierpinski triangle must now be cleaned up, compared to the image produced by the previous page.
[Run the program]

The first change was to remove the drawings of mid-points midAB , midAC , midBC , which were previously shown in purple, azure and olive colors. While mid-points must be computed, they don't need to be displayed, as they are making the final image much worse. Now that the drawings of mid-points have been removed, the Sierpinski triangle can be clearly seen, painted in the pink color.
[Run the program]

On the next page, the depth of the Sierpinski triangle is increased.

Loading...