org.miv.pherd.ntree
Class CellSpace

java.lang.Object
  extended by org.miv.pherd.ntree.CellSpace
Direct Known Subclasses:
OctreeCellSpace, QuadtreeCellSpace

public abstract class CellSpace
extends Object

Cell space.

The cell space defines a rectangular region of a Cartesian 2D or 3D space. This region is defined by two extreme points "lo" and "hi" that represent the bottom-left-front point and the top-right-back point respectively.

The cell space defines also the number of sub-cells to create when subdividing a cell, and how to distribute the particles of a cell to these sub-cells. It allows generally to know where to put a particle in any space or subspace.

Since:
2007
Author:
Antoine Dutot

Field Summary
protected  double diag
          Largest diagonal length.
protected  Anchor hi
          The bounding box hi point.
protected  Anchor lo
          The bounding box low point.
 
Constructor Summary
CellSpace(Anchor lo, Anchor hi)
           
 
Method Summary
 boolean contains(double x, double y, double z)
          Does this space contains the given position.
 boolean contains(Particle particle)
          Does this space contains the given particle?.
 boolean contains2(double x, double y, double z)
           
abstract  int getDivisions()
          Number of sub-cells to create to divide a cell.
 Anchor getHiAnchor()
          Top-righ-back point defining the bounding box of this cell.
 Anchor getLoAnchor()
          Bottom-left-from point defining the bounding box of this cell.
 double getSize()
          The cell size estimation, often the length of the cell space largest diagonal.
abstract  CellSpace newSubCellSpace(int i)
          Create the appropriate cell space for the given sub-cell index.
 void resize(Point3 min, Point3 max)
          Resize this space to the given bounding box.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lo

protected Anchor lo
The bounding box low point.


hi

protected Anchor hi
The bounding box hi point.


diag

protected double diag
Largest diagonal length.

Constructor Detail

CellSpace

public CellSpace(Anchor lo,
                 Anchor hi)
Method Detail

getLoAnchor

public Anchor getLoAnchor()
Bottom-left-from point defining the bounding box of this cell.

Returns:
A point in 3D Cartesian space.
See Also:
getHiAnchor()

getHiAnchor

public Anchor getHiAnchor()
Top-righ-back point defining the bounding box of this cell.

Returns:
A point in 3D Cartesian space.
See Also:
getLoAnchor()

getDivisions

public abstract int getDivisions()
Number of sub-cells to create to divide a cell.

Returns:
The number of sub-cells obtained for a cell mitosis.

newSubCellSpace

public abstract CellSpace newSubCellSpace(int i)
Create the appropriate cell space for the given sub-cell index. This method role is to create a sub-cell space when subdividing a cell.

Parameters:
i - The sub-cell index, must be equal or larger than zero and less than getDivisions().
Returns:
A new cell space.

contains

public boolean contains(Particle particle)
Does this space contains the given particle?.

Parameters:
particle - The particle to classify.
Returns:
True if this space contains the given particle.

contains

public boolean contains(double x,
                        double y,
                        double z)
Does this space contains the given position.

Parameters:
x - The abscissa.
y - The ordinate.
z - The depth.
Returns:
True if this space contains the given position.

contains2

public boolean contains2(double x,
                         double y,
                         double z)

getSize

public double getSize()
The cell size estimation, often the length of the cell space largest diagonal.

Returns:
The cell size estimation.

resize

public void resize(Point3 min,
                   Point3 max)
Resize this space to the given bounding box. This operation is valid only if this CellSpace has no child spaces.

Parameters:
min - The lowest point (bottom-left-front).
max - The highest point (top-right-back).


Copyright © 2011. All Rights Reserved.