I have an arc defined with an origin, radius and the two angles the arc is restricted to on the circle.

I am trying to find how to get the nearest point on the arc from another point.

I can easily get the nearest point on a full circle but not sure how to do it when it is restricted to an arc.

  • $\begingroup$ Is this true?: Complete the circle using your arc. Find the nearest point on the full circle. If the point is on your arc, you have your answer. Otherwise, the closest point will be one of the two end points of the arc (can evaluate the distance and pick the right one). $\endgroup$
    – Adi
    Jun 15 at 5:45
  • $\begingroup$ Oh damn, thats actually much simpler than what i was trying lol. Thanks! $\endgroup$
    – WDUK
    Jun 15 at 6:35

WLOG we may assume the centre of the circular arc to be origin and radius to be $r$. So parametrically the points on the arc may be defined as $(r\cos \theta,r\sin \theta)$ where $\theta \in [\alpha,\beta]$.

$D^2=(x-r\cos \theta)^2+(y-r\sin \theta)^2$

$=x^2+y^2+r^2-2r(xr\cos \theta+yr\sin \theta)$

$=x^2+y^2+r^2-2r\sqrt{x^2+y^2}\cos \left(\theta-\tan^{-1}\frac{y}{x}\right)$

Substituting for $\theta \in [\alpha,\beta]$ we may obtain the distance of any point on arc from $(x,y)$.

To obtain the shortest distance we find that value of $\theta \in [\alpha,\beta]$ for which $D^2$ is minimum. Corresponding to that particular $\theta$ we find the point $(r\cos \theta,r\sin \theta)$

  • $\begingroup$ I'm a bit confused how this finds me the 2d point on an arc from another 2d point, this seems to just give the squared distance ? Also how is $\theta$ defined here, is that the total angle of the entire arc ? $\endgroup$
    – WDUK
    Jun 15 at 4:33
  • $\begingroup$ Please see again. I have edited my post $\endgroup$
    – Maverick
    Jun 15 at 4:46
  • $\begingroup$ $\alpha$ and $\beta$ have been assumed as your angles of restriction between which $\theta$ lies $\endgroup$
    – Maverick
    Jun 15 at 4:48
  • $\begingroup$ So i have to find the minimum $D^2$ from that equation? Bit confused how this would be done programmatically. $\endgroup$
    – WDUK
    Jun 15 at 4:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.