Click here to Skip to main content
15,884,628 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Everyone,
What i am trying to do here is that i have a certain no of rectangles and then I have some sheets of standard sizes.I have read an algorithm that fits the pieces into the rectangle and place them optimally.I want an algo that tells me which pieces should go in which sheet OR which rectangle pieces should I select (as the area of the standard sheet can't grow only a certain no of rects can fit) to fill the sheet optimally.Please if anyone can point me out in the right direction that would be of a great help.
THANK YOU.
Posted

1 solution

I'd suggest you start with this CodeProject article "Fast Optimizing Rectangle Packing Algorithm for Building CSS Sprites" by Matt Perdeck: [^]. The article contains a good overview of the packing problem, and goes on to develop, and improve, an algorithm.

The "Nuclex" rectangle packing algorithms by Kossovsky Alexander are, also, probably good resources for you, and you can read about them, and download C# source, here: [^].

Kossovsky provides three different packing algorithms. His code is licensed under the IBM Public License, and uses the Microsoft XNA FrameWork.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900