geometry problem

I

IcyMint

Hi, I'm trying to write a program that's able to place boxes into a
room. Basically it's an empty rectangular room with different sizes of
boxes in it. The program will need to figure out where to place the new
boxes. I'm thinking of marking out the place taken by the boxes in the
room then compare if the coordinate of the new box overlaps with them.
But now, the problem is, I don't know how to start. Can you please help
me? Thanks a lot!
 
J

John Bokma

IcyMint said:
Hi, I'm trying to write a program that's able to place boxes into a
room. Basically it's an empty rectangular room with different sizes of
boxes in it. The program will need to figure out where to place the new
boxes.

If you want to do it near optimal, it sounds like 2D bin packing:

http://en.wikipedia.org/wiki/Bin_packing
http://en.wikipedia.org/wiki/Packing_problem
I'm thinking of marking out the place taken by the boxes in the
room then compare if the coordinate of the new box overlaps with them.


So you want to test if one rectangle overlaps another..

Google will give you plenty of solutions to that geometric problem.
 
I

IcyMint

Hi John, Thanks a lot for the links. After browsing through those links
and some googling, I think my problem is the bin packing thing. Will
look for more info about it later. Thanks for your help!
 
J

John Bokma

Ben Morrow said:

[ overlapping rectangles ]
s/Google/Common sense/, surely?

Nah, some problems that look very easy have now and then very elegant
solutions that are not that easy to come up with common sense. Common
sense makes a O(n^2) bubble sort :-D

(which is not bad for small n, and might outperform other solutions, but
that's no longer common sense as in given context :-D)
 
I

IcyMint

Hi, thank you all for your feedbacks. I'm really glad to be pointed to
all the informations I needed. I think that the Geo::SpaceManager is
quite good, I'll be using it unless something better comes along.
Thanks a lot!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,200
Messages
2,571,046
Members
47,646
Latest member
xayaci5906

Latest Threads

Top