TITLE: Calculating the arc length of a circle segment
QUESTION [5 upvotes]: I would like to calculate the arc length of a circle segment, i.e. I know the start coordinates (x/y) of the circle segment, the end coordinates (x/y) and the x and y distances from the starting point to the center point of the circle segment.
I know that I can calculate the circumference with 2 * radius * PI. Consequently, I would have to calculate the radius and the angle of the circle segment via Pythagorean theorem and sin and cos.
My question: Is there a simple formula where I just have to put in start-coordinates, end-coordinates and the circle origin point coordinates?
Thanks.
enne

REPLY [7 votes]: You can derive a simple formula using the law of cosines. In fact, while all the planar geometry is helpful for visualization, there's really no need for most of it. You have 3 points: your arc start and stop points, which I'll call $A$ and $B$, and your circle center, $C$. The angle for the arc you're wanting to measure, I'll call it $\theta$, is the angle of the triangle $ABC$ at point $C$. Because $C$ is the center of the circle that $A$ and $B$ are on, the triangle sides $AC$ and $BC$ are equal to your circle's radius, $r$. We'll call the length of $AB$, the remaining side, $d$ (see picture).
(By the way, if $A=(x_1,y_1)$ and $B=(x_2,y_2)$, then 
$d=\sqrt {(x_1-x_2)^2 + (y_1-y_2)^2}$.)

According to the law of cosines, $\cos (\theta )={{r^2+r^2-d^2}\over {2rr}}=1- {{d^2}\over {2r^2}}$.  
So all you need is the distance between the end points of your arc and the radius of the circle to compute the angle,
$\theta = \arccos (1- {{d^2}\over {2r^2}})$
Lastly, the length is calculated -
$Length = r\theta$
Where $\theta$ is expressed in radians.