Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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