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) time where m is the number of objects that the query returns and k is the average number of cells that an object occupies.

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.

Public
GetRoot (item)
Public
GridLookup (size)
Public
Move (item, bounds)

Move an object to occupy a new set of cells.

Public
QueryRect< U > (r)

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

Public
Remove (item)

Removes an item from the lookup data structure.

Public

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