In general there will be no closed form solution. In fact, for a general
curve in N dimensions one can have multiple discrete solutions or even a
continuum of solutions. A trivial example of this is a problem of finding
a point on a circle in 2D closest to its center.
A curve in N dimensions can be described by a set of N coordinate functions
of a single parameter. For example, a straight line in 3D going through
the (x0, y0, z0) point and having the "directional vector" (a, b, c) can be
described by
x(t) = x0 + a*t
y(t) = y0 + b*t
z(t) = z0 + c*t
Then, the (Euclidean) distance between an arbitrary point (x1, y1, z1) and
a point on the curve can be written as:
d(t) = sqrt((x(t) - x1)^2 + (y(t) - y1)^2 + (z(t) - z1)^2).
This function could be minimized either analytically or numerically with
respect to t. In the straight line example, an analytical solution is
possible. In fact the minimum value of the parameter t happens to be
t(min) = (a*(x1-x0) + b*(y1-y0) + c*(z1-z0))/(a^2 + b^2 + c^2)
and substituting this value into the line equations gives the coordinates
of the minimum solution.
Hope this helps,
Andy
__________________________________
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-----
E-mail: [EMAIL PROTECTED]
Tel: (651) 733-6092
Fax: (651) 736-3122
|---------+-------------------------------->
| | "Feng Zhang" |
| | <[EMAIL PROTECTED]|
| | u> |
| | Sent by: |
| | [EMAIL PROTECTED]|
| | ath.ethz.ch |
| | |
| | |
| | 02/10/2004 09:17 |
| | |
|---------+-------------------------------->
>-----------------------------------------------------------------------------------------------------------------------------|
|
|
| To: "R-help mailing list" <[EMAIL PROTECTED]>
|
| cc:
|
| Subject: [R] How to compute the minimal distanct between a point and curve
in N-dim space |
>-----------------------------------------------------------------------------------------------------------------------------|
Dear All,
In the N-dimensional space, give a data point A and a curve f,
how to write the explicit expression for calculating the
minimal distance between A and f?
Or have to use some nonlinear optimization method to calcualte it?
Thanks for your point.
Fred
[[alternative HTML version deleted]]
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html