"Sean" wrote in message <k5shn7$c08$1@newscl01ah.mathworks.com>...
> I have a set of 2000 X,Y,Z data points creating a rectangle with rounded corners.
>
> Here is a plot of my data:
> http://i.imgur.com/TYtPJ.jpg
>
> I need to verify that each x,y,z point is within a certain distance from a calculated path of the same shape. I plan on recreating this plot with calculated points, 4 line segments and 4 curves, and then comparing the distance of each point in my dataset to the appropriate segment that I calculate.
>
> I am using the following for finding distance between a point and line, I am struggling with creating the arcs/curves in 3D. I have the 2 end points and the radius. I then need to compare distance of a 3D point to this 3D curve... Any help would be greatly appreciated.
Find a distance d from a point P to a curve C(t) is a 1D minimization problem underconstraints.
tmin argmin f(t) :=  C(t) P ^2
with a constraint t in [0,1].
d = f(tmin).
Write down the EulerLagrange for unconstrained problem, that allows tp solve to "te", check if te in [0,1].
 If yes take tmin = argmin f(t) i in { 0, 1, te }.
 If no take tmin = argmin f(t) i in { 0, 1 }.
Apply this for C(t) = quarter circle, or segment line.
Bruno
