org.openmali.spatial.octree
Class OcTree<T>

java.lang.Object
  extended by org.openmali.spatial.octree.OcTree<T>

public class OcTree<T>
extends java.lang.Object

Author:
David Yazel, Marvin Froehlich (aka Qudus) [code cleaning]

Field Summary
protected  int minCellSize
           
protected  long numObjects
           
protected  long totalDepth
           
protected  int worldSize
           
 
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
 

Field Detail

worldSize

protected int worldSize

minCellSize

protected int minCellSize

numObjects

protected long numObjects

totalDepth

protected long totalDepth
Constructor Detail

OcTree

public OcTree(int worldSize,
              int minCellSize)
Method Detail

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 search
radius - Radius of the sphere to search
callback - 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)