Monday, December 7, 2009

Mimimum distance from point to a curve

1. Assume we already know the function of curve: y=f(x); Given a point p(x1,y1), calculate the minimum distance:

D=sqrt((x-x1)^2+(y-y1)^2);

D*=(x-x1)^2+(y-y1)^2;

substitute y by f(x);

D*=(x-x1)^2+(f(x)-y1)^2;

Compute the derivative of D* and set it to zero: D*'=0, then we can solve x; substitute x , we get minimum distance D*;

2. The other one is no function expression of curve. We need calculate all points.

No comments: