Last active
August 29, 2015 13:59
-
-
Save roberto-arista/10965769 to your computer and use it in GitHub Desktop.
drawPoly.pde
This file contains 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
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