I belive this qualifies as a backpack problem for those of you familliar with NP problems.

Take n arbitrary triangles. You are given the (u,v) coordinates of each point for a triangle. Now find the smallest rectangle that those triangles can be placed in.

I'm making a 3d modeling program where you can paint the model directly in 3d. I would like to minimize the size and amount of files used. I dont want to save a complete image file for each triangle in the model. I have figured out basic non optimized solutions for this already. I was wondering if anyone has any ideas (or experience) for this optimization.