public class BinaryTreeRectanglePacker extends java.lang.Object implements RectanglePacker
Constructor and Description |
---|
BinaryTreeRectanglePacker(int width,
int height) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all rectangles, to start over
|
boolean |
fits(int w,
int h)
Checks whether a rectangle with given size will
fit in the pack.
|
boolean |
fits(Rectangle r) |
int |
getHeight()
Height of bounding box
|
int |
getWidth()
Width of bounding box
|
Rectangle |
pack(int w,
int h)
Packs a rectangle with given dimensions, returning
the destination rectangle.
|
Rectangle |
pack(Rectangle r) |
public BinaryTreeRectanglePacker(int width, int height)
public boolean fits(Rectangle r)
public boolean fits(int w, int h)
pack(int, int)
is
an O(1) operation.fits
in interface RectanglePacker
w
- widthh
- heightpublic Rectangle pack(int w, int h)
pack
in interface RectanglePacker
w
- widthh
- heightpublic int getWidth()
getWidth
in interface RectanglePacker
public int getHeight()
getHeight
in interface RectanglePacker
public void clear()
RectanglePacker
clear
in interface RectanglePacker