A Sierpinski triangle is analogous to a Sierpinski carpet. To create one, you begin with an equilateral triangle. Connect the midpoints of the sides of the triangle to form four subtriangles, and...



A Sierpinski triangle is analogous to a Sierpinski carpet. To create one, you begin with an equilateral triangle.


Connect the midpoints of the sides of the triangle to form four subtriangles, and remove the inner subtriangle. The result is a Level 1 Sierpinski triangle. Repeat the process on each of the remaining three subtriangles to get a Level 2 Sierpinski triangle, as follows:







Theoretically, you could continue up to any level, but in practice you will reach a point where you will not be able to see additional triangles. Write a program that uses recursion to draw a level n Sierpinski triangle for any integer n between 1 and 7, inclusive, that the user specifies. The user must also provide the vertices and side length of the original outer triangle.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here