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

Home » Public Forums » archive » Re: determining if a point is "inside" or "outside" a shape
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: determining if a point is "inside" or "outside" a shape [message #17508 is a reply to message #17487] Mon, 18 October 1999 00:00 Go to previous messageGo to previous message
Andrew Kraus is currently offline  Andrew Kraus
Messages: 7
Registered: May 1999
Junior Member
A method I have used extensively in the past is less elegant, but works like
a charm. Create a pixmap of the entire window. Paint it black (ERASE), or
any intensity vaue for that matter, then POLYFILL your coordinates with a
different color. You can then check the color of the point you are testing.
Be sure to color the coordinates (boundary) as well so you know if the point
lies on the boundary itself. Pixmaps and polyfill are 2 of the faster
functions in IDL, so this goes very quickly. You can see how this handles
any shape, except donuts require a bit more thought.

Best of luck,

AK



dmarshall@ivory.trentu.ca wrote in message ...
> I have an interesting problem that I'm betting someone has solved already
> in some form or another.
>
> I have a set of x,y coordinates that describe a polygon, 2d in my case.
> How do I tell if another x,y point is inside the boundary of my polygon?
>
> I had an idea to take the center of my polygon and extend a line from it to
> the point and beyond, seeing if I cross the perimeter an odd number of
> times.
>
> Any other suggestions?
>
> Dave.
>
> David Marshall Physics Dept. Trent University
> dmarshall@remove.this.ivory.trentu.ca Peterborough Ontario Canada
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL-C-Fortran
Next Topic: Q: routine name case sensitivity on unix

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

Current Time: Thu Oct 09 23:06:20 PDT 2025

Total time taken to generate the page: 0.96584 seconds