By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,818 Members | 1,282 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,818 IT Pros & Developers. It's quick & easy.

Data structure for ordered sequence

P: n/a
Dear all,
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.

--
thanks.
Suresh

Nov 13 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
There are probily better ways to do this. The pil library has a
rectangle drawing feature, I would check through the docs of wxwindows
and tkinter unless this is homework because the pil people will not let
you distribute pils. I am going to be looking for the same think let
me know if you get a better answer.

http://my.opera.com/yjfuk/blog/index.dml/tag/captcha
https://sourceforge.net/project/show...roup_id=156455
http://www.dexrow.com


jm*******@no.spam.gmail.com wrote:
Dear all,
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.

--
thanks.
Suresh
Nov 13 '06 #2

P: n/a
Er*********@msn.com wrote:
unless this is homework because the pil people will not let
you distribute pils.
I'm not sure I can parse this sentence fragment. What do you mean?

</F>

Nov 13 '06 #3

P: n/a
jm*******@no.spam.gmail.com 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>

Nov 13 '06 #4

P: n/a

Fredrik Lundh wrote:
jm*******@no.spam.gmail.com 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

Thanks for the response.
--
Suresh

Nov 13 '06 #5

P: n/a
"Fredrik Lundh" <fr*****@pythonware.comwrote:

Er*********@msn.com wrote:
unless this is homework because the pil people will not let
you distribute pils.

I'm not sure I can parse this sentence fragment. What do you mean?
oh come on! - you of all people should know that "pils" means mushroom...

- Hendrik

Nov 14 '06 #6

P: n/a
Hendrik van Rooyen wrote:
"Fredrik Lundh" <fr*****@pythonware.comwrote:

>Er*********@msn.com wrote:
> unless this is homework because the pil people will not let
you distribute pils.
I'm not sure I can parse this sentence fragment. What do you mean?

oh come on! - you of all people should know that "pils" means mushroom...
Cue yet another appearance of badgerbadgerbadger?

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

Nov 14 '06 #7

P: n/a
jm*******@no.spam.gmail.com wrote:
Fredrik Lundh wrote:
>jm*******@no.spam.gmail.com 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
Nov 16 '06 #8

P: n/a
robert wrote:
>>how many rectangles do you plan to store in this structure?
>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 ..
thanks for writing the reply I didn't get around to write ;-)

</F>

Nov 16 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.