Filling Gaps with Rectangles & Triangles

199 Views Asked by At

I'm quite new to Stack Exchange, and I also wasn't too sure where I should post this. This came up for me when I was doing some programming for a small game-project, and the task I found myself thinking of seemed somewhat mathematical in nature, and maybe perhaps common within geometry? I know very little about math though, which is why I'd thought of asking here in case

The task I was thinking of is that:- Given a square-sized space with some variable amount of squares inside of it (none of these squares inside the space overlapping with each other, all squares fully contained inside the space, and each of these squares being able to be in different rotations):- the task being to write some general algorithm that can tell you, with detail regarding positioning and sizes, how the spaces and holes between the squares can be filled with rectangles and triangles carefully arranged

A quick drawing I made (a quick drawing I'd made; it's pretty bad)

I hope this doesn't come off as a homework question or anything- I am genuinely curious of how a mathematician/maths person might approach this?