com.babaroga.test.packing
Class BspPacker

java.lang.Object
  extended by com.babaroga.test.packing.RectanglePacker
      extended by com.babaroga.test.packing.BspPacker

public class BspPacker
extends RectanglePacker

A binary space partitioning rectangle packer. This packer recursively splits the specified bounding rectangle to insert each rectangle.


Constructor Summary
BspPacker()
           
 
Method Summary
 java.util.Collection<java.awt.Rectangle> pack(int width, int height, java.util.Collection<java.awt.Rectangle> rectangles)
          Packs the supplied rectangles into the specified bounds.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BspPacker

public BspPacker()
Method Detail

pack

public java.util.Collection<java.awt.Rectangle> pack(int width,
                                                     int height,
                                                     java.util.Collection<java.awt.Rectangle> rectangles)
Description copied from class: RectanglePacker
Packs the supplied rectangles into the specified bounds.

Specified by:
pack in class RectanglePacker
Parameters:
width - The width of the bounding rectangle.
height - The height of the bounding rectangle.
rectangles - The rectangles to be packed.
Returns:
the packed rectangles. This collection may not return all the rectangles that were specified to be packed.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object