T - The precise type of tree objectspublic final class OctTreeI<T> extends Object implements OctTreeIType<T>
OctTreeIType interface.| Modifier and Type | Class and Description |
|---|---|
protected class |
OctTreeI.Octant |
| Modifier and Type | Method and Description |
|---|---|
com.io7m.jregions.core.unparameterized.volumes.VolumeI |
bounds() |
void |
clear()
Remove all objects from the tree.
|
void |
containedBy(com.io7m.jregions.core.unparameterized.volumes.VolumeI volume,
Set<T> items)
Returns all objects in the tree that are completely contained within
volume, saving the results to items. |
boolean |
contains(T item)
Determine whether or not the object has already been inserted into the
tree.
|
static <T> OctTreeIType<T> |
create(OctTreeConfigurationI config)
Create a new empty tree with the given bounds.
|
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
insert(T item,
com.io7m.jregions.core.unparameterized.volumes.VolumeI item_bounds)
Insert the object
item into the octtree. |
<C> void |
iterateOctants(C context,
OctTreeOctantIterationIType<T,C> f)
Iterate over all octants within the tree.
|
<U> OctTreeIType<U> |
map(BiFunction<T,com.io7m.jregions.core.unparameterized.volumes.VolumeI,U> f)
Apply
f to each element of the tree. |
void |
overlappedBy(com.io7m.jregions.core.unparameterized.volumes.VolumeI volume,
Set<T> items)
Returns all objects in the tree that are overlapped
volume, saving the results to items. |
void |
raycast(Ray3D ray,
SortedSet<OctTreeRaycastResultI<T>> items)
Returns all objects that are intersected by the given ray.
|
boolean |
remove(T item)
Remove the object
item from the octtree. |
long |
size() |
void |
trim()
Trim all empty quadrants from the tree.
|
com.io7m.jregions.core.unparameterized.volumes.VolumeI |
volumeFor(T item) |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitisEmptypublic static <T> OctTreeIType<T> create(OctTreeConfigurationI config)
T - The type of objects contained within the treeconfig - The tree configurationpublic void trim()
OctTreeITypetrim in interface OctTreeIType<T>public long size()
size in interface OctTreeReadableTypepublic com.io7m.jregions.core.unparameterized.volumes.VolumeI bounds()
bounds in interface OctTreeReadableIType<T>public boolean insert(T item, com.io7m.jregions.core.unparameterized.volumes.VolumeI item_bounds)
OctTreeITypeInsert the object item into the octtree.
The function returns false if the object could not be
inserted for any reason (perhaps due to being too large).
If the object is already in the tree, it is replaced. This can be used to update the bounds of an object within the tree.
insert in interface OctTreeIType<T>item - The object to insertitem_bounds - The object's boundstrue if the object was insertedpublic boolean contains(T item)
OctTreeReadableITypecontains in interface OctTreeReadableIType<T>item - The objecttrue iff the object is in the treepublic boolean remove(T item)
OctTreeITypeRemove the object item from the octtree.
The function returns false if the object could not be
removed for any reason (perhaps due to not being in the tree in the first
place).
remove in interface OctTreeIType<T>item - The object to removetrue if the object was removedpublic void clear()
OctTreeITypeclear in interface OctTreeIType<T>public <U> OctTreeIType<U> map(BiFunction<T,com.io7m.jregions.core.unparameterized.volumes.VolumeI,U> f)
OctTreeITypef to each element of the tree.map in interface OctTreeIType<T>map in interface OctTreeReadableIType<T>U - The type of result elementsf - A mapping functionpublic <C> void iterateOctants(C context,
OctTreeOctantIterationIType<T,C> f)
OctTreeReadableITypeiterateOctants in interface OctTreeReadableIType<T>C - The type of context valuescontext - A contextual value passed to ff - An iteration functionpublic com.io7m.jregions.core.unparameterized.volumes.VolumeI volumeFor(T item)
volumeFor in interface OctTreeReadableIType<T>item - The itemitempublic void containedBy(com.io7m.jregions.core.unparameterized.volumes.VolumeI volume,
Set<T> items)
OctTreeReadableITypevolume, saving the results to items.containedBy in interface OctTreeReadableIType<T>volume - The volume to examineitems - The returned itemspublic void overlappedBy(com.io7m.jregions.core.unparameterized.volumes.VolumeI volume,
Set<T> items)
OctTreeReadableITypevolume, saving the results to items.overlappedBy in interface OctTreeReadableIType<T>volume - The volume to examineitems - The returned itemspublic void raycast(Ray3D ray, SortedSet<OctTreeRaycastResultI<T>> items)
OctTreeReadableITyperaycast in interface OctTreeReadableIType<T>ray - The rayitems - The intersected itemsCopyright © 2017 <code@io7m.com> http://io7m.com