Skip to content
Fifty ways to draw a circle
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
circles
main
.gitignore
LICENSE
README.md
createcircle

README.md

Fifty Ways to Draw a Circle

This project is an exploration of generating a circle in fifty different ways. You can read about the motivation for the project here. This was inspired by Manohar Vanga's very similar project, but the code is all my own.

Implementation notes

The circles are all implemented using the Java version of Processing. I took one of the ideas (#08) and reimplemented it in the Javascript version of Processing, to make a web app that creates stained glass window patterns.

The source code for each circle is stored in its own directory. Each circle is meant to stand on its own, and can be used elsewhere, but there are some source files that are shared between implementations. These shared source files are stored in the "main" directory:

  • click.pde: a very simple main() that draws a circle centered on whatever point the mouse clicks on.

  • pick.pde: a main() that allows you to select four nice-looking examples of the current circle implementation. It creates an image file with those four circles, and saves the random seeds used to generate them.

  • grow.pde: a main() that takes a file containing four random seeds, and generates an image that's twice as large as the one created by pick.pde.

  • main.pde: a symbolic link to one of the three above files.

  • mask.pde: code to apply a circle-shaped mask to an image while retaining the image's own alpha channel data. This is needed by seven of the circle implementations.

  • JAVA2D.pde: a line of code indicating that the current sketch should use the default (JAVA2D) renderer.

  • P2D.pde: a line of code indicating that the current sketch should use the P2D renderer.

The files with main() routines were useful for development of the circles, but they are not needed to use the circle code elsewhere. Each circle must use exactly one of the renderer files (JAVA2D.pde or P2D.pde) to indicate which renderer it wants to use; the masking code (mask.pde) uses this information, and any settings() routine should respect this choice as well. For some discussion of the differences in renderer behavior, see here.

Three of the sketches (#40, #41, #42) use Lee Byron's "Mesh" library to create Voronoi diagrams. The web page for the library describes how to install it.

I added a fourth constraint to my implementation, aside from the three mentioned in my description. Namely, I wanted each circle to be totally recreatable given a random seed. The implementations of main() in pick.pde and grow.pde work together on this - they both seed Processing's random number generators before drawing a given circle, and pick.pde keeps track of which random seeds it used and stores them in a text file after it's done. You can see the random seeds used to create each of the sample images here.

Images

You can’t perform that action at this time.