de.grogra.vecmath.geom
Interface CellIterator

All Superinterfaces:
java.util.Iterator<Octree.Cell>
All Known Implementing Classes:
DefaultCellIterator

public interface CellIterator
extends java.util.Iterator<Octree.Cell>

A CellIterator is used to iterate over the cells of an octree which are intersected by a line. The iterated cells are ordered according to their position on the line. A typical usage is:

     iterator.setLine (line);
     while (iterator.hasNext ())
     {
         Octree.Cell c = iterator.nextCell ();
         double param = iterator.getEnteringParameter ();
         ...
     }
 

Author:
Ole Kniemeyer

Method Summary
 CellIterator dup()
          Returns a clone of this CellIterator.
 double getEnteringParameter()
          Returns the parameter at which the current cell was entered.
 void initialize(Octree tree)
          This method has to be invoked once to initialize the iterator for a given octree.
 void setLine(Line line)
          This method has to invoked in order to start a new iteration sequence over the octree cells which intersect line.
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Method Detail

dup

CellIterator dup()
Returns a clone of this CellIterator. All constant variables which are related to the structure of the octree are copied shallowly, state variables of the iterator are newly created without copying.

Returns:
clone of this iterator

getEnteringParameter

double getEnteringParameter()
Returns the parameter at which the current cell was entered. The current cell is the returned cell of the most recent invocation of #nextCell(). This cell is entered at the position line.start + parameter * line.direction.

Returns:
line parameter where current cell was entered

initialize

void initialize(Octree tree)
This method has to be invoked once to initialize the iterator for a given octree.

Parameters:
tree - the octree

setLine

void setLine(Line line)
This method has to invoked in order to start a new iteration sequence over the octree cells which intersect line.

Parameters:
line - the line for which octree cells shall be enumerated