# Fitting rectangle in a rectangle.

• Oct 11th 2008, 11:25 AM
elfanoid
Fitting rectangle in a rectangle.
Hi! It seems I'm stuck on a simple formula and hoping somebody here would be able to explain it to me.

The problem:
Given a 400 x 800 rectangle, we want to do the following. Split it up unlimited number of times (lets say, split up to full 1% and no dots) to fit smaller rectangles in it. Here is an example: Lets say I want to place 5 other rectangles into it. I know that I will need to work with percentages, so lets say the 5 rectangles that need to go into it are 40%, 2 x 20%, 15% and 5% area rectangles.

I need to fit them in such a way that entire innards of the original rectangle is filled.

So given exact areas, such as: original area rec: 320000, I need to fill it with the following areas: 128000, 2x 64000, 48000, and 16000. Now how do I find exact placement and those inner rectangles height and width?

Thank you!
• Oct 11th 2008, 06:31 PM
ticbol
Quote:

Originally Posted by elfanoid
Hi! It seems I'm stuck on a simple formula and hoping somebody here would be able to explain it to me.

The problem:
Given a 400 x 800 rectangle, we want to do the following. Split it up unlimited number of times (lets say, split up to full 1% and no dots) to fit smaller rectangles in it. Here is an example: Lets say I want to place 5 other rectangles into it. I know that I will need to work with percentages, so lets say the 5 rectangles that need to go into it are 40%, 2 x 20%, 15% and 5% area rectangles.

I need to fit them in such a way that entire innards of the original rectangle is filled.

So given exact areas, such as: original area rec: 320000, I need to fill it with the following areas: 128000, 2x 64000, 48000, and 16000. Now how do I find exact placement and those inner rectangles height and width?

Thank you!

There could be many ways to accomplish that.
I can show two ways, easy ways, but the 5 rectangles to fit inside the big rectangle are not proportionate to the dimensions of the big box. (The big box is 800/400 = 2:1 for its length over width). Neither are the 5 rectangles of various lengths and widths that can be "jigsaw-puzzled" to fill in the big rectangle.

5 rectangles to fit the big rectangle.
40%, 20%, 20%, 15%, 5%

1) One way .....the lengths of the 5 rectangles are 400 units each:
Width * Length =
for the 40%, ....= (0.40*800)(400) = 320*400 = 128,000 sq.units
for the 20%, ....= (0.20*800)(400) = 160*400 = 64,000
for the 15%, ....= (0.15*800)(400) = 120*400 = 48,000
for the 5% ......= (0.05*800)(400) = 40*400 = 16,000

Therefore, the 5 rectangles are
320 by 400
160 by 400
160 by 400
120 by 400
40 by 400

----------------------------
2) Another way, .....the lengths of the 5 rectangles are 800 units each:
Width * Length =
for the 40%, ....= (0.40*400)(800) = 160*800 = 128,000 sq.units
for the 20%, ....= (0.20*400)(800) = 80*800 = 64,000
for the 15%, ....= (0.15*400)(800) = 60*800 = 48,000
for the 5% ......= (0.05*400)(800) = 20*800 = 16,000

Therefore, the 5 rectangles are
160 by 800
80 by 800
80 by 800
60 by 800
20 by 800