Fits a shape to a given area to find the best fit… here is a solution to the problem.
Fits a shape to a given area to find the best fit
How will you use Python to figure out how many blocks of a given size fit into a region of a given size.
Suppose I have a rectangle with X x Y with an area of x1 x y1. How do I calculate how many rectangles fit into that area and what is best suited?
Solution
This is an instance of Packing problem. Describes a good algorithm for packing rectangles inside rectangles here.