FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Forum index » Science and Technology » Math
ellipse: shortest distance to given point
Post new topic   Reply to topic Page 1 of 1 [8 Posts] View previous topic :: View next topic
Author Message
indo34
science forum beginner


Joined: 03 May 2005
Posts: 1

PostPosted: Tue May 03, 2005 8:57 am    Post subject: ellipse: shortest distance to given point Reply with quote

Hello
I have an ellipse with x-axis-radius a and y-axis-radius b.
Thus the ellipse fulfills the equation
x^2/a^2 + y^2/b^2 = 1
for every (x,y) on that ellipse.
For a point (x,y) not on this ellipse, is it right that the solution for
x^2/(a + c)^2 + y^2/(b + c)^2 = 1
on variable c yields the minimal distance c from (x,y) to some point on the
original ellipse
(if not, how to interpret c then)? The idea is that i paint a second ellipse
around the original ellipse that
has a constant distance to the original ellipse and contains point (x,y).
(I am only interested in the first quarter of the ellipse by the way.)
Mathematica gives a very long solution on c (several pages) so it seams
faster to
compute it by newton approximation or secant approximation (for the solution
datatype "double").
Any one know what approximation method yields at fastest the result?

thanks
Back to top
Hauke Reddmann
science forum Guru Wannabe


Joined: 03 May 2005
Posts: 112

PostPosted: Tue May 03, 2005 9:45 am    Post subject: Re: ellipse: shortest distance to given point Reply with quote

indo34 <indo34@gmx.de> wrote:
Quote:
(if not, how to interpret c then)? The idea is that i paint a second ellipse
around the original ellipse that
has a constant distance to the original ellipse and contains point (x,y).

But two ellipses *do not* have constant distance!

Here is the standard method I would take:
1. Draw a circle around your point (x0,y0):
(x-x0)**2+(y-y0)**2=c**2
2. It must be tangent to the ellipse
x**2/a**2+y**2/b**2=1
- if it would intersect in two points a
smaller circle would exist.
3. Eliminate x, get a quadratic for y, compute
its discriminant. It must be zero to have one
solution. Solve for c, your distance.

--
Hauke Reddmann <:-EX8 fc3a501@uni-hamburg.de
His-Ala-Sec-Lys-Glu Arg-Glu-Asp-Asp-Met-Ala-Asn-Asn
Back to top
Oscar Lanzi III
science forum Guru Wannabe


Joined: 30 Apr 2005
Posts: 176

PostPosted: Tue May 03, 2005 10:50 am    Post subject: Re: ellipse: shortest distance to given point Reply with quote

To begin with, your second curve is not an ellipse. It looks like one,
but no cigar. What actualy happens can be seen most clearly by
considering the limiting case where the eccentricity approaches 1 with
fixed focal points and the ellipse thus becomes a line segment. The
curve that's a constan distance from a line segment consists of two
parallel line segments connected by semicircular caps. This is not an
ellipse or any limiting case of the ellipse.

Mathematica is right to give you a complicated expression for c. To
find the point on the ellipse that's closest to a given point (x, y),
one must solve what proves to be a 4th-degree equation for one of the
coordinates of the point on the ellipse. Applying the standard
technique symbolically then gives that unwieldy expression. It gets
even worse that this, however, for the casus irreucibilis can rear its
ugly head. In the context of 4th-degree equations this refers to the
resolvent cubic having three real roots and thereby generating complex
cube roots in that complicated expression from Mathematica.
Geometrically, the casus irreducibilis occurs when there are four rather
than two lines you can draw normal to an ellipse to a given point --
essentially when the ellipse has high eccentricity and your (presumably
exterior) point is relatively close to the minor-axis diameter. (Kids,
do try this at home. It's kind of neat to see this change in in the
character of the nomals.)

Given the fact that your constant-distance curve is not an ellipse and
analytical determination of the constant distance is both unwieldy and
uncertain, there are two ways to proceed. One, which you might find
asthetically pleasing, is to draw a CONFOCAL ellipse about your original
one. Given your ellipse (x/a)^2+(y/b)^2 = 1, you draw an ellipse of
the form (x/a*)^2 + (y/b*)^2 = 1 with (a*)^2 - (b*)^2 = a^2 - b^2
(satisfying the confocality requirement) and then a* or b* set to match
your external point. If a > b, so tht the foci ar on the x-axis then a*
is simply half the sum of the sitances from your foci to your external
point, with the foci at ((+/-)sqrt(a^2-b^2), 0). If a < b, then you
use the same formulation as above only this time b* is half the sum of
the distances to the foci, and the foci are at (0, (+/-)sqrt(b^2-a^2)).

The seoond approach is to describe the true, nonelliptical
constant-distance curve parametrically. First you must find c
numerically, as the analytic solution (as we have seen) is totally
impractical to work with. One way to do this: draw a line of slope m
from the external point to the neaest point on the ellipse, intersecting
at (u, v). This is found from the solution of a QUADRATIC equation, so
it's not unweldy; you do need to pick the closer of the two roots. Then
the slope of the tangent of the ellipse at that point is p =
(-b^2u/a^2v). Compute 1+mp. Do this for several values of m and
interpolate to approximate the one where 1+mp is zero, the condition for
the line being perpendicular to the tangent. With c determined, we then
can set up the parametric equations:

x = a cos (theta) + c dcos (phi)
y = b sin (theta) + c sin (phi)

with theta and phi in the same quadrant and phi defined so that tan
(phi) = (a/b) tan (theta).

--OL
Back to top
Hauke Reddmann
science forum Guru Wannabe


Joined: 03 May 2005
Posts: 112

PostPosted: Tue May 03, 2005 12:40 pm    Post subject: Re: ellipse: shortest distance to given point Reply with quote

Hauke Reddmann <fc3a501@uni-hamburg.de> wrote:
Quote:
indo34 <indo34@gmx.de> wrote:
(if not, how to interpret c then)? The idea is that i paint a second ellipse
around the original ellipse that
has a constant distance to the original ellipse and contains point (x,y).

But two ellipses *do not* have constant distance!

Here is the standard method I would take:
1. Draw a circle around your point (x0,y0):
(x-x0)**2+(y-y0)**2=c**2
2. It must be tangent to the ellipse
x**2/a**2+y**2/b**2=1
- if it would intersect in two points a
smaller circle would exist.
3. Eliminate x, get a quadratic for y, compute
its discriminant. It must be zero to have one
solution. Solve for c, your distance.

s/quadratic/quartic.
(See other f'up of consequences)

--
Hauke Reddmann <:-EX8 fc3a501@uni-hamburg.de
His-Ala-Sec-Lys-Glu Arg-Glu-Asp-Asp-Met-Ala-Asn-Asn
Back to top
KeithK
science forum beginner


Joined: 03 May 2005
Posts: 22

PostPosted: Tue May 03, 2005 2:54 pm    Post subject: Re: ellipse: shortest distance to given point Reply with quote

"Oscar Lanzi III" <ol3@webtv.net> wrote in message
news:26538-4277738F-339@storefull-3255.bay.webtv.net...
Quote:
To begin with, your second curve is not an ellipse. It looks like one,

Just to not confuse the troops, I think you mean the constant-distance-to
the- first -ellipse curve he wants is not an ellipse. The second equation
he was proposing:
x^2/(a + c)^2 + y^2/(b + c)^2 = 1
is, as I'm sure you were not disputing, an ellipse.

KeithK

Quote:
but no cigar. What actualy happens can be seen most clearly by
considering the limiting case where the eccentricity approaches 1 with
fixed focal points and the ellipse thus becomes a line segment. The
curve that's a constan distance from a line segment consists of two
parallel line segments connected by semicircular caps. This is not an
ellipse or any limiting case of the ellipse.

Mathematica is right to give you a complicated expression for c. To
find the point on the ellipse that's closest to a given point (x, y),
one must solve what proves to be a 4th-degree equation for one of the
coordinates of the point on the ellipse. Applying the standard
technique symbolically then gives that unwieldy expression. It gets
even worse that this, however, for the casus irreucibilis can rear its
ugly head. In the context of 4th-degree equations this refers to the
resolvent cubic having three real roots and thereby generating complex
cube roots in that complicated expression from Mathematica.
Geometrically, the casus irreducibilis occurs when there are four rather
than two lines you can draw normal to an ellipse to a given point --
essentially when the ellipse has high eccentricity and your (presumably
exterior) point is relatively close to the minor-axis diameter. (Kids,
do try this at home. It's kind of neat to see this change in in the
character of the nomals.)

Given the fact that your constant-distance curve is not an ellipse and
analytical determination of the constant distance is both unwieldy and
uncertain, there are two ways to proceed. One, which you might find
asthetically pleasing, is to draw a CONFOCAL ellipse about your original
one. Given your ellipse (x/a)^2+(y/b)^2 = 1, you draw an ellipse of
the form (x/a*)^2 + (y/b*)^2 = 1 with (a*)^2 - (b*)^2 = a^2 - b^2
(satisfying the confocality requirement) and then a* or b* set to match
your external point. If a > b, so tht the foci ar on the x-axis then a*
is simply half the sum of the sitances from your foci to your external
point, with the foci at ((+/-)sqrt(a^2-b^2), 0). If a < b, then you
use the same formulation as above only this time b* is half the sum of
the distances to the foci, and the foci are at (0, (+/-)sqrt(b^2-a^2)).

The seoond approach is to describe the true, nonelliptical
constant-distance curve parametrically. First you must find c
numerically, as the analytic solution (as we have seen) is totally
impractical to work with. One way to do this: draw a line of slope m
from the external point to the neaest point on the ellipse, intersecting
at (u, v). This is found from the solution of a QUADRATIC equation, so
it's not unweldy; you do need to pick the closer of the two roots. Then
the slope of the tangent of the ellipse at that point is p =
(-b^2u/a^2v). Compute 1+mp. Do this for several values of m and
interpolate to approximate the one where 1+mp is zero, the condition for
the line being perpendicular to the tangent. With c determined, we then
can set up the parametric equations:

x = a cos (theta) + c dcos (phi)
y = b sin (theta) + c sin (phi)

with theta and phi in the same quadrant and phi defined so that tan
(phi) = (a/b) tan (theta).

--OL
Back to top
The Last Danish Pastry
science forum Guru Wannabe


Joined: 29 Apr 2005
Posts: 176

PostPosted: Tue May 03, 2005 8:29 pm    Post subject: Re: ellipse: shortest distance to given point Reply with quote

"Oscar Lanzi III" <ol3@webtv.net> wrote in message
news:26538-4277738F-339@storefull-3255.bay.webtv.net...

Quote:
To begin with, your second curve is not an ellipse. It looks like one,
but no cigar. What actualy happens can be seen most clearly by
considering the limiting case where the eccentricity approaches 1 with
fixed focal points and the ellipse thus becomes a line segment. The
curve that's a constan distance from a line segment consists of two
parallel line segments connected by semicircular caps. This is not an
ellipse or any limiting case of the ellipse.

Mathematica is right to give you a complicated expression for c. To
find the point on the ellipse that's closest to a given point (x, y),
one must solve what proves to be a 4th-degree equation for one of the
coordinates of the point on the ellipse. Applying the standard
technique symbolically then gives that unwieldy expression. It gets
even worse that this, however, for the casus irreucibilis can rear its
ugly head. In the context of 4th-degree equations this refers to the
resolvent cubic having three real roots and thereby generating complex
cube roots in that complicated expression from Mathematica.
Geometrically, the casus irreducibilis occurs when there are four rather
than two lines you can draw normal to an ellipse to a given point --
essentially when the ellipse has high eccentricity and your (presumably
exterior) point is relatively close to the minor-axis diameter. (Kids,
do try this at home. It's kind of neat to see this change in in the
character of the nomals.)

Given the fact that your constant-distance curve is not an ellipse and
analytical determination of the constant distance is both unwieldy and
uncertain, there are two ways to proceed. One, which you might find
asthetically pleasing, is to draw a CONFOCAL ellipse about your original
one. Given your ellipse (x/a)^2+(y/b)^2 = 1, you draw an ellipse of
the form (x/a*)^2 + (y/b*)^2 = 1 with (a*)^2 - (b*)^2 = a^2 - b^2
(satisfying the confocality requirement) and then a* or b* set to match
your external point. If a > b, so tht the foci ar on the x-axis then a*
is simply half the sum of the sitances from your foci to your external
point, with the foci at ((+/-)sqrt(a^2-b^2), 0). If a < b, then you
use the same formulation as above only this time b* is half the sum of
the distances to the foci, and the foci are at (0, (+/-)sqrt(b^2-a^2)).

The seoond approach is to describe the true, nonelliptical
constant-distance curve parametrically. First you must find c
numerically, as the analytic solution (as we have seen) is totally
impractical to work with. One way to do this: draw a line of slope m
from the external point to the neaest point on the ellipse, intersecting
at (u, v). This is found from the solution of a QUADRATIC equation, so
it's not unweldy; you do need to pick the closer of the two roots. Then
the slope of the tangent of the ellipse at that point is p =
(-b^2u/a^2v). Compute 1+mp. Do this for several values of m and
interpolate to approximate the one where 1+mp is zero, the condition for
the line being perpendicular to the tangent. With c determined, we then
can set up the parametric equations:

x = a cos (theta) + c dcos (phi)
y = b sin (theta) + c sin (phi)

with theta and phi in the same quadrant and phi defined so that tan
(phi) = (a/b) tan (theta).

For some pictures see
http://mathworld.wolfram.com/ParallelCurves.html

--
Clive Tooth
http://www.clivetooth.dk
Back to top
DP
science forum beginner


Joined: 04 May 2005
Posts: 12

PostPosted: Wed May 04, 2005 12:06 pm    Post subject: Re: ellipse: shortest distance to given point Reply with quote

The shortest distance from a point on an ellipse to a point not on the
ellipse is a vector 90 deg from the ellipse.
This is the normal unit vector of the ellipse. So to get this take the grad
of that function to get this vector.
ie grad(f) = df/dx (i) + df/dy (j)
So the unit normal for an ellipse of the form x^2/a^2 + y^2/b^2 = c is:
un = ( (2/a^2)x, (2/b^2)y ) / ||( (2/a^2)x, (2/b^2)y )||
Now if we have two point, p1 and p2 with p1 being of the ellipse its just
nat (normal at point) = un (dot product) p1
then just find the vector from nat to p2 then find the length
So,
shortest distance = || p2 - nat ||

Hope that helps
DP

"indo34" <indo34@gmx.de> wrote in message
news:d57lf7$18f6$1@ulysses.news.tiscali.de...
Quote:
Hello
I have an ellipse with x-axis-radius a and y-axis-radius b.
Thus the ellipse fulfills the equation
x^2/a^2 + y^2/b^2 = 1
for every (x,y) on that ellipse.
For a point (x,y) not on this ellipse, is it right that the solution for
x^2/(a + c)^2 + y^2/(b + c)^2 = 1
on variable c yields the minimal distance c from (x,y) to some point on
the original ellipse
(if not, how to interpret c then)? The idea is that i paint a second
ellipse around the original ellipse that
has a constant distance to the original ellipse and contains point (x,y).
(I am only interested in the first quarter of the ellipse by the way.)
Mathematica gives a very long solution on c (several pages) so it seams
faster to
compute it by newton approximation or secant approximation (for the
solution datatype "double").
Any one know what approximation method yields at fastest the result?

thanks
Back to top
DP
science forum beginner


Joined: 04 May 2005
Posts: 12

PostPosted: Wed May 04, 2005 12:16 pm    Post subject: Re: ellipse: shortest distance to given point Reply with quote

Correction, dont (un (dot product) p1) just (un multiply p1), go on from
there.
Cheers
DP


"DP" <me@myplace.com> wrote in message
news:4278d667$0$27605$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
Quote:
The shortest distance from a point on an ellipse to a point not on the
ellipse is a vector 90 deg from the ellipse.
This is the normal unit vector of the ellipse. So to get this take the
grad of that function to get this vector.
ie grad(f) = df/dx (i) + df/dy (j)
So the unit normal for an ellipse of the form x^2/a^2 + y^2/b^2 = c is:
un = ( (2/a^2)x, (2/b^2)y ) / ||( (2/a^2)x, (2/b^2)y )||
Now if we have two point, p1 and p2 with p1 being of the ellipse its just
nat (normal at point) = un (dot product) p1
then just find the vector from nat to p2 then find the length
So,
shortest distance = || p2 - nat ||

Hope that helps
DP

"indo34" <indo34@gmx.de> wrote in message
news:d57lf7$18f6$1@ulysses.news.tiscali.de...
Hello
I have an ellipse with x-axis-radius a and y-axis-radius b.
Thus the ellipse fulfills the equation
x^2/a^2 + y^2/b^2 = 1
for every (x,y) on that ellipse.
For a point (x,y) not on this ellipse, is it right that the solution for
x^2/(a + c)^2 + y^2/(b + c)^2 = 1
on variable c yields the minimal distance c from (x,y) to some point on
the original ellipse
(if not, how to interpret c then)? The idea is that i paint a second
ellipse around the original ellipse that
has a constant distance to the original ellipse and contains point (x,y).
(I am only interested in the first quarter of the ellipse by the way.)
Mathematica gives a very long solution on c (several pages) so it seams
faster to
compute it by newton approximation or secant approximation (for the
solution datatype "double").
Any one know what approximation method yields at fastest the result?

thanks


Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [8 Posts] View previous topic :: View next topic
The time now is Fri Jan 09, 2009 10:06 pm | All times are GMT
Forum index » Science and Technology » Math
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Uniform point picking on a hexagon, e... Olw Math 3 Wed Jul 19, 2006 9:21 pm
No new posts Point Defects in Emergent Vacuum ODLR... Jack Sarfatti Math 0 Tue Jul 18, 2006 10:52 pm
No new posts Tarski fixed-point theorem William Elliot Math 14 Tue Jul 18, 2006 10:24 am
No new posts Instantaneous Action at a Distance Phil Gardner Research 1 Mon Jul 17, 2006 3:32 pm
No new posts distance matrix consolidation bird Math 6 Sat Jul 15, 2006 9:05 pm

Loans | Homeowner Loans | Ringtone | Bankruptcy | Problem Mortgage
Copyright © 2004-2005 DeniX Solutions SRL
Other DeniX Solutions sites: Electronics forum |  Medicine forum |  Unix/Linux blog |  Unix/Linux documentation |  Unix/Linux forums


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 7.4104s ][ Queries: 16 (6.6951s) ][ GZIP on - Debug on ]