[EMAIL PROTECTED] wrote:
> Fredrik Lundh wrote:
>> [EMAIL PROTECTED] wrote:
>>
>>>  I am looking for a data structure to hold rectangles in a 2d space.
>>> Please point me to any module which does these operations:
>>>  Insert a rectangle into a particular co-ordinate.
>>>  Get the rectangle/s right/left/above/below side to a particular
>>> rectangle.
>>>  Get all the rectangles within a box
>>>  Delete a particular rectangle.
>> how many rectangles do you plan to store in this structure?
>>
>> </F>
> 
> Around 150 max
> 

And seeking/change frequency? fix dimensions? Probably for a GUI/mouse thing. 
=>Not worth worring about a 2D-tree structure. A Python list ? :-) 
Insert/change coordinates at no costs and seek the list with a 3-liner and you 
are quite fast :-)  Any sophisticated tree fumbling will cost more.
Or at max use a 1D-btree thing or so for x0,x1 or a fix 16x16 array ..

-robert
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to