Based on a demonstration by Eric Roberts.
Day3: RandomCircles.java
By repeatedly drawing lines, we can make a curved looking shape. Consider the example below where we imagine dots evenly space along the bottom and the left of a canvas. If we connect the topmost dot on the left edge to the left most dot on the right edge, we would be a line like the picture of the far left. If we then connect the next 10 dots we get a picture in the middle and if we connect all dots we get the picture on the right.
Write a program that creates the "curve" in the above right image using straight lines.
public class StringArt extends GraphicsProgram { /** The size of the screen **/ public static final int APPLICATION_WIDTH = 400; public static final int APPLICATION_HEIGHT = 400; /** The number of pixels between end points of the line **/ public static final int LINE_SPACING = 20; /** The number of lines we will have to draw **/ public static final int NUM_LINES = APPLICATION_WIDTH / LINE_SPACING; public void run() { // your code here... } }