It would seem like this can be done by solving various optimization formulas via plane geometry? The radicals arise from solving maximization polynomials assuming it's a constructable solution.
Early in my generative art, I spent a lot of time packing various small shapes together, it was a fun process to figure out how to maximize the coverage without leaving large gaps. For example, a piece with almost every shape I was using: https://digcon.art/details.html?key=river-in-the-woods
Depends on the shape. Irregular shape packing and optimisation is still being advanced. Newer approaches are using ai. Lots of GitHub repositories with different approaches.
However, Multi dimensional bin packing problems are the some of the hardest non linear optimization problems.