ok so here are the instructions for this project:


Write a KochCurve program that uses DrawingTool and provides a drawKochCurve method for drawing Koch curves. Each drawKochCurve method can take the number of levels and an initial size as its parameters. Sample usage of the method to draw a 6 level Koch curve of length 300 would be:

KochCurve curve = new KochCurve();
curve.drawKochCurve(6, 300);

The procedure for creating a Koch curve is usually recursive. At each level, we observe that a Koch curve is made up of four smaller Koch curves. This process can be described in the following pseudocode:
if level < 1 then
Move forward length pixels
else
Draw a k-1 level Koch curve with segments 1/3 the current length
Turn left 60 degrees
Draw a k-1 level Koch curve with segments 1/3 the current length
Turn right 120 degrees
Draw a k-1 level Koch curve with segments 1/3 the current length
Turn left 60 degrees
Draw a k-1 level Koch curve with segments 1/3 the current length

Recommended Answers

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.