Question: Problem 3: The Sierpinski Gasket is a fractal pattern whose overall shape is a triangle. Level O(see figures below) is just a simple triangle. Level

 Problem 3: The Sierpinski Gasket is a fractal pattern whose overall
shape is a triangle. "Level O"(see figures below) is just a simple

Problem 3: The Sierpinski Gasket is a fractal pattern whose overall shape is a triangle. "Level O"(see figures below) is just a simple triangle. Level 1 divides the original triangle into 3 other triangles (the middle is not counted as one of them). Level 2 (second image) further divides each of those into three other triangles into 3 other triangles and so on. The figures show levels 0 through 6. Note that, at each step, the division of a triangle into three others involves determining the three vertices of these new triangles and then drawing lines. Each vertex is either taken directly from the existing triangle or is the midpoint of one of the sides of the existing triangle. Write program that uses a recursive method drawGasket to draw a Sierpinski Gasket given a level number and the three points making up the triangle. This method header should look like this: private void drawGasket(Graphics g, int level, Point pl, Point p2, Point p3) Your program should use a JSlider to allow the user to select the level (restrict the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!