Path: news.mathworks.com!not-for-mail
From: "zedong 
" <zdongwu@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to get the intersection point coordinate between polygon and segment
Date: Sat, 13 Dec 2008 14:55:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 20
Message-ID: <gi0ic8$pk5$1@fred.mathworks.com>
References: <gi0epq$lk3$1@fred.mathworks.com> <gi0gg5$878$1@fred.mathworks.com>
Reply-To: "zedong 
" <zdongwu@gmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1229180104 26245 172.30.248.37 (13 Dec 2008 14:55:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 13 Dec 2008 14:55:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1639198
Xref: news.mathworks.com comp.soft-sys.matlab:506735


"Matt" <mjacobson.removethis@xorantech.com> wrote in message <gi0gg5$878$1@fred.mathworks.com>...
> "zedong 
> " <zdongwu@gmail.com> wrote in message <gi0epq$lk3$1@fred.mathworks.com>...
> > How to get the intersection point coordinate between polygon and segment;
> > for example(a is a triangle a(i,:) is the ith coordinate of the triangle.b is an segment,b(i,:) is the side point coordinate):
> > a=[0 0;1 0;0 1]; b=[0.4 0.4;1 1];
> > I want to return c=[0.5 0.5;0.4 0.4]
> > example2:
> > a=[0 0;1 0;0 1]; b=[0.4 0;2 0];
> > I want to return c=[0.4 0;1 0]
> > example 3
> > a=[0 0;1 0;0 1]; b=[0.4 0;0.5 0];
> > I want to return c=[0.4 0;0.5 0];
> 
> Questions
> 
> (a) Can we assume the polygon is convex? If not, the problem is ill-defined.
> 
> (b) Do the rows of a give the polygon vertices in clockwise/counter-clockwise order, or is the order arbitrary? If the latter, then a sorting operation will have to be performed first.
Thank you for your attention .we can assume that the polygon is convex.as a matter of fact it is a triangle.But I have many triangle.and many segment.so I must implement it use mex.