几何尺寸与公差论坛

 找回密码
 注册
查看: 437|回复: 0

shortest distance to ellipse from poin

[复制链接]
发表于 2009-9-15 22:25:14 | 显示全部楼层 |阅读模式
shortest distance to ellipse from point
shortest distance to ellipse from point,
or: what is the line perpendicular to the ellipse?

what is a good method to determine the shortest distance from a point to an ellipse? this is similar to finding the line through a given point that is perpendicular to an ellipse.
to make it simple, i have the ellipse centered at the origin, (0,0), and the major axis along x. also the point is always in quadrant i, and is always outside the ellipse.
thanks for your help,
harry
check out our whitepaper library.
well, you know the equation of the ellipse and you know the coordinates of the point.  so, you calculate the coordinates of points along the ellipse at whatever intervals you choose (depending on the degree or accuracy desired), then calculate the distance between each point and the known point.  minimize that distance and you're there.  a solve block in mathcad would work, you could se tit up in excel, or you could draw it in some cad program and measure the distance using perpendicular snap.
did that help?
i forgot to say i am initially looking for a closed form solution...non-iterative. and i am programming the solution using fortran (or c). i also have to do this about 1.5 million times or so. (ifr: i like your iterative method because it is very straight forward, but may be time consuming.)
harry
since you have taken all the complexity out of it isn't this just the intersection of the line connecting the point with the origin,  with the ellipse? if so it is a simple quadratic to find the point of intersection, and the rest is obvious.
if i've missed something then i suspect you need to look at the gradient of the two and make sure that one is (-1/the other gradient), but i'm pretty sure my first para covers your problem.
cheers
greg locock
having slept on it i think the first para is wrong, and probably applies only to circles, the second is on the right track but may not be helpful.
why not set up an equation for the intersection between a circle, centre x1,y1, and your ellipse. differentiate this to find the maxima and minima to find the minimum real value of r.
ax^2+by^2=1 (you did align the ellipse to the axes)
(x-x1)^2+(y-y1)^2=r^2
a,b,x1 and y1 are all known
looks gnarly but doable. my electronic brain is elsewhere, sadly.
cheers
greg locock
if i'm not in error i found that this problem requires the solution of a quartic equation, and this is the highest order for which a closed form solution exists.
however the algebraic manipulations required are really too cumbersome.
if you want to give it a try, here's my starting point.
the equation of the normal to the point (x1,y1) on the ellipse is:
(x-x1)/b2x1=(y-y1)/a2y1
your point (x0,y0) must lie on this line, then substituting it to (x,y) and solving for the unknown point (x1,y1) you should find:
(a2-b2)x1+b2y0x1/y1=a2x0
rearranging to use the parametric form of ellipse's equation x1/a=cosθ and y1/b=sinθ and using the well known relationships
cosθ=(1-t2)/(1+t2) and tanθ=2t/(1-t2)
you should obtain something like:
(1-t2)2t(1-b2/a2)+(1-t2)(1+t2)2y0b/a2=2t(1+t2)x0/a
this is the quartic equation: good luck!
prex
harry,
    does this solution have to be exact or can you work with a tolerance, say some percentage of the major axis ?.   if so then it can done without solving a quartic every time or using any iterative methods.
kapitan,
as i have been thinking about solving quartics, i have considered the solution does not have to be exact. some of the accuracy criteria i have thought of are:
1) the accuracy could be expressed as the point-ellipse distance +/- some absolute tollerance.
2) or the accuracy could be expressed as the point-ellipseline's angle to the ellipse. this angle will be perpendicular at the exact sollution. an angle of +/- 0.5 degrees is ok.
harry
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2025-1-13 13:10 , Processed in 0.037905 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表