# Formula for calculating the center of an arc

Is there a formula for calculating the point equidistant from the start point and end point of an arc given:

1) An arc is defined as: A center point $P$, a radius $r$ from the center, a starting angle $sA$ and an ending angle $eA$ in $radians$ where the arc is defined from the starting angle to the ending angle in a counter-clockwise direction.

2) The start point $sP$ is calculated as: $sP\{Px + \cos sA \times r, Py + -\sin sA \times r\}$

3) The end point $eP$ is calculated as: $eP\{Px + \cos eA \times r, Py + -\sin eA \times r\}$

Give the above restrictions, is there a way to calculate the point that is halfway between the start and end angles and exactly $r$ units away from the center?

-

Had an epiphany just as I hit submit, would this work?

$cP \{ Px +$ $\cos (eA - sA) \over 2$ $\times r, Py +$ $-\sin (eA - sA) \over 2$ $\times r\}$

SOLVED:

Using the piece-wise function:

$cP( Px +$ $\cos($ $sA + eA \over 2$ $+ n) \times r, Py +$ $-\sin($ $sA + eA \over 2$ $+ n) \times r) = \begin{cases} n = 0, & \text{if }eA - sA \text{ is } >= 0 \\ n = \pi, & \text{if }eA - sA \text{ is } < 0 \end{cases}$

For you computer science-y types here's some pseudo-code:

double e = GetEndAngle();
double s = GetStartAngle();
double d = e - s;

double x = 0.0;
double y = 0.0;
double offset = 0.0;
if(d < 0.0) {
offset = PI;
}
x = (GetPosition().GetX() + std::cos(((s + e) / 2.0) + offset) * GetRadius());
y = (GetPosition().GetY() + -std::sin(((s + e) / 2.0) + offset) * GetRadius());

-
The argument of your trigonometric functions is supposed to be $\dfrac{sA+eA}{2}$. – J. M. Jul 29 '12 at 4:19
@J.M. Fixed and solved. Thanks for the correction. – Casey Jul 29 '12 at 7:09

In polar coordinates if your start point is $(r,\theta_1)$ and ending point is $(r, \theta_2)$ the midpoint of the circular arc is $(r, \frac{\theta_1+\theta_2}{2})$. To convert back to rectangular coordinates we get the point where $x=r\cos(\frac{\theta_1+\theta_2}{2})$, $y=r\sin(\frac{\theta_1+\theta_2}{2})$.

-