Thread Subject: How can I find a point is left or right of an oriented curve in

Subject: How can I find a point is left or right of an oriented curve in

From: Eric

Date: 29 Mar, 2008 03:48:59

Message: 1 of 5

for example, I have a array describing a curve from start to end, and
there is a point beside.

So I want to know the point is left or right of this curve, how can I
get it from Matlab?

Thanks!

Subject: How can I find a point is left or right of an oriented curve in

From: Daniel

Date: 29 Mar, 2008 04:05:04

Message: 2 of 5

My guess is that this is going to have to be done
mathematically.

You are going to have to analyze your array and then check
the point.

Subject: How can I find a point is left or right of an oriented curve in

From: Eric

Date: 29 Mar, 2008 05:22:23

Message: 3 of 5

On Mar 29, 12:05=A0pm, "Daniel " <d...@borellos.com> wrote:
> My guess is that this is going to have to be done
> mathematically.
>
> You are going to have to analyze your array and then check
> the point.

so how about this idea? For example, I add this point at the beginning
or end of the array which was an unclosed curve. And now I treat this
curve as a closed curve, so I just need find this closed curve is
clockwise or anti-clockwise.

When it is clockwise, I can say that the point is right of the unclose
curve; if it is anti-clockwise, which means the point is left of the
unclose curve.

But how to find a closed curve represented by an array is clockwise or
anti-clockwise, is another problem in Matlab, isn't it?

Subject: How can I find a point is left or right of an oriented curve in

From: Roger Stafford

Date: 29 Mar, 2008 19:56:01

Message: 4 of 5

Eric <Yonli.Zhan@gmail.com> wrote in message
<8ec08dd5-749e-4287-9eae-
cf547bbc1e39@i29g2000prf.googlegroups.com>...
> for example, I have a array describing a curve from start to end, and
> there is a point beside.
>
> So I want to know the point is left or right of this curve, how can I
> get it from Matlab?
>
> Thanks!
---------
  If your array describes a closed curve (which doesn't cross itself,) you can
use matlab's 'inpolygon' function.

  If the curve is not closed, I claim the question is not well-defined. Imagine
that you start with a point which could be regarded as lying to the immediate
"left" of the curve. Let the point follow some path that eventually winds up
being on the opposite side of the curve to its immediate "right" side without
the path ever crossing the curve. Then ask yourself this question: "at what
precise place in this path has the point changed from being on one side of
the curve to being on its other side?" The answer to that certainly isn't clear
to me.

  You can answer the following question unambiguously: for any directed line
segment, is the triangle formed by the point and the two segment endpoints
traversed clockwise or counterclockwise if travel is in the same direction as
on the line segment? Of course for all the segments of the curve both cases
may occur in general, but if the point lies near the curve, its nearest segment
could be considered to give the answer as to the side, though the decision as
to which segment is closest could itself be a little vague. As the point moves
away from the curve this question becomes increasingly vague.

Roger Stafford

Subject: How can I find a point is left or right of an oriented curve in

From: Eric

Date: 30 Mar, 2008 07:57:18

Message: 5 of 5

On Mar 30, 3:56=A0am, "Roger Stafford"
<ellieandrogerxy...@mindspring.com.invalid> wrote:
> Eric <Yonli.Z...@gmail.com> wrote in message
>
> <8ec08dd5-749e-4287-9eae-
> cf547bbc1...@i29g2000prf.googlegroups.com>...> for example, I have a array=
 describing a curve from start to end, and
> > there is a point beside.
>
> > So I want to know the point is left or right of this curve, how can I
> > get it from Matlab?
>
> > Thanks!
>
> ---------
> =A0 If your array describes a closed curve (which doesn't cross itself,) y=
ou can
> use matlab's 'inpolygon' function.
>
> =A0 If the curve is not closed, I claim the question is not well-defined. =
=A0Imagine
> that you start with a point which could be regarded as lying to the immedi=
ate
> "left" of the curve. =A0Let the point follow some path that eventually win=
ds up
> being on the opposite side of the curve to its immediate "right" side with=
out
> the path ever crossing the curve. =A0Then ask yourself this question: "at =
what
> precise place in this path has the point changed from being on one side of=

> the curve to being on its other side?" =A0The answer to that certainly isn=
't clear
> to me.
>
> =A0 You can answer the following question unambiguously: for any directed =
line
> segment, is the triangle formed by the point and the two segment endpoints=

> traversed clockwise or counterclockwise if travel is in the same direction=
 as
> on the line segment? =A0Of course for all the segments of the curve both c=
ases
> may occur in general, but if the point lies near the curve, its nearest se=
gment
> could be considered to give the answer as to the side, though the decision=
 as
> to which segment is closest could itself be a little vague. =A0As the poin=
t moves
> away from the curve this question becomes increasingly vague.
>
> Roger Stafford

In fact, in a simple situation, the closed curve method does work.

And I found a Matlab function "varea" which can distinguish clockwise
curve from anti-clockwise curve, it is enough to my work.

Thanks!

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com