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.
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?