I am trying to find a general method for calculating the shortest distance between an arbitrary point and an arc, where the arc is a 90 degree portion of an ellipse's boundary, and the ellipse's axes are both aligned to the Cartesian axes. I'm working in 2D, so both the point and the ellipse are coplanar. If the point is in the same quadrant as the arc, relative to the centre of the ellipse, then I believe that the problem is the same as calculating the distance from a point to anywhere on the whole ellipse's boundary, for which there are fairly straightforward methods (e.g. http://www.geometrictools.com/Documentation/DistancePointEllipseEllipsoid.pdf).

In the diagram, if the point is to the left of x1 or to the right of x2 or below y1, then the problem is straight forward.

However, I can't figure out what to do if the point P is as shown in the diagram.

Click here for diagram

  • $\begingroup$ The ellipse is centered at the origin? $\endgroup$ – sinbadh Mar 13 '16 at 6:40
  • $\begingroup$ It can be if that helps because we can translate the ellipse so that it is centred at the origin and simply translate the point as well $\endgroup$ – Rob B Mar 13 '16 at 6:45
  • $\begingroup$ Suppose you have the ellipse $f(\theta)=(a\cos\theta,b\sin\theta)$, $\theta\in[0,2\pi)$. A conected closed arc $\mathcal{C}$ of the ellipse is of the form $f(\theta)=(a\cos\theta,b\sin\theta)$, $\theta\in[A,B]$ (closed in the topological sense), $0\le A<B<2\pi$. Fixing the point $P=(x_0,y_0)$, the problem is find $\begin{eqnarray}d((X,Y),P)^2&=&\min_{(x,y)\in\mathcal{C}}d((x,y),P)^2\\&=&\min_{(x,y)\in\mathcal{C}}\{(x-x_0)^2+(y-y_0)^2\}\\&=&\min_{\theta\in[A,B]}\{(a\cos\theta-x_0)^2+(b\sin\theta-y_0)^2\},\\\end{eqnarray}$ but I doubt it is an easy optimization problem. $\endgroup$ – sinbadh Mar 13 '16 at 7:00

You need to project the point $P$ orthogonally on the ellipse. This can be done by means of the solution of the quartic equation. Keep the two solutions corresponding to a minimum, and check if they belong to the useful portion of the ellipse.

The requested distance is the shortest of

  • the shortest distance to an admissible projection,
  • the shortest distance to the endpoints of the arc.

enter image description here

  • $\begingroup$ But if one solves the quartic, one gets the 'forbidden' distance that you have shown as a red line I think? EDIT ... your words 'then check' are key I think .. so you have to check the parameter t to see if it gives a point on the arc otherwise the shortest distance will be one of the end points? $\endgroup$ – Rob B Mar 28 '16 at 11:03
  • $\begingroup$ @RobB: that's it. You can't spare the resolution of the quartic and the check of the parameter. $\endgroup$ – Yves Daoust Mar 28 '16 at 12:42

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.