|
From: Andrew S. <str...@as...> - 2009-02-20 10:32:43
|
G. Allegri wrote: > Hi Andrew. > With dist(point_i,polynomial_curve) do you mean point_i belonging to > the Line 2 set of points and pol_curve as Line 1? yes > In this case it > could be reasonably ok for me. How can I derive the closed form for > dist()? Excuse my ignorance with geometry.... > Take the equation for line 1parameterized by s. Something like f(s) = (x,y) = (as**2 + bs +c, ds**2 + es + f ) for your polynomial model. Now, the distance for that point on line 1 from point i is dist(point_i, f(s)), where dist can be Euclidean distance, for example. So, the question is what value of s minimizes the distance. Since this function will be smallest at an inflection, just take the derivative of your distance function and solve for it to be equal to zero. Hopefully this function will be convex and you'll have only one zero, which will tell you the value of s where distance is a minimum. Otherwise, pick the inflection at the closest distance. Finally, repeat for all points i and sum the results. Hopefully that helps on the conceptual side. Sympy will be more useful than matplotlib on the coding side... |