Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

What disadvantages or opportunity costs can you identify with TDI?

Answered: 1 week ago