Hi, hope you can help me. I’m sure this is simple.
I’ve found many references to getting random point on the edge of circle using (cos(angle)*radius, sin(angle)*radius) but what i have come up with generates points that don’t seem to have an obvious relationship to my circle. I’m trying to generate 2 such points and connect them with a line. I’m clearly missing something fundamental. Help!
float x = 200;
float y = 200;
float rad = 100;
circle(x, y, rad);
float a = random(TWO_PI);
float x1 = cos(a)*rad+x;
float y1 = sin(a)*rad+y;
a = random(TWO_PI);
float x2 = cos(a)*rad+x;
float y2 = sin(a)*rad+y;
line(x1, y1, x2, y2);