Class GridLookup

Public

Holds a lookup datastructure to quickly find objects inside rectangles.

Objects of type T occupy an integer rectangle in the grid and they can be moved efficiently. You can query for all objects that touch a specified rectangle that runs in O(m*k+r) time where m is the number of objects that the query returns, k is the average number of cells that an object occupies and r is the area of the rectangle query.

All objects must be contained within a rectangle with one point at the origin (inclusive) and one at size (exclusive) that is specified in the constructor.

Inner Types

Public Methods

Add (item, bounds)

Add an object to the lookup data structure.

Clear ()
Dirty (item)
GetRoot (item)
GridLookup (size)
Move (item, bounds)

Move an object to occupy a new set of cells.

Returns all objects of a specific type inside the cells marked by the rectangle.

Remove (item)

Removes an item from the lookup data structure.

Resize (newBounds)

Public Variables

AllItems

Linked list of all items.

Public

Private/Protected Members

all

Linked list of all items.

Private
cells
Private
itemPool
Private
rootLookup
Private
size
Private