<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048</link>
    <title>MATLAB Central Newsreader - distance between point and line segment</title>
    <description>Feed for thread: distance between point and line segment</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2008 by The MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>The MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 19 Feb 2008 05:39:35 -0500</pubDate>
      <title>distance between point and line segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#415946</link>
      <author>Steve</author>
      <description>Is there a simple way to find the distance between a line segment and&lt;br&gt;
a point?  I'm looking for the 2D case specifically, but the more&lt;br&gt;
general 3D case would also be nice to know...&lt;br&gt;
Thanks.&lt;br&gt;
-Steve&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 19 Feb 2008 05:53:02 -0500</pubDate>
      <title>Re: distance between point and line segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#415948</link>
      <author>Roger Stafford</author>
      <description>Steve &amp;lt;srjm72499@gmail.com&amp;gt; wrote in message &amp;lt;4a2f4ac1-&lt;br&gt;
c21e-4ebf-8530-352f15098a47@41g2000hsc.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Is there a simple way to find the distance between a line segment and&lt;br&gt;
&amp;gt; a point?  I'm looking for the 2D case specifically, but the more&lt;br&gt;
&amp;gt; general 3D case would also be nice to know...&lt;br&gt;
&amp;gt; Thanks.&lt;br&gt;
&amp;gt; -Steve&lt;br&gt;
-------&lt;br&gt;
&amp;nbsp;&amp;nbsp;Let Q1 and Q2 be endpoints (or any two distinct points) of the line segment &lt;br&gt;
and P the point in question, then&lt;br&gt;
&lt;br&gt;
&amp;nbsp;d = abs(cross(Q2-Q1,P-Q1))/abs(Q2-Q1);&lt;br&gt;
&lt;br&gt;
will give the requested orthogonal distance.&lt;br&gt;
&lt;br&gt;
Roger Stafford&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Sat, 29 Mar 2008 15:15:04 -0400</pubDate>
      <title>Re: distance between point and line segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#423475</link>
      <author>Chukwuemeka Igwe</author>
      <description>"Roger Stafford" &lt;br&gt;
&amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in &lt;br&gt;
message &amp;lt;fpdqru$8lg$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Steve &amp;lt;srjm72499@gmail.com&amp;gt; wrote in message &amp;lt;4a2f4ac1-&lt;br&gt;
&amp;gt; c21e-4ebf-8530-&lt;br&gt;
352f15098a47@41g2000hsc.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Is there a simple way to find the distance between a &lt;br&gt;
line segment and&lt;br&gt;
&amp;gt; &amp;gt; a point?  I'm looking for the 2D case specifically, &lt;br&gt;
but the more&lt;br&gt;
&amp;gt; &amp;gt; general 3D case would also be nice to know...&lt;br&gt;
&amp;gt; &amp;gt; Thanks.&lt;br&gt;
&amp;gt; &amp;gt; -Steve&lt;br&gt;
&amp;gt; -------&lt;br&gt;
&amp;gt;   Let Q1 and Q2 be endpoints (or any two distinct &lt;br&gt;
points) of the line segment &lt;br&gt;
&amp;gt; and P the point in question, then&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d = abs(cross(Q2-Q1,P-Q1))/abs(Q2-Q1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; will give the requested orthogonal distance.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&amp;gt; &lt;br&gt;
Roger,&lt;br&gt;
&lt;br&gt;
This fromual needs that the point be specified for the z &lt;br&gt;
axis. &lt;br&gt;
&lt;br&gt;
Do you use z= 0 or z =1?&lt;br&gt;
&lt;br&gt;
Chuk&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Sat, 29 Mar 2008 15:31:01 -0400</pubDate>
      <title>Re: distance between point and line segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#423477</link>
      <author>Chukwuemeka Igwe</author>
      <description>"Roger Stafford" &lt;br&gt;
&amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in &lt;br&gt;
message &amp;lt;fpdqru$8lg$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Steve &amp;lt;srjm72499@gmail.com&amp;gt; wrote in message &amp;lt;4a2f4ac1-&lt;br&gt;
&amp;gt; c21e-4ebf-8530-&lt;br&gt;
352f15098a47@41g2000hsc.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Is there a simple way to find the distance between a &lt;br&gt;
line segment and&lt;br&gt;
&amp;gt; &amp;gt; a point?  I'm looking for the 2D case specifically, &lt;br&gt;
but the more&lt;br&gt;
&amp;gt; &amp;gt; general 3D case would also be nice to know...&lt;br&gt;
&amp;gt; &amp;gt; Thanks.&lt;br&gt;
&amp;gt; &amp;gt; -Steve&lt;br&gt;
&amp;gt; -------&lt;br&gt;
&amp;gt;   Let Q1 and Q2 be endpoints (or any two distinct &lt;br&gt;
points) of the line segment &lt;br&gt;
&amp;gt; and P the point in question, then&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d = abs(cross(Q2-Q1,P-Q1))/abs(Q2-Q1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; will give the requested orthogonal distance.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&amp;gt; Also is there a simple way to know if the distances are &lt;br&gt;
on the same side or oposite sides of the line?&lt;br&gt;
&lt;br&gt;
Thanks for your help&lt;br&gt;
&lt;br&gt;
Chuk&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Sat, 29 Mar 2008 17:31:02 -0400</pubDate>
      <title>Re: distance between point and line segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#423494</link>
      <author>Roger Stafford</author>
      <description>"Chukwuemeka Igwe" &amp;lt;chukigwe@yahoo.com&amp;gt; wrote in message &amp;lt;fslmdo&lt;br&gt;
$7qg$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; This fromual needs that the point be specified for the z axis. &lt;br&gt;
&amp;gt; Do you use z= 0 or z =1?&lt;br&gt;
&amp;gt; Chuk&lt;br&gt;
--------&lt;br&gt;
&amp;nbsp;&amp;nbsp;The formula I gave:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;d = abs(cross(Q2-Q1,P-Q1))/abs(Q2-Q1);&lt;br&gt;
&lt;br&gt;
was meant for the 3D case.  For the 2D case it becomes&lt;br&gt;
&lt;br&gt;
&amp;nbsp;d = abs(det([Q2-Q1,P-Q1]))/abs(Q2-Q1);&lt;br&gt;
&lt;br&gt;
if P, Q1, and Q2 are column vectors, or&lt;br&gt;
&lt;br&gt;
&amp;nbsp;d = abs(det([Q2-Q1;P-Q1]))/abs(Q2-Q1);&lt;br&gt;
&lt;br&gt;
if they are row vectors.&lt;br&gt;
&lt;br&gt;
Roger Stafford&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Sun, 30 Mar 2008 04:11:58 -0400</pubDate>
      <title>Re: distance between point and line segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#423559</link>
      <author>ImageAnalyst</author>
      <description>On Feb 19, 1:39=A0am, Steve &amp;lt;srjm72...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Is there a simple way to find the distance between a line segment and&lt;br&gt;
&amp;gt; a point? =A0I'm looking for the 2D case specifically, but the more&lt;br&gt;
&amp;gt; general 3D case would also be nice to know...&lt;br&gt;
&amp;gt; Thanks.&lt;br&gt;
&amp;gt; -Steve&lt;br&gt;
&lt;br&gt;
Steve:&lt;br&gt;
Yep, the 3 D case is here:&lt;br&gt;
&lt;a href="http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html"&gt;http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html&lt;/a&gt;&lt;br&gt;
(See equation 4.)&lt;br&gt;
&lt;br&gt;
The 2D case is here:&lt;br&gt;
&lt;a href="http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html"&gt;http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html&lt;/a&gt;&lt;br&gt;
(See especially equation 11.)&lt;br&gt;
&lt;br&gt;
Glad to help,&lt;br&gt;
ImageAnalyst&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Mon, 31 Mar 2008 21:18:03 -0400</pubDate>
      <title>Re: distance between point and line segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#423852</link>
      <author>Chukwuemeka Igwe</author>
      <description>Yes thanks for your replies.&lt;br&gt;
&lt;br&gt;
However if I  use the cross product and assume that the z &lt;br&gt;
axis  have zero components  I actually get some reuslts &lt;br&gt;
which are more than an order of magnitude bigger thant the &lt;br&gt;
case when I use the determinant to solve for two &lt;br&gt;
dimensions.&lt;br&gt;
Please what is happening to cause such a difference in &lt;br&gt;
results.&lt;br&gt;
&lt;br&gt;
Thanks &lt;br&gt;
&lt;br&gt;
Chuk&lt;br&gt;
&lt;br&gt;
ImageAnalyst &amp;lt;imageanalyst@mailinator.com&amp;gt; wrote in &lt;br&gt;
message &amp;lt;d122bed7-41d5-446a-8b0a-&lt;br&gt;
e786bdb938fb@a22g2000hsc.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On Feb 19, 1:39=A0am, Steve &amp;lt;srjm72...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; Is there a simple way to find the distance between a &lt;br&gt;
line segment and&lt;br&gt;
&amp;gt; &amp;gt; a point? =A0I'm looking for the 2D case specifically, &lt;br&gt;
but the more&lt;br&gt;
&amp;gt; &amp;gt; general 3D case would also be nice to know...&lt;br&gt;
&amp;gt; &amp;gt; Thanks.&lt;br&gt;
&amp;gt; &amp;gt; -Steve&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Steve:&lt;br&gt;
&amp;gt; Yep, the 3 D case is here:&lt;br&gt;
&amp;gt; &lt;a href="http://mathworld.wolfram.com/Point-LineDistance3-"&gt;http://mathworld.wolfram.com/Point-LineDistance3-&lt;/a&gt;&lt;br&gt;
Dimensional.html&lt;br&gt;
&amp;gt; (See equation 4.)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The 2D case is here:&lt;br&gt;
&amp;gt; &lt;a href="http://mathworld.wolfram.com/Point-LineDistance2-"&gt;http://mathworld.wolfram.com/Point-LineDistance2-&lt;/a&gt;&lt;br&gt;
Dimensional.html&lt;br&gt;
&amp;gt; (See especially equation 11.)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Glad to help,&lt;br&gt;
&amp;gt; ImageAnalyst&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 01 Apr 2008 00:32:05 -0400</pubDate>
      <title>Re: distance between point and line segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#423879</link>
      <author>Roger Stafford</author>
      <description>"Chukwuemeka Igwe" &amp;lt;chukigwe@yahoo.com&amp;gt; wrote in message &amp;lt;fsrkeb&lt;br&gt;
$os2$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Yes thanks for your replies.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; However if I  use the cross product and assume that the z &lt;br&gt;
&amp;gt; axis  have zero components  I actually get some reuslts &lt;br&gt;
&amp;gt; which are more than an order of magnitude bigger thant the &lt;br&gt;
&amp;gt; case when I use the determinant to solve for two &lt;br&gt;
&amp;gt; dimensions.&lt;br&gt;
&amp;gt; Please what is happening to cause such a difference in &lt;br&gt;
&amp;gt; results.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Chuk&lt;br&gt;
--------&lt;br&gt;
&amp;nbsp;&amp;nbsp;First of all, Chuk, let me apologize for the errors in the formulas I gave back &lt;br&gt;
on Feb. 19, and for not noticing them this past Saturday.  I cannot imagine &lt;br&gt;
what I was thinking of.  The 3D formula should read:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;d = norm(cross(Q2-Q1,P-Q1))/norm(Q2-Q1);&lt;br&gt;
&lt;br&gt;
and the 2D versions ought to read:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;d = abs(det([Q2-Q1,P-Q1]))/norm(Q2-Q1); % for col. vectors&lt;br&gt;
&amp;nbsp;d = abs(det([Q2-Q1;P-Q1]))/norm(Q2-Q1); % for row vectors.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;In this corrected form the 3D formula is identical to the formula (9) of the &lt;br&gt;
website:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&lt;a href="http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html"&gt;http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
which ImageAnalyst mentioned.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;A note of caution!  Formula (4) at that website, which ImageAnalyst also &lt;br&gt;
mentioned, while being mathematically equivalent to its formula (9), is not as &lt;br&gt;
computationally robust as (9) in cases where the triangle PQ1Q2 is nearly flat, &lt;br&gt;
that is, where it has two angles nearly zero and one nearly pi.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Here is a concrete example of such a loss of accuracy:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;Q1 = [0;0;0]; Q2 = [2;4;6]; P = [1.00001;1.99998;3.00001];&lt;br&gt;
&lt;br&gt;
This point P will lie very close to the line Q1Q2 (actually very near its &lt;br&gt;
midpoint.)  We can then compare three different ways of computing the &lt;br&gt;
orthogonal distance.  First, use formula (4)&lt;br&gt;
&lt;br&gt;
&amp;nbsp;d1 = sqrt(norm(Q2-Q1)^2*norm(P-Q1)^2-dot(Q2-Q1,P-Q1)^2)/norm(Q2-&lt;br&gt;
Q1);&lt;br&gt;
&lt;br&gt;
Then use my cross product formula which is also formula (9):&lt;br&gt;
&lt;br&gt;
&amp;nbsp;d2 = norm(cross(Q2-Q1,P-Q1))/norm(Q2-Q1);&lt;br&gt;
&lt;br&gt;
and finally, as a check, directly compute the nearest point, R, on line Q1Q2 &lt;br&gt;
and then compute its distance from P:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;R = (dot(P-Q2,Q1-Q2)*Q1+dot(P-Q1,Q2-Q1)*Q2)/dot(Q2-Q1,Q2-Q1);&lt;br&gt;
&amp;nbsp;d3 = norm(R-P);&lt;br&gt;
&lt;br&gt;
Now compare the answers using 'format long':&lt;br&gt;
&lt;br&gt;
&amp;nbsp;[d1;d2;d3]&lt;br&gt;
&amp;nbsp;ans =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;1.0e-04 *&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.24494825921622&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.24494897427992&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;0.24494897427992&lt;br&gt;
&lt;br&gt;
Formula (4) is off in the 7th place while the other two methods preserve &lt;br&gt;
normal matlab accuracy.&lt;br&gt;
&lt;br&gt;
Roger Stafford&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 02 Apr 2008 15:29:07 -0400</pubDate>
      <title>Re: distance between point and line segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#424243</link>
      <author>Chukwuemeka Igwe</author>
      <description>&lt;br&gt;
&lt;br&gt;
Thanks Roger.&lt;br&gt;
In the realm of GPS, latiudes and longitudes, the &lt;br&gt;
difference in the result is quite significant in terms of &lt;br&gt;
acuracy of distances in meters and centimeter.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Chuk&lt;br&gt;
&lt;br&gt;
"Roger Stafford" &lt;br&gt;
&amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in &lt;br&gt;
message &amp;lt;fsrvq5$5cu$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; "Chukwuemeka Igwe" &amp;lt;chukigwe@yahoo.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fsrkeb&lt;br&gt;
&amp;gt; $os2$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Yes thanks for your replies.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; However if I  use the cross product and assume that &lt;br&gt;
the z &lt;br&gt;
&amp;gt; &amp;gt; axis  have zero components  I actually get some &lt;br&gt;
reuslts &lt;br&gt;
&amp;gt; &amp;gt; which are more than an order of magnitude bigger thant &lt;br&gt;
the &lt;br&gt;
&amp;gt; &amp;gt; case when I use the determinant to solve for two &lt;br&gt;
&amp;gt; &amp;gt; dimensions.&lt;br&gt;
&amp;gt; &amp;gt; Please what is happening to cause such a difference in &lt;br&gt;
&amp;gt; &amp;gt; results.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Chuk&lt;br&gt;
&amp;gt; --------&lt;br&gt;
&amp;gt;   First of all, Chuk, let me apologize for the errors in &lt;br&gt;
the formulas I gave back &lt;br&gt;
&amp;gt; on Feb. 19, and for not noticing them this past &lt;br&gt;
Saturday.  I cannot imagine &lt;br&gt;
&amp;gt; what I was thinking of.  The 3D formula should read:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d = norm(cross(Q2-Q1,P-Q1))/norm(Q2-Q1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; and the 2D versions ought to read:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d = abs(det([Q2-Q1,P-Q1]))/norm(Q2-Q1); % for col. &lt;br&gt;
vectors&lt;br&gt;
&amp;gt;  d = abs(det([Q2-Q1;P-Q1]))/norm(Q2-Q1); % for row &lt;br&gt;
vectors.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   In this corrected form the 3D formula is identical to &lt;br&gt;
the formula (9) of the &lt;br&gt;
&amp;gt; website:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  &lt;a href="http://mathworld.wolfram.com/Point-LineDistance3-"&gt;http://mathworld.wolfram.com/Point-LineDistance3-&lt;/a&gt;&lt;br&gt;
Dimensional.html&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; which ImageAnalyst mentioned.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   A note of caution!  Formula (4) at that website, which &lt;br&gt;
ImageAnalyst also &lt;br&gt;
&amp;gt; mentioned, while being mathematically equivalent to its &lt;br&gt;
formula (9), is not as &lt;br&gt;
&amp;gt; computationally robust as (9) in cases where the &lt;br&gt;
triangle PQ1Q2 is nearly flat, &lt;br&gt;
&amp;gt; that is, where it has two angles nearly zero and one &lt;br&gt;
nearly pi.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   Here is a concrete example of such a loss of accuracy:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  Q1 = [0;0;0]; Q2 = [2;4;6]; P = &lt;br&gt;
[1.00001;1.99998;3.00001];&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This point P will lie very close to the line Q1Q2 &lt;br&gt;
(actually very near its &lt;br&gt;
&amp;gt; midpoint.)  We can then compare three different ways of &lt;br&gt;
computing the &lt;br&gt;
&amp;gt; orthogonal distance.  First, use formula (4)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d1 = sqrt(norm(Q2-Q1)^2*norm(P-Q1)^2-dot(Q2-Q1,P-Q1)&lt;br&gt;
^2)/norm(Q2-&lt;br&gt;
&amp;gt; Q1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Then use my cross product formula which is also formula &lt;br&gt;
(9):&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d2 = norm(cross(Q2-Q1,P-Q1))/norm(Q2-Q1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; and finally, as a check, directly compute the nearest &lt;br&gt;
point, R, on line Q1Q2 &lt;br&gt;
&amp;gt; and then compute its distance from P:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  R = (dot(P-Q2,Q1-Q2)*Q1+dot(P-Q1,Q2-Q1)*Q2)/dot(Q2-&lt;br&gt;
Q1,Q2-Q1);&lt;br&gt;
&amp;gt;  d3 = norm(R-P);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Now compare the answers using 'format long':&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  [d1;d2;d3]&lt;br&gt;
&amp;gt;  ans =&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;    1.0e-04 *&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;    0.24494825921622&lt;br&gt;
&amp;gt;    0.24494897427992&lt;br&gt;
&amp;gt;    0.24494897427992&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Formula (4) is off in the 7th place while the other two &lt;br&gt;
methods preserve &lt;br&gt;
&amp;gt; normal matlab accuracy.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 02 Apr 2008 18:00:20 -0400</pubDate>
      <title>Re: distance between point and line segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#424296</link>
      <author>Chukwuemeka Igwe</author>
      <description>&lt;br&gt;
&lt;br&gt;
Thanks Roger.&lt;br&gt;
In the realm of GPS, latiudes and longitudes, the &lt;br&gt;
difference in the result is quite significant in terms of &lt;br&gt;
acuracy of distances in meters and centimeter.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Chuk&lt;br&gt;
&lt;br&gt;
"Roger Stafford" &lt;br&gt;
&amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in &lt;br&gt;
message &amp;lt;fsrvq5$5cu$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; "Chukwuemeka Igwe" &amp;lt;chukigwe@yahoo.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fsrkeb&lt;br&gt;
&amp;gt; $os2$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Yes thanks for your replies.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; However if I  use the cross product and assume that &lt;br&gt;
the z &lt;br&gt;
&amp;gt; &amp;gt; axis  have zero components  I actually get some &lt;br&gt;
reuslts &lt;br&gt;
&amp;gt; &amp;gt; which are more than an order of magnitude bigger thant &lt;br&gt;
the &lt;br&gt;
&amp;gt; &amp;gt; case when I use the determinant to solve for two &lt;br&gt;
&amp;gt; &amp;gt; dimensions.&lt;br&gt;
&amp;gt; &amp;gt; Please what is happening to cause such a difference in &lt;br&gt;
&amp;gt; &amp;gt; results.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Chuk&lt;br&gt;
&amp;gt; --------&lt;br&gt;
&amp;gt;   First of all, Chuk, let me apologize for the errors in &lt;br&gt;
the formulas I gave back &lt;br&gt;
&amp;gt; on Feb. 19, and for not noticing them this past &lt;br&gt;
Saturday.  I cannot imagine &lt;br&gt;
&amp;gt; what I was thinking of.  The 3D formula should read:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d = norm(cross(Q2-Q1,P-Q1))/norm(Q2-Q1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; and the 2D versions ought to read:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d = abs(det([Q2-Q1,P-Q1]))/norm(Q2-Q1); % for col. &lt;br&gt;
vectors&lt;br&gt;
&amp;gt;  d = abs(det([Q2-Q1;P-Q1]))/norm(Q2-Q1); % for row &lt;br&gt;
vectors.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   In this corrected form the 3D formula is identical to &lt;br&gt;
the formula (9) of the &lt;br&gt;
&amp;gt; website:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  &lt;a href="http://mathworld.wolfram.com/Point-LineDistance3-"&gt;http://mathworld.wolfram.com/Point-LineDistance3-&lt;/a&gt;&lt;br&gt;
Dimensional.html&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; which ImageAnalyst mentioned.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   A note of caution!  Formula (4) at that website, which &lt;br&gt;
ImageAnalyst also &lt;br&gt;
&amp;gt; mentioned, while being mathematically equivalent to its &lt;br&gt;
formula (9), is not as &lt;br&gt;
&amp;gt; computationally robust as (9) in cases where the &lt;br&gt;
triangle PQ1Q2 is nearly flat, &lt;br&gt;
&amp;gt; that is, where it has two angles nearly zero and one &lt;br&gt;
nearly pi.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   Here is a concrete example of such a loss of accuracy:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  Q1 = [0;0;0]; Q2 = [2;4;6]; P = &lt;br&gt;
[1.00001;1.99998;3.00001];&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This point P will lie very close to the line Q1Q2 &lt;br&gt;
(actually very near its &lt;br&gt;
&amp;gt; midpoint.)  We can then compare three different ways of &lt;br&gt;
computing the &lt;br&gt;
&amp;gt; orthogonal distance.  First, use formula (4)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d1 = sqrt(norm(Q2-Q1)^2*norm(P-Q1)^2-dot(Q2-Q1,P-Q1)&lt;br&gt;
^2)/norm(Q2-&lt;br&gt;
&amp;gt; Q1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Then use my cross product formula which is also formula &lt;br&gt;
(9):&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d2 = norm(cross(Q2-Q1,P-Q1))/norm(Q2-Q1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; and finally, as a check, directly compute the nearest &lt;br&gt;
point, R, on line Q1Q2 &lt;br&gt;
&amp;gt; and then compute its distance from P:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  R = (dot(P-Q2,Q1-Q2)*Q1+dot(P-Q1,Q2-Q1)*Q2)/dot(Q2-&lt;br&gt;
Q1,Q2-Q1);&lt;br&gt;
&amp;gt;  d3 = norm(R-P);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Now compare the answers using 'format long':&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  [d1;d2;d3]&lt;br&gt;
&amp;gt;  ans =&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;    1.0e-04 *&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;    0.24494825921622&lt;br&gt;
&amp;gt;    0.24494897427992&lt;br&gt;
&amp;gt;    0.24494897427992&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Formula (4) is off in the 7th place while the other two &lt;br&gt;
methods preserve &lt;br&gt;
&amp;gt; normal matlab accuracy.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 03 Apr 2008 13:29:03 -0400</pubDate>
      <title>Distance between point and circular segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#424474</link>
      <author>Chukwuemeka Igwe</author>
      <description>Roger,&lt;br&gt;
&lt;br&gt;
Does htere exist a similar closed formula for finding the &lt;br&gt;
nearest distance to a circle with three points specified &lt;br&gt;
or we may have to apeal to the idea of a langragian &lt;br&gt;
mulitplier or similar contrivance?&lt;br&gt;
&lt;br&gt;
Sincerely,&lt;br&gt;
&lt;br&gt;
Chuk.&lt;br&gt;
&lt;br&gt;
"Roger Stafford" &lt;br&gt;
&amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in &lt;br&gt;
message &amp;lt;fsrvq5$5cu$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; "Chukwuemeka Igwe" &amp;lt;chukigwe@yahoo.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fsrkeb&lt;br&gt;
&amp;gt; $os2$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Yes thanks for your replies.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; However if I  use the cross product and assume that &lt;br&gt;
the z &lt;br&gt;
&amp;gt; &amp;gt; axis  have zero components  I actually get some &lt;br&gt;
reuslts &lt;br&gt;
&amp;gt; &amp;gt; which are more than an order of magnitude bigger thant &lt;br&gt;
the &lt;br&gt;
&amp;gt; &amp;gt; case when I use the determinant to solve for two &lt;br&gt;
&amp;gt; &amp;gt; dimensions.&lt;br&gt;
&amp;gt; &amp;gt; Please what is happening to cause such a difference in &lt;br&gt;
&amp;gt; &amp;gt; results.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Chuk&lt;br&gt;
&amp;gt; --------&lt;br&gt;
&amp;gt;   First of all, Chuk, let me apologize for the errors in &lt;br&gt;
the formulas I gave back &lt;br&gt;
&amp;gt; on Feb. 19, and for not noticing them this past &lt;br&gt;
Saturday.  I cannot imagine &lt;br&gt;
&amp;gt; what I was thinking of.  The 3D formula should read:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d = norm(cross(Q2-Q1,P-Q1))/norm(Q2-Q1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; and the 2D versions ought to read:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d = abs(det([Q2-Q1,P-Q1]))/norm(Q2-Q1); % for col. &lt;br&gt;
vectors&lt;br&gt;
&amp;gt;  d = abs(det([Q2-Q1;P-Q1]))/norm(Q2-Q1); % for row &lt;br&gt;
vectors.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   In this corrected form the 3D formula is identical to &lt;br&gt;
the formula (9) of the &lt;br&gt;
&amp;gt; website:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  &lt;a href="http://mathworld.wolfram.com/Point-LineDistance3-"&gt;http://mathworld.wolfram.com/Point-LineDistance3-&lt;/a&gt;&lt;br&gt;
Dimensional.html&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; which ImageAnalyst mentioned.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   A note of caution!  Formula (4) at that website, which &lt;br&gt;
ImageAnalyst also &lt;br&gt;
&amp;gt; mentioned, while being mathematically equivalent to its &lt;br&gt;
formula (9), is not as &lt;br&gt;
&amp;gt; computationally robust as (9) in cases where the &lt;br&gt;
triangle PQ1Q2 is nearly flat, &lt;br&gt;
&amp;gt; that is, where it has two angles nearly zero and one &lt;br&gt;
nearly pi.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   Here is a concrete example of such a loss of accuracy:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  Q1 = [0;0;0]; Q2 = [2;4;6]; P = &lt;br&gt;
[1.00001;1.99998;3.00001];&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This point P will lie very close to the line Q1Q2 &lt;br&gt;
(actually very near its &lt;br&gt;
&amp;gt; midpoint.)  We can then compare three different ways of &lt;br&gt;
computing the &lt;br&gt;
&amp;gt; orthogonal distance.  First, use formula (4)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d1 = sqrt(norm(Q2-Q1)^2*norm(P-Q1)^2-dot(Q2-Q1,P-Q1)&lt;br&gt;
^2)/norm(Q2-&lt;br&gt;
&amp;gt; Q1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Then use my cross product formula which is also formula &lt;br&gt;
(9):&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  d2 = norm(cross(Q2-Q1,P-Q1))/norm(Q2-Q1);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; and finally, as a check, directly compute the nearest &lt;br&gt;
point, R, on line Q1Q2 &lt;br&gt;
&amp;gt; and then compute its distance from P:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  R = (dot(P-Q2,Q1-Q2)*Q1+dot(P-Q1,Q2-Q1)*Q2)/dot(Q2-&lt;br&gt;
Q1,Q2-Q1);&lt;br&gt;
&amp;gt;  d3 = norm(R-P);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Now compare the answers using 'format long':&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  [d1;d2;d3]&lt;br&gt;
&amp;gt;  ans =&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;    1.0e-04 *&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;    0.24494825921622&lt;br&gt;
&amp;gt;    0.24494897427992&lt;br&gt;
&amp;gt;    0.24494897427992&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Formula (4) is off in the 7th place while the other two &lt;br&gt;
methods preserve &lt;br&gt;
&amp;gt; normal matlab accuracy.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 03 Apr 2008 15:02:05 -0400</pubDate>
      <title>Re: Distance between point and circular segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#424505</link>
      <author>Roger Stafford</author>
      <description>"Chukwuemeka Igwe" &amp;lt;chukigwe@yahoo.com&amp;gt; wrote in message &amp;lt;ft2m2v&lt;br&gt;
$gf5$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Roger,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Does htere exist a similar closed formula for finding the &lt;br&gt;
&amp;gt; nearest distance to a circle with three points specified &lt;br&gt;
&amp;gt; or we may have to apeal to the idea of a langragian &lt;br&gt;
&amp;gt; mulitplier or similar contrivance?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Sincerely,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Chuk.&lt;br&gt;
---------&lt;br&gt;
&amp;nbsp;&amp;nbsp;The main problem there is to find the center and radius of such a circle.  &lt;br&gt;
Once found, the distance you request is merely the absolute difference &lt;br&gt;
between the distance from the given point to the center and the radius of the &lt;br&gt;
circle.  There is certainly no need for Lagrange multipliers.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;On the Mathworld website:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&lt;a href="http://mathworld.wolfram.com/Circle.html"&gt;http://mathworld.wolfram.com/Circle.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
there is a solution of the circle problem in equations (28) through (34).&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;A method of finding the circle using matlab is the following.  Let p1 = &lt;br&gt;
(x1,y1), p2 = (x2,y2), and p3 = (x3,y3) be three points in 2D space, each &lt;br&gt;
represented by a two-element row vector.  Then a circle through these three &lt;br&gt;
points has its center at the location given by vector c with radius r as given in &lt;br&gt;
the following:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;t = p2-p1; u = p3-p1; v = p3-p2;&lt;br&gt;
&amp;nbsp;w = abs(det([t;u]));&lt;br&gt;
&amp;nbsp;c = p1+(dot(t,t)*dot(u,v)*u-dot(u,u)*dot(t,v)*t)/(2*w^2);&lt;br&gt;
&amp;nbsp;r = 1/2*norm(t)*norm(u)*norm(v)/w;&lt;br&gt;
&lt;br&gt;
Then you can get your required distance as:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;d = abs(norm(P-c)-r);&lt;br&gt;
&lt;br&gt;
where P is the given point.&lt;br&gt;
&lt;br&gt;
Roger Stafford&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 22 Apr 2008 13:40:03 -0400</pubDate>
      <title>Re: Distance between point and circular segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#428181</link>
      <author>Laurent Huberty</author>
      <description>Hey, do you know how how you can find out if P is either on&lt;br&gt;
one or the other side of the line.&lt;br&gt;
&lt;br&gt;
I ask because i wanna define a so called support polygon which&lt;br&gt;
is defined by 3 points X1, X2, X3 (3 footpoints)&lt;br&gt;
the Point P represents the horizontal projection of the&lt;br&gt;
center of gravity.&lt;br&gt;
The system is called stable if the point P is inside the&lt;br&gt;
support polygon and greater than 0. This means I first start&lt;br&gt;
to check the distances of the perpendicular to the vectors&lt;br&gt;
defined by X1,X2,X3 and than check if they are inside the&lt;br&gt;
polygon(triangle). The should be positive inside and&lt;br&gt;
negative outside&lt;br&gt;
&lt;br&gt;
Laurent&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 22 Apr 2008 14:01:14 -0400</pubDate>
      <title>Re: Distance between point and circular segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#428189</link>
      <author>alessandro mura</author>
      <description>if you have a line in the explicit form&lt;br&gt;
y=m*x+q,&lt;br&gt;
&lt;br&gt;
then if Py &amp;gt; m*Px+q&lt;br&gt;
you are above the line, otherwise you are below...&lt;br&gt;
&lt;br&gt;
Ale&lt;br&gt;
-- &lt;br&gt;
Alessandro Mura&lt;br&gt;
Istituto Nazionale di Astrofisica - IFSI&lt;br&gt;
&lt;a href="http://pptt4.ifsi-roma.inaf.it/~mura/index.html"&gt;http://pptt4.ifsi-roma.inaf.it/~mura/index.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 22 Apr 2008 14:17:01 -0400</pubDate>
      <title>Re: Distance between point and circular segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#428192</link>
      <author>John D'Errico</author>
      <description>"alessandro mura" &amp;lt;fake@address.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fukr2u$lil$1@aioe.org&amp;gt;...&lt;br&gt;
&amp;gt; if you have a line in the explicit form&lt;br&gt;
&amp;gt; y=m*x+q,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; then if Py &amp;gt; m*Px+q&lt;br&gt;
&amp;gt; you are above the line, otherwise you are below...&lt;br&gt;
&lt;br&gt;
too bad when the line is vertical...&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 22 Apr 2008 15:45:05 -0400</pubDate>
      <title>Re: Distance between point and circular segment</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164048#428209</link>
      <author>Roger Stafford</author>
      <description>"Laurent Huberty" &amp;lt;hubertyl@student.ethz.ch&amp;gt; wrote in message &amp;lt;fukprj$6ih&lt;br&gt;
$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hey, do you know how how you can find out if P is either on&lt;br&gt;
&amp;gt; one or the other side of the line.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I ask because i wanna define a so called support polygon which&lt;br&gt;
&amp;gt; is defined by 3 points X1, X2, X3 (3 footpoints)&lt;br&gt;
&amp;gt; the Point P represents the horizontal projection of the&lt;br&gt;
&amp;gt; center of gravity.&lt;br&gt;
&amp;gt; The system is called stable if the point P is inside the&lt;br&gt;
&amp;gt; support polygon and greater than 0. This means I first start&lt;br&gt;
&amp;gt; to check the distances of the perpendicular to the vectors&lt;br&gt;
&amp;gt; defined by X1,X2,X3 and than check if they are inside the&lt;br&gt;
&amp;gt; polygon(triangle). The should be positive inside and&lt;br&gt;
&amp;gt; negative outside&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Laurent&lt;br&gt;
-------------&lt;br&gt;
&amp;nbsp;&amp;nbsp;The point P = (x,y) lies inside triangle ABC, where A = (x1,y1), B = (x2,y2), &lt;br&gt;
and C = (x3,y3) if&lt;br&gt;
&lt;br&gt;
&amp;nbsp;det([1 x y;1 x1 y1;1 x2 y2]),&lt;br&gt;
&lt;br&gt;
&amp;nbsp;det([1 x y;1 x2 y2;1 x3 y3]), and&lt;br&gt;
&lt;br&gt;
&amp;nbsp;det([1 x y;1 x3 y3;1 x1 y1])&lt;br&gt;
&lt;br&gt;
all have the same sign.  Otherwise it lies outside.&lt;br&gt;
&lt;br&gt;
Roger Stafford&lt;br&gt;
&lt;br&gt;
</description>
    </item>
  </channel>
</rss>
