org.openmali.spatial.octree
Class OcTree<T>
java.lang.Object
org.openmali.spatial.octree.OcTree<T>
public class OcTree<T>
- extends java.lang.Object
- Author:
- David Yazel, Marvin Froehlich (aka Qudus) [code cleaning]
|
Constructor Summary |
OcTree(int worldSize,
int minCellSize)
|
|
Method Summary |
void |
findWithinSphere(Tuple3f center,
float radius,
FrustumInterface frustum,
SpatialCallback<T> callback)
|
void |
findWithinSphere(Tuple3f center,
float radius,
SpatialCallback<T> callback)
Finds all the spatial objectcs which are within the specified sphere. |
int |
getAverageDepth()
|
int |
getNumObjects()
|
SpatialHandle<T> |
insert(float x,
float y,
float z,
float r,
T o)
|
SpatialHandle<T> |
insert(Point3f c,
float r,
T o)
Builds an OcNode with the specified center, radius and object. |
SpatialHandle<T> |
insert(T o,
VertexContainer source)
Builds an OcNode for the specified object. |
void |
traverse(OcCuller<T> culler,
OcCallback<T> callback)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
worldSize
protected int worldSize
minCellSize
protected int minCellSize
numObjects
protected long numObjects
totalDepth
protected long totalDepth
OcTree
public OcTree(int worldSize,
int minCellSize)
insert
public SpatialHandle<T> insert(float x,
float y,
float z,
float r,
T o)
getAverageDepth
public int getAverageDepth()
getNumObjects
public int getNumObjects()
insert
public SpatialHandle<T> insert(Point3f c,
float r,
T o)
- Builds an OcNode with the specified center, radius and object.
- Parameters:
c - r - o -
insert
public SpatialHandle<T> insert(T o,
VertexContainer source)
- Builds an OcNode for the specified object. The bounds are determined
using the source interface which allows an optimal sphere to be
constructed.
- Parameters:
o - source -
findWithinSphere
public void findWithinSphere(Tuple3f center,
float radius,
SpatialCallback<T> callback)
- Finds all the spatial objectcs which are within the specified sphere.
- Parameters:
center - Center of the sphere to searchradius - Radius of the sphere to searchcallback - User supplied routine to call when we find an object.
traverse
public void traverse(OcCuller<T> culler,
OcCallback<T> callback)
findWithinSphere
public void findWithinSphere(Tuple3f center,
float radius,
FrustumInterface frustum,
SpatialCallback<T> callback)