点到椭圆的最短距离

Minimum Distance to an Ellipse

Date: 06/10/99 at 11:18:23
From: Christian Gauthier
Subject: Geometry Conic Ellipse

What is the minimum distance between a point inside or outside an
ellipse and the ellipse, if I know the general equation of the ellipse

Ax2+Bxy+Cy2+Dx+Ey+F=0
?

Date: 06/10/99 at 15:26:53
From: Doctor Rob
Subject: Re: Geometry Conic Ellipse

There may be a general formula for this, but if so, it is so
complicated that no one would ever write it out explicitly. I would
find the distance in the following way.

The point Q(x0,y0) on the ellipse whose distance from the given point P(X,Y) is least at a point such that the tangent to the ellipse at Q is perpendicular to the line PQ. The slope of the tangent at Q can be found by implicitly differentiating the equation of the ellipse and solving for dy/dx , then substituting in x0 and y0 . Then the line perpendicular to this tangent has slope 1/(dy/dx) , and it passes through Q , so the point-slope form will give you its equation in terms of A,B,C,D,E,F, x0 , and y0 . Since the point P lies on this line, that gives you an equation that x0 and y0 must satisfy, in addition to the equation of the ellipse. By eliminating y0 from these two equations, you get a quartic equation in x0 . This may have zero, two, or four real solutions. Each one will give a corresponding value of
y0 .

Then for these solutions, the distance PQ should be computed, and the smallest of them chosen as the answer. For an ellipse, the largest one will give you the point farthest from P .

In theory, you can solve the quartic in terms of radicals, but the result of trying to do that is generally an unmanageably complicated formula. Once you have the quartic, if you cannot factor it into linear and quadratic factors, you might as well solve it numerically.

Note that this solution does not depend on the curve being an ellipse, just a quadratic equation in x and y. It will give you the answer for parabolas, hyperbolas, and degenerate conics, too.

As an example, take the point P(3,8) and the ellipse

x2+xy+y2+2x+4y9=0.

Then

2x+x(dy/dx)+y+2y(dy/dx)+2+4(dy/dx)=0,dy/dx=(2x+y+2)/(x+2y+4),

and the slope of the perpendicular to the tangent line at Q(x0,y0) is

m=(x0+2y0+4)/(2x0+y0+2),

and that line is

yy0=[(x0+2y0+4)/(2x0+y0+2)](xx0).

Since P(3,8) is on that line, we get the equation

8y0=[(x0+2y0+4)/(2x0+y0+2)](3x0),

4+17x0+x20=y20,

and since Q is on the curve, we get the equation

x20+x0y0+y20+2x0+4y09=0.

Eliminating y0 from these two equations, we end up with the quartic
equation

3x40+51x30+185x20494x039=0.

This polynomial doesn’t factor, so we solve numerically.

There are two real roots, x0=0.0767858556 and x0=1.7998308063 , approximately, and the corresponding values of y are y0=1.6433309230 and y0=6.1511392960 , approximately. The first point has distance 7.0621422356 and the second 14.2019417499 from P , so the minimum distance from P to the ellipse is 7.0621422356.

Another approach is to use a Lagrange Multiplier. Set

f(x,y,z)=(xX)2+(yY)2+z(Ax2+Bxy+Cy2+Dx+Ey+F).

Then set the partials of f with respect to x,y, and z equal to zero, and solve for x,y, and z . That will give you x=x0 and y=y0 . The resulting equations will be the same, because eliminating z from the first two equations will give you the equation of the line PQ we got above, and the last equation will be the equation of the ellipse.

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值