a fractal. Fractals are geometric patterns that repeat on themselves at smaller and smaller scales.
They have been studied for centuries because of their interesting mathematical properties and of
ten appear in natural objects (e.g. snow flakes, plants). Fractals are also a classic application of
recursion; you can read more about fractals and their history here. Consider the example below,
which illustrates the process of constructing a fractal composed of triangles at several steps in the
process Notice that at each step, triangles of increasingly smaller sizes are drawn at the three
points of each existing triangle. More examples of fractals can be found in Section 5.
CSCI 1933 PROJECT 1
7
3. FRACTAL DRAWER CLASS (38 POINTS)
To help you with the drawing, we've already implemented a Canvas class that supports all of the
drawing capability you need. You should look at the code if you're interested, but all you'll need
to know is how you can interact with Cans objects.
Here are the method specifications of the Canvas class
● Camas() (default constructor): creates drawing of default size
● Cana(int height, int width): creates drawing of specified width and height
● void drawShape(Circle circleObj)
void drawShape(Rectangle rectangleObj)
void drawShape(Triangle triangleObj)
Each of the drawing methods will draw the shape you pass it in the specified location and in the
specified color. Here's an example of how you might use the Canvas class to draw a single blue
circle:
Canvas drawing - new Canvas (800,800);
Circle nyCircle = new Circle(0,0,100);
myCircle.setColor (Color.BLUE);
drawing-drawshape (myCircle);
Fig: 1