Detection of geometric shapes based on contours

probably related to bin packing, knapsack, “cutting stock”… problems known in computer science