Last active
August 29, 2015 14:12
-
-
Save tsulej/09742bafce721a9540f2 to your computer and use it in GitHub Desktop.
Vertex circles
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
size(1000,1000); | |
background(20); | |
smooth(8); | |
noFill(); | |
stroke(240); | |
strokeWeight(0.7); | |
// outer circle | |
ellipse(500,500,900,900); | |
// middle circle | |
// very small steps are needed with vertex | |
// experiment with step eg. float step = TWO_PI/50.0; | |
float step = TWO_PI/(4.0*360.0); | |
float r = 400.0; | |
float ang = 0; | |
beginShape(); | |
while(ang<TWO_PI) { | |
float x = cos(ang) * r; | |
float y = sin(ang) * r; | |
vertex(x+500,y+500); | |
ang+=step; | |
} | |
endShape(CLOSE); | |
// inner circle | |
ang = 0; | |
r = 350; | |
// experiment with step eg. step = TWO_PI/5; | |
step = TWO_PI/17; | |
beginShape(); | |
// here we need to overlap curveVertexes to close circle change following '3' to '2' to see what happen | |
while(ang<=TWO_PI+3*step) { | |
float x = cos(ang) * r; | |
float y = sin(ang) * r; | |
curveVertex(x+500,y+500); | |
ang+=step; | |
} | |
endShape(); // do not close, just overlap curveVertexes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment