Question
problem: A Sierpinski Gasket or Triangle is a type of fractal named after the Polish mathematician Waclaw Sierpinski who described some of its interesting properties
problem: A Sierpinski Gasket or Triangle is a type of fractal named after the Polish mathematician Waclaw Sierpinski who described some of its interesting properties in 1916. It is a nice example of how an orderly structure can be created as a result of random, chaotic behavior. An display example of a Sierpinskis Gasket is given below: One way to create the fractal is to start with an equilateral triangle. Let us say that the corners are labeled X, Y, and Z. Set current equal to point X. Repeat many times (you can try anywhere from 1,000 to 10,000). Randomly pick target as one of the three X, Y, or Z. Calculate the point halfway between current and target. Set current to this halfway point. Draw a small dot at location current. Write a program that draws a Sierpinski Gasket. You can pick the coordinates for the corners of the triangle. It may seem like you should get a random mess of dots but instead you get a very orderly picture! To draw a single pixel at coordinate (X,Y), you can use the drawLine method where the start and endpoints are both the same point. Another way is to fill or draw a tiny rectangle (say 2 pixels x 2 pixels) at this coordinate. Submit a listing of all Java classes, and a PrintScreen of your Sierpinski Gasket.
Sierpinski's GasketStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started