|
Re: Is a point in a 4 vertex polygon? [message #14356 is a reply to message #14295] |
Wed, 17 February 1999 00:00  |
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 #14369 is a reply to message #14295] |
Tue, 16 February 1999 00:00  |
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
|
|
|