/* With a KochFractal (sometimes called a Koch Snowflake) we first create a straight line, which is broken into a line with a triangle in it. Each time we iterate over the fractal the same thing happens to each line, creating a fractal, self-similar shape. */ KochFractal koch; void setup() { // Setup the environment size(650, 250); background(0); smooth(); framerate(1); // Create the fractal koch = new KochFractal(); } void draw() { background(0); // let the fractal do its thing koch.simulate(); println(koch.getLineCount()); // we need to constrain how far the fractal goes, so // it doesn't get out of control if (koch.getDepth() > 6) { koch.restart(); } }