> The area consists of 9500 non-overlapping rectangles, and you want to
> test a point to see which rectangle it's within. Go through all the
> rects and fill an area of an image with a particular color (perhaps
> make it a 16 bit image, which would be enough for testing up to 32768
> rects). The first rect would be filled with color 1, second with
> color 2, etc. That should all happen fairly quickly, but it doesn't
> matter. It can take all day and not affect the bit that needs to be
> quick.
> 
> You now have a bitmap. You say:
> 
> whichrect = member("colorrects").getpixel(x,y)
> 
> Surely that will be faster than 9500 inside tests!

If the rects are not overlapping, might it be possible to bust them up into
a grid emulating array, in which case you could reduce the search to
rows/columns, and cut out a big chunk of the search?

Just a thought.

-kurt

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to