As I calculate the length of the arc (green) between two angles;
arc_lenght (xpos, ypos, radius, ang1, ang2) { return arc_lenght }
As I calculate the length of the arc (green) between two angles;
arc_lenght (xpos, ypos, radius, ang1, ang2) { return arc_lenght }
The arc-length, l
, of a circle is equal to the angle of the arc, θ
, in radians times the radius.
If we assume that ang1
is in the range [0 - ang2]
and ang2
is in the range [ang1 - 360]
(so ang1
is always the smaller of the two and neither is bigger than 360
) then:
float angle = ang1 - ang2;
float rad = angle * PI / 180.0;
float radOutside = (2 * PI) - rad;
float arc_length = radOutside * radius;
I am not sure what xpos
and ypos
represents, but I don't think they're relevant for getting the arc length.