how to calculate the amount rectangles can you get out of a bigger rectangle

201 Views Asked by At

I am looking to make a program to calculate how many rectangles you can get out of a bigger rectangle. I want both the size of the big rectangle and the smaller ones to be adjustable.

But while thinking about it i ran into a problem: You can`t just calculate the surface of the 2 and just divide them. because for certain lengths you get a piece left which is technically the same size but not the same shape.

Is there a mathematical way to approach this? or is this not doable in any logical way and do i need to make a program which makes 1 rectangle at a time and looks at every possible position and rotation?