Here's a simple implementation of a rectangular packing algorithm in C#:
main.cs2419 chars85 lines
This algorithm takes a list of rectangles, a container width and a container height, and returns a list of rectangles that are packed within the container without overlapping each other. The rectangles are sorted by decreasing height to maximize the space usage. The algorithm uses a brute-force approach to find a free space for each rectangle, by looping through all possible positions in the container.
gistlibby LogSnag