Skip to content

Instantly share code, notes, and snippets.

@futurefabric
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save futurefabric/b552fd3f5fda3ed081c6 to your computer and use it in GitHub Desktop.
Save futurefabric/b552fd3f5fda3ed081c6 to your computer and use it in GitHub Desktop.
Plot points in a spiral
// PLOT POINTS IN A SPIRAL
// By Guy Moorhouse @Futurefabric
float x, y;
int number_of_points = 280;
float circle_diameter = 10;
float plot_radius = 200;
float angle_incr = radians(10);
void setup() {
frameRate(100);
size(500,500);
fill(0);
smooth(8);
noStroke();
}
void draw() {
background(255);
translate(width/2, height/2);
for(int i=0; i<number_of_points; i++){
float ratio = i/(float)number_of_points;
float spiral_rad = ratio * plot_radius;
float angle = i*angle_incr;
x = cos(angle) * spiral_rad;
y = sin(angle) * spiral_rad;
ellipse(x,y,circle_diameter,circle_diameter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment