Skip to content

Instantly share code, notes, and snippets.

@roberto-arista
Last active August 29, 2015 13:59
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 roberto-arista/10965769 to your computer and use it in GitHub Desktop.
Save roberto-arista/10965769 to your computer and use it in GitHub Desktop.
drawPoly.pde
void drawPoly(float x, float y, float radius, int numEdges) {
float arc = TWO_PI / numEdges;
beginShape();
for (int i=0; i<numEdges; i++) {
float a = arc * i;
float px = x + cos(a) * radius;
float py = y + sin(a) * radius;
vertex(px, py);
}
endShape(CLOSE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment