com.triangularpixels.rebirth.geometry2d
Class Atlas<T>

java.lang.Object
  extended by com.triangularpixels.rebirth.geometry2d.Atlas<T>
Type Parameters:
T - the data type to associate with each packed rectangle

public class Atlas<T>
extends Object

An atlas packs multiple axis-aligned rectangles into a single larger rectangle with integer precision. The space is divided using a BSP tree to try and waste as little space as possible. For best results insert the largest rectangles (by area) first.

Author:
John Campbell

Nested Class Summary
static class Atlas.Entry<V>
           
 
Constructor Summary
Atlas(int width, int height)
           
 
Method Summary
 float calcEfficiency()
           
 ArrayList<Atlas.Entry<T>> getAll()
           
 int getHeight()
           
 int getWidth()
           
 IntRectangle insert(int insertW, int insertH, T t)
           
 boolean remove(T t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Atlas

public Atlas(int width,
             int height)
Method Detail

getWidth

public int getWidth()

getHeight

public int getHeight()

insert

public IntRectangle insert(int insertW,
                           int insertH,
                           T t)

remove

public boolean remove(T t)

getAll

public ArrayList<Atlas.Entry<T>> getAll()

calcEfficiency

public float calcEfficiency()


Copyright © 2009 TriangularPixels.com. All Rights Reserved.