[Math] Arc length Given 3 Points, Center, and radius

circles

first time poster here. I'm working on a math problem for a software application I'm writing. The problem is as follows:

You are given a circle with center point O and radius r. There are three points on the circumference of the circle. The points are A, B, and C. You know the x any y coordinates of each point, as well as the point's polar angle (0 to 2pi). Using these points, a circular arc is drawn along the circumference of the circle from A to B to C. Remember, the arc is circular so you cannot turn back at point B and head the opposite way to C. It is possible for the path to pass through the 0 degree point, and the path may have a CW or CCW direction, which is known. I need to use this information to determine if the arc has arc length greater than, less than, or equal to pi*r (so: is the arc longer or shorter than half a circle).

Here are a few other details [switching to degree mode here]:

-Point B is usually never further than +/- 20 degrees from point A.
-The angle difference between B and C can be more than 180 degrees so simply using arccos() calculations will not be suitable for this problem because the output of arcsos() has 180 degree extremes.
-The solution most not be iterative because there are hundreds of other complex calculations happening before and after this one, especially in the animations.

Thanks for the help

  • P.S.
  • Through some calculations irrelevant to this problem, I was able to determine the angle difference between A and B by finding a 'dTheta' value and ADDING it to the polar angle of made by point A. So if angle A is 10 degrees, and dTheta is -15 degrees, angle B would be 10 + (-15) = -5 degrees, but in my polar system, this can easily be converted to 355 degrees. Similarly, if we know dTheta is negative, we can keep subtracting [or adding negative] degrees from A or B and end up (while still following the arc's trajectory) at angle C (or some angle that is C +/-360).

Best Answer

Here are some thoughts. Suppose that you have two points $A$ and $B$ which lie on a given circle of radius $r$. If $A$ and $B$ are diametrically opposed, then one can chose either half-circle (relative to the diameter $AB$) to get from $A$ to $B$, and the length of this path is $r\pi$. In general, with the aid of a picture, the arc length from $A$ to $B$ is $r\lvert\theta_B-\theta_A\rvert$, where $\theta_A$ and $\theta_B$ are the angles of $A$ and $B$, respectively. This is fairly easy to see by translating and scaling so your circle is centred at the origin and has radius $1$.

If one introduces a third point, $C$, then the total path length will be $r\lvert\theta_C-\theta_B\rvert + r\lvert\theta_B-\theta_A\rvert$, assuming, of course, that one traverses from $A$ to $B$, and then $B$ to $C$ (regardless of any change of direction at $B$.) If $A$, $B$ and $C$ satisfy $\theta_A<\theta_B<\theta_C$, then the arc length from $A$ to $B$ to $C$ is precisely $r(\theta_C-\theta_A)$. One must be careful if your arc "wraps over" the positive $x$-axis. (Adding another point at $(1,0)$ and the absolute angle above will help with that case.)

Note that your angles must be in radians for the above to work.

Edit: A bit more thinking about the problem yields the following. Rotate everything so that $A$ is at $(1,0)$ (so $\theta_A$ is now $0$, $\theta_B$ is now $\theta_B-\theta_A$ ($\pm2\pi$ if necessary) , and $\theta_C$ is now $\theta_C-\theta_A$ ($\pm2\pi$ if necessary)). Then $A$ and $C$ divide the circle into two arcs, say $C_1$ and $C_2$, and, unless $C$ is at $(-1,0)$, the arc lengths of $C_1$ and $C_2$ are different. Now $B$ lies on exactly one of these arcs, which we may assume is $C_1$.

  • If $\theta_C>\pi$ and $\theta_B<\theta_C$ then $C_1$ is the longer of the two arcs.
  • If $\theta_C>\pi$ and $\theta_B>\theta_C$ then $C_1$ is the shorter of the two arcs.
  • If $\theta_C>\pi$ and $\theta_B>\theta_C$ then $C_1$ is the shorter of the two arcs.
  • If $\theta_C>\pi$ and $\theta_B<\theta_C$ then $C_1$ is the longer of the two arcs.

Now the geometry is done, we just need to figure out the length of the longer arc and the shorter arc. This is easy since the shorter arc is $r\theta_C$ if $0<\theta_C\leq \pi$, and $(2\pi - \theta_C)r$ if $\pi<\theta_C<2\pi$. (The other arc has length $2\pi r$ minus the shorter arc length.) This should be relatively simple to code.