public class RTree<T extends BoundedObject>
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
class |
RTree.RTreeNode |
Constructor | Description |
---|---|
RTree() |
Default constructor.
|
RTree(int minChildren,
int maxChildren) |
Creates an R-Tree.
|
Modifier and Type | Method | Description |
---|---|---|
void |
clear() |
|
boolean |
contains(T o) |
Returns whether the given object is in the tree
|
int |
count() |
Counts the number of items in the tree.
|
void |
insert(T o) |
Inserts object o into the tree.
|
boolean |
leafSearch(T o) |
|
java.util.Enumeration<java.util.Map.Entry<T,java.util.List<java.lang.ref.WeakReference<TrackingVector<T>>>>> |
objectEntries() |
|
java.util.Enumeration<T> |
objects() |
|
void |
query(java.util.Collection<T> results) |
Adds items whose AABB intersects the query AABB to results
|
void |
query(java.util.Collection<T> results,
long px,
long py,
long pz) |
Returns items whose Rect contains the specified point.
|
void |
query(java.util.Collection<T> results,
BoundedObject.BoundedCube box) |
|
T |
queryOne(long px,
long py,
long pz) |
Returns one item that intersects the query point, or null if no items intersect that point.
|
T |
queryOne(BoundedObject.BoundedCube box) |
Returns one item that intersects the query box, or null if nothing intersects
the query box.
|
boolean |
remove(T o) |
Removes the specified object if it is in the tree.
|
public RTree()
public RTree(int minChildren, int maxChildren)
minChildren
- Minimum children in a node. 2 <= minChildren <= maxChildren/2
maxChildren
- Maximum children in a node. Node splits at this number + 1public void clear()
public void query(java.util.Collection<T> results)
results
- A collection to store the query resultspublic void query(java.util.Collection<T> results, BoundedObject.BoundedCube box)
public T queryOne(BoundedObject.BoundedCube box)
box
- the area to look uppublic void query(java.util.Collection<T> results, long px, long py, long pz)
results
- A collection to store the query results.px
- Point X coordinatepy
- Point Y coordinatepz
- Point Z coordinatepublic T queryOne(long px, long py, long pz)
px
- Point X coordinatepy
- Point Y coordinatepz
- Point Z coordinatepublic boolean remove(T o)
o
- the object to removepublic void insert(T o)
o
- the object to insert into the treejava.lang.NullPointerException
- If o == nullpublic boolean contains(T o)
o
- the object to look forpublic java.util.Enumeration<T> objects()
public java.util.Enumeration<java.util.Map.Entry<T,java.util.List<java.lang.ref.WeakReference<TrackingVector<T>>>>> objectEntries()
public boolean leafSearch(T o)
public int count()