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

Home » Public Forums » archive » Re: Points in a rectangle with an angle
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: Points in a rectangle with an angle [message #48229 is a reply to message #48228] Wed, 05 April 2006 09:58 Go to previous messageGo to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
This is the classic point in polygon test. There are two common
approaches, the crossing test and the winding test. You can google this
for the specifics but here are a few pages to get you started:

http://softsurfer.com/Archive/algorithm_0103/algorithm_0103. htm

I've used this in the past:

http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/p npoly.html

There are probably ways to IDLize this but I implemented this in a DLM
so I never gave it any thought.


I would suggest a 2 stage approach:

first do your rough cull using WHERE to get a subset of points that
*may* be in your polygon. Then do the fine cull with a point in polygon
test of your choosing. You have a pretty simple case (2d, 4 vertex
polygon) so you could get away with a pretty simple test.


-Rick



JJMeyers2@gmail.com wrote:
> Hello,
>
> I have a problem in IDL that I was wondering if anyone has any idea how
> it can be done.
> I have a set of coordinates and I am trying to figure out how many of
> the coordinates are inside a rectangle. I know the coordinates of the 4
> edges of the rectangle but the problem is that the rectangle is at an
> angle in the x,y axis ( I know the slope). I can not just say
> coords=where((x LE xmax) AND (x GT xmin) AND (y LE ymin) AND (y GT
> ymax))
> because that will give me coordinates of a rectangle without an angle
> (parallel to the y axis).
> Is there any function in IDL that might be doing that?
>
> Thank you,
> JJM.
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Shared Memory in Windows
Next Topic: Re: iTools/interactive Analysis >

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

Current Time: Wed Oct 08 15:48:10 PDT 2025

Total time taken to generate the page: 0.00859 seconds