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

Home » Public Forums » archive » Inside rectangle
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
Inside rectangle [message #31342] Tue, 02 July 2002 09:53 Go to next message
Neil Talsania is currently offline  Neil Talsania
Messages: 7
Registered: January 2001
Junior Member
I am relatively new to IDL , and am wondering how to do the following. I
want to be able to have user input 4 corner coordiates, then check to see if
a particular point is inside the rectangle. That is pretty easy, i think.
But then I want to be able to add additional sets of coordinates to check. I
want this to be unlimited. Basically allowing the user to add rectangles to
check until he is ready to stop.

Now I think I want to make a structure to hold the 4 corner coordinates.
Then I need to create an array of these structures, but I want that array to
be able to grow. Then I will loop through that array (For loop) calling a
function that will check to see if the point is inside the coordinates.

So the crux of my problem ( I think) is that I need the array size to
increase every time the user adds a set. But I dont know ho to do this.

Any clues would be greatly appreciated.

Neil
Re: Inside rectangle [message #31518 is a reply to message #31342] Mon, 22 July 2002 11:55 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Tue, 02 Jul 2002 09:53:03 -0700, Neil Talsania wrote:

> I am relatively new to IDL , and am wondering how to do the following. I
> want to be able to have user input 4 corner coordiates, then check to
> see if a particular point is inside the rectangle. That is pretty easy,
> i think. But then I want to be able to add additional sets of
> coordinates to check. I want this to be unlimited. Basically allowing
> the user to add rectangles to check until he is ready to stop.
>
> Now I think I want to make a structure to hold the 4 corner coordinates.
> Then I need to create an array of these structures, but I want that
> array to be able to grow. Then I will loop through that array (For loop)
> calling a function that will check to see if the point is inside the
> coordinates.
>
> So the crux of my problem ( I think) is that I need the array size to
> increase every time the user adds a set. But I dont know ho to do this.
>
> Any clues would be greatly appreciated.

On a related note, you can get much better performance by doing your
test without a loop, ala:

rect=replicate({ll:[0.,0.],ur:[1.,1.]},100) ;; fill this list however
in=where(x gt rect.ll[0,*] AND $
x lt rect.ur[0,*] AND $
y gt rect.ll[1,*] AND $
y lt rect.ur[1,*],cnt)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: CoolHelp update
Next Topic: Re: unwanted color bands in image display

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

Current Time: Wed Oct 08 19:16:01 PDT 2025

Total time taken to generate the page: 0.00970 seconds