Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Distance from 3D point to line segments
Date: Fri, 19 Oct 2012 21:46:15 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 16
Message-ID: <k5shn7$c08$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-04-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1350683175 12296 172.30.248.35 (19 Oct 2012 21:46:15 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 19 Oct 2012 21:46:15 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1117006
Xref: news.mathworks.com comp.soft-sys.matlab:781005

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.


%loop comparing distance of every found point to calculated line with end points P1_1 and P1_2

for i=min:max
	point=[x(i),y(i),z(i)]
 	error(i) = norm(cross(P1_2-P1_1,point-P1_1))/norm(P1_2-P1_1)
end