F
F
flashguy2011-05-05 11:28:39
Mathematics
flashguy, 2011-05-05 11:28:39

A problem with the placement of rectangles?

Friends, I'm not a mathematician, but I had such a simple problem. Advise in what direction to "dig".
Given a container rectangle with varying width and height. There are also n-rectangle-children. The task is to fill the container with child-rectangles so that they occupy the largest possible area of ​​the container-rectangle (they can be located both horizontally and vertically, and even in several rows and columns if the container is large, and "children " lot). The situation is darkened by the fact that the child rectangles must be of the same size (but maybe it just seems to me).
Prompt, what algorithms can look or already there are implementations of something similar? I've already "broken" my whole head.
I will be grateful for any help! Thank you.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
pswd, 2011-05-05
@pswd

As far as I understood in the end, you have a window size and a size n of the same size pictures.
Requires to place them in the window in such a way that the pictures cover the maximum area of ​​the window.
If I understood everything correctly, then this is indeed a two-dimensional packing problem.
I recommend reading:
one
two
three
books
I wish you success :)

R
ramilexe, 2011-05-05
@ramilexe

Actually, this is a packing problem. In this case, it's two-dimensional. There are many algorithms, including genetic ones.
Look here to get started

F
flashguy, 2011-05-05
@flashguy

Thanks to everyone who responded!
I know what I want :) maybe I just explain somehow not correctly :)
I am clarifying. There is a rectangle (program window) whose width and height will change dynamically (it all depends on the user), it needs to be filled with equal rectangles (pictures), which can have a different number, which is also set dynamically. So, depending on the size of the original window (600x150 px, for example), you need to determine the size of the picture (200x150 px, for example) if there were 3 pictures and arrange the pictures horizontally. Another condition: a window with a size of 150x600 px, determine the size of the pictures as 150x200 px and place the pictures vertically. And the third possible condition is all for the same 3 pictures, when the window size is 600x600 px? then the size of the pictures should be defined as 300x300 px and they will be arranged in two columns and two rows. It's like this :)

F
flashguy, 2011-05-05
@flashguy

Thanks to everyone who responded for help. I will read and decide!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question