de.grogra.vecmath.geom
Class Octree.Cell

java.lang.Object
  extended by de.grogra.vecmath.geom.Octree.Cell
Enclosing class:
Octree

public abstract static class Octree.Cell
extends java.lang.Object

A Cell represents a cell of an Octree. The array children contains the eight children of this cell, if it is an inner node of the octree, otherwise it is null. The children are equal in size and represent a decomposition of their parent.

A leaf Cell also includes a list of volumes whose boundaries are contained in the cell.

Author:
Michael Tauer, Ole Kniemeyer

Field Summary
 Octree.Cell back
           
 Octree.Cell bottom
           
 Octree.Cell[] children
          The eight child nodes of this cell, or null if this cell is a leaf of the octree.
 Octree.Cell front
           
 Octree.Cell left
           
 Octree.Cell right
           
static int ROOT_POSITION
           
 Octree.Cell top
           
 
Constructor Summary
Octree.Cell(int position)
           
 
Method Summary
abstract  void addVolume(Volume v)
          Adds a volume to this cell.
abstract  void clearVolumes()
          Clears the list of volumes of this cell.
protected abstract  Octree.Cell createChild(int position)
          This factory method creates a new cell of the same class as this cell.
 void getExtent(Octree tree, Tuple3d min, Tuple3d max)
          Determines the spatial extent of this cell.
abstract  Volume getVolume(int index, Octree.State state)
          Returns the indexth volume of the list of volumes of this cell.
abstract  int getVolumeCount()
          Returns the number of volumes in this cell.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

back

public Octree.Cell back

bottom

public Octree.Cell bottom

children

public Octree.Cell[] children
The eight child nodes of this cell, or null if this cell is a leaf of the octree.


front

public Octree.Cell front

left

public Octree.Cell left

right

public Octree.Cell right

ROOT_POSITION

public static final int ROOT_POSITION
See Also:
Constant Field Values

top

public Octree.Cell top
Constructor Detail

Octree.Cell

public Octree.Cell(int position)
Method Detail

addVolume

public abstract void addVolume(Volume v)
Adds a volume to this cell. v must be a volume which has been returned previously by the invocation of getVolume(int, de.grogra.vecmath.geom.Octree.State) on the parent cell.

Parameters:
v - volume of parent cell which has to be added to this cell

clearVolumes

public abstract void clearVolumes()
Clears the list of volumes of this cell.


createChild

protected abstract Octree.Cell createChild(int position)
This factory method creates a new cell of the same class as this cell. It will be used as child of this cell.

Parameters:
position - value for position
Returns:
newly created cell

getExtent

public void getExtent(Octree tree,
                      Tuple3d min,
                      Tuple3d max)
Determines the spatial extent of this cell.

Parameters:
tree - the octree to which this cell belongs
min - the minimum coordinates will be placed in here
max - the maximum coordinates will be placed in here

getVolume

public abstract Volume getVolume(int index,
                                 Octree.State state)
Returns the indexth volume of the list of volumes of this cell. The returned volume may only be used up to the next invocation of this method with the same state, so that the state is allowed to store information about the volume.

Parameters:
index - index of volume in list
state - instance of State as returned by Octree.createState()
Returns:
volume at index

getVolumeCount

public abstract int getVolumeCount()
Returns the number of volumes in this cell. Volumes contained in child cells are not counted.

Returns:
number of volumes