On Thu, 27 Jun 2002, Watson, Christopher wrote: > OK, I need a little guidance here. > > I have a list with 9500+ elements in it. Each element in this big list is a > four-item list which acts as bounding box limits. Looks like this... > > [[0.0, 2.5, 0.0, 2.5], [2.5, 5.0, 0.0, 2.5] ... [350.0, 360.0, 88.5, 90.0]]
Well first off, why not have the list as [rect(0,0,2.5, 2.5)], so it's a little more director -ready...and then... > > The first item in each internal list is the minimum horizontal value (the > left) for that particular bounding box, the second is the maximum horizontal > value (the right), the third is the minimum vertical value (the top), and > the fourth is the maximum vertical value (the bottom). > > Then I have two floating point values, which act as x and y (or h and v) > coordinates, like these... > > 124.357892 > 20.736474 tX = 124.357892 tY = 20.736474 tPoint = loc (tX,tY) repeat with i = 1 to myBigRectList.count if tPoint.inside(myBigRectList[i]) then ..... end repeat ? > > What I need to do is search the big list for an element which contains a > bounding box within which BOTH the floating point values would physically > lie. For example, if I were to successfully find the "box" element in which > 124.357892 and 20.736474 resided, I might find the element [122.5, 125.0, > 20.0, 22.5]. That specific "box" element contains the horizontal coordinate > (124.357892 falls between 122.5 and 125.0) and the vertical coordinate > (20.736474 falls between 20.0 and 22.5). > > I hope that makes sense. > > Important: There is only ONE bounding box in the big list in which the > coordinates will lie, and there will always be ONE. The bounding box values > are not in numeric order of any kind, and it can't be reliably sorted in > such a way that a binary search can be implemented on this. > > What would be the speediest way to perform this search? I'm sure there's a > tricky way to do this. I just can't come up with it. > > > ��������������������������� > Christopher Watson > Sr. Software Engineer > Interactive Web Media > Lightspan, Inc. > Tel 858.824.8457 > Fax 858.824.8001 > ___________________________ > > [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!] > [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!]
