1
$\begingroup$

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?

3 Answers 3

2

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()); 
  • 0
    @J.M. Fixed and solved. Thanks for the correction.2012-07-29
1

A point on the arc $r$ away from $P(p_x,p_y)$ is desired such that it is along the arc having endpoints $eP$ and $sP$.

Any point $r$ away from $P$ will lie on some portion of the circle centered at $P$ and having radius $r$. A line from the center to the the midpoint of the chord will be perpendicular to a line directly joining the endpoints of the chord.

Let $\vec{v}=\vec{eP}-\vec{sP}=$

We want a vector perpendicular to this with magnitude $r$.

Given a vector $\vec{v}=v_x\hat{i}+v_y\hat{j}, \vec{u}\cdot\vec{v}=0$ if $\vec{u}=-v_y\hat{i}+v_x\hat{j}$. It is a unit vector if you divide it by $\sqrt{v_x^2+v_y^2}$, the magnitude of $\vec{v}$.

$\|\vec{v}\|^2=2r^2(1-\cos(eA-sA))=4r^2\sin^2{(\frac{eA-sA}{2})}\implies |\vec{v}|=|2r\sin{(\frac{eA-sA}{2})}|$

We wish to maintain the magnitude of our new vector $\vec{u}$ at $r$, so after switching the components then negating one, we just divided by the part of the magnitude we don't want.

$\vec{u}=\frac{r}{2\sin{(\frac{eA-sA}{2})}}<\sin{(eA)}-\sin{(sA),\cos{(eA)}-\cos{(sA)}}>$

$\vec{u}$ will give you the coordinates of the desired location. $r$ guarantees it will be on the circle. The remaining term indicates direction up to possibly a sign. This shouldn't be a problem so long as $eA>sA$. If that happens, $r$ needs to be replaced with $-r$.

  • 1
    Nice and detailed answer. $+1$2018-11-02
0

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})$.