Created
October 18, 2014 22:54
-
-
Save futurefabric/58138bfb8070e9cc2167 to your computer and use it in GitHub Desktop.
Plot points in rows and columns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PLOT POINTS IN ROWS AND COLUMNS | |
// By Guy Moorhouse @Futurefabric | |
float x, y; | |
int number_of_points = 900; | |
float grid_across = round(sqrt(number_of_points)); | |
float circle_diameter = 10; | |
float margin = 30; | |
void setup() { | |
ellipseMode(CORNER); | |
frameRate(100); | |
size(500,500); | |
fill(0); | |
smooth(8); | |
noStroke(); | |
} | |
void draw() { | |
background(255); | |
for(int i=0; i<number_of_points; i++){ | |
x = margin + ((width-(2 * margin))/grid_across) * (i % grid_across); | |
y = margin + ((height-(2 * margin))/grid_across) * ((i - i % grid_across) / grid_across); | |
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