comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Is a point in a 4 vertex polygon?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Is a point in a 4 vertex polygon? [message #14295] Fri, 12 February 1999 00:00 Go to next message
Nando Iavarone is currently offline  Nando Iavarone
Messages: 48
Registered: December 1998
Member
Hi all,
does anyone know a function that check if
a given point is inside a 4 vertex polygon?
Cheers,
Nando

--
Nando Iavarone
Advanced Computer System
via Lazzaro Belli, 23
00040 Frascati - RM
Tel: +39-6-944091 (switchboard)
9440943 (direct)
E-mail:
f.iavarone@acsys.it
iavarone@ba.infn.it
Re: Is a point in a 4 vertex polygon? [message #14356 is a reply to message #14295] Wed, 17 February 1999 00:00 Go to previous message
David Kastrup is currently offline  David Kastrup
Messages: 33
Registered: February 1998
Member
Nando Iavarone <f.iavarone@acsys.it> writes:

> Thanks all.
> I found another one algorithm.
> It uses the vectorial product properties to check
> if a point is above or below a line.

Presming that you just do the croos product (which is just a
determinant, really) of vector a-M and b-a to check whether M lies to
the left of a-b, you should be aware that this algorithm, though fast,
works only with convex polygons.

If you draw a quadrilateral that is like an arrow tip, or like a delta
plane (namely two sharp triangles pointing backwards), then a point in
one of the tips will fail the criterion.


--
David Kastrup Phone: +49-234-700-5570
Email: dak@neuroinformatik.ruhr-uni-bochum.de Fax: +49-234-709-4209
Institut f�r Neuroinformatik, Universit�tsstr. 150, 44780 Bochum, Germany
Re: Is a point in a 4 vertex polygon? [message #14359 is a reply to message #14295] Wed, 17 February 1999 00:00 Go to previous message
wmc is currently offline  wmc
Messages: 117
Registered: February 1995
Senior Member
> http://www.dfanning.com/tips/point_in_polygon.html

This is sourced from Baard Krane <bard.krane@fys.uio.no>. It was posted to this
NG on Wed, 01 Apr 1998.

I have a slightly upgraded version at http://www.nbs.ac.uk/public/icd/wmc/idl,
which copes with vector input.

-William

--
William M Connolley | wmc@bas.ac.uk | http://www.nbs.ac.uk/public/icd/wmc/
Climate Modeller, British Antarctic Survey | Disclaimer: I speak for myself
Re: Is a point in a 4 vertex polygon? [message #14360 is a reply to message #14295] Wed, 17 February 1999 00:00 Go to previous message
Nando Iavarone is currently offline  Nando Iavarone
Messages: 48
Registered: December 1998
Member
Thanks all.
I found another one algorithm.
It uses the vectorial product properties to check
if a point is above or below a line.
Cheers,
Nando

--
Nando Iavarone
Advanced Computer System
via Lazzaro Belli, 23
00040 Frascati - RM
Tel: +39-6-944091 (switchboard)
9440943 (direct)
E-mail:
f.iavarone@acsys.it
iavarone@ba.infn.it
Re: Is a point in a 4 vertex polygon? [message #14369 is a reply to message #14295] Tue, 16 February 1999 00:00 Go to previous message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
Michael W Asten wrote:
>
> Nando Iavarone wrote:
>
>> Hi all,
>> does anyone know a function that check if
>> a given point is inside a 4 vertex polygon?
>> Cheers,
>> Nando

One method would be to use POLLYFILLV() to return array subscripts
for the points within a polygon defined by vectors X and Y, and
search this for your point. I'm sure there's probably a faster way,
I wasn't able to see David Fanning's "Math Tips" section (network
error).

Dave
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: CONVOL2D
Next Topic: SVD and Other things Linear

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:29:19 PDT 2025

Total time taken to generate the page: 0.00453 seconds