Long story short, I have a number of shapes(similar to tetris shapes, like L,+,a square, etc) that I have to place in the middle of a canvas. The shapes need to be positioned as close as possible to the 0,0 coordinate. I need an algorithm that will calculate the best position (cost effective) of a shape on the canvas, given the already positioned shapes, in order to determine in which position(on top of the others, on their left, etc), the whole stack would occupy the least space. To avoid a lot of time needed to implement this from scratch I figured I should ask, maybe such an algorithm has already been implemented.
If anyone know such an algorithm or something similar done, I would appreciate it.
Thanks in advance.