We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello all. I'm trying to draw a circle with trigonometry, calling curveVertex() every 30 degrees in a for loop. The thing is, even though I include 360 in the for statement, the stroke doesn't close properly with endShape(). I don't want to use endShape(CLOSE), because it closes with a line instead of a curve, and the 30 degree step makes it look terrible. What am I doing wrong?
beginShape();
for(int i = 0; i <= 360; i += 30) {
curveVertex(pos.x + sin(radians(i))*r, pos.y + cos(radians(i))*r);
}
endShape();
Answers
By the way, here's an image of what it looks like:
you could use ellipse...
I know I could use ellipse, but drawing it manually enables me to vary the radius of the circle adding some noise, etc
mine works with 430 as upper bound which is ridiculous
when you use 200 as upperbound, you'll see that he doesn't even start at south pos but a little more right
Oh, nice! That worked. Thank you very much!
well, it's a work around...
it's not an answer
maybe the radians or sin gives errors....
first and last points aren't part of the drawing.
from the reference:
"The first and last points in a series of curveVertex() lines will be used to guide the beginning and end of a the curve. A minimum of four points is required to draw a tiny curve between the second and third points. Adding a fifth point with curveVertex() will draw the curve between the second, third, and fourth points."
ah, well spotted
I somehow thought they would be vertex...