cz.cuni.jagrlib.testing
Class UniformGrid.RaySegmentIterator2D

java.lang.Object
  extended by cz.cuni.jagrlib.DefaultProperty
      extended by cz.cuni.jagrlib.DefaultBrepIterator
          extended by cz.cuni.jagrlib.testing.UniformGrid.RaySegmentIterator2D
All Implemented Interfaces:
BrepIterator, Property
Enclosing class:
UniformGrid

protected class UniformGrid.RaySegmentIterator2D
extends DefaultBrepIterator

Custom iterator for ray-segment-pass (new version - 2DDDA).


Field Summary
protected  double[] act0
          Temporary array to hold vertex coordinates.
protected  double[] act1
           
protected  int attrEdge
          Accelerator: attribute holding edge vertices.
protected  int attrVertex
          Accelerator: attribute holding vertex coordinates.
protected  double bound
          Ray-length searched so far.
protected  double[] direction
          Ray direction.
protected  double dx
          2DDDA constant (distance between adjacent x-wall intersections).
protected  double dy
          2DDDA constant (distance between adjacent y-wall intersections).
protected  int iCell
          Actual cell index.
protected  int inciy
          Index increment (vertical).
protected  int incx
          Integer x-increment.
protected  int incy
          Integer y-increment.
protected  double lx
          2DDDA variable - distance to the nearest x-wall.
protected  double ly
          2DDDA variable - distance to the nearest y-wall.
protected  double minl
          2DDDA variable - distance to the nearest wall.
protected  double[] origin
          Ray origin.
protected  java.util.SortedSet<UniformGrid.GridHeapItem> result
          Result heap.
protected  double[] t
          T-bounds for ray-AABB intersection.
protected  java.util.BitSet used
          Set of already examined objects.
protected  int[] vert
          Temporary array for edge vertex handles.
protected  int xCell
          Actual cell-coordinate (horizontal).
protected  int yCell
          Actual cell-coordinate (vertical).
 
Fields inherited from interface cz.cuni.jagrlib.iface.BrepIterator
CONTEXT, PROJ_COORDS, SORT_ASCENDING, SORT_DESCENDING, SORT_ORDER
 
Fields inherited from interface cz.cuni.jagrlib.iface.Property
LOGGING, STATISTICS, TEXT_DESCRIPTION
 
Constructor Summary
protected UniformGrid.RaySegmentIterator2D()
           
 
Method Summary
 void init(double[] orig, double[] dir)
          Initializes all constants depending on the ray geometry.
protected  boolean initPass()
          Initializes the pass (should be called at the beginning of each pass).
protected  void insertCell(int index)
          Inserts all objects from the given cell into the heap.
 int next()
          Returns the next object or NULL.
 void reset()
          Reset the iterator.
 
Methods inherited from class cz.cuni.jagrlib.DefaultBrepIterator
left, toArray
 
Methods inherited from class cz.cuni.jagrlib.DefaultProperty
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, commit, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, get, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, set, stringProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cz.cuni.jagrlib.iface.Property
commit, get, set
 

Field Detail

origin

protected final double[] origin
Ray origin.


direction

protected final double[] direction
Ray direction.


xCell

protected int xCell
Actual cell-coordinate (horizontal).


yCell

protected int yCell
Actual cell-coordinate (vertical).


iCell

protected int iCell
Actual cell index.


incx

protected int incx
Integer x-increment.


incy

protected int incy
Integer y-increment.


inciy

protected int inciy
Index increment (vertical).


dx

protected double dx
2DDDA constant (distance between adjacent x-wall intersections).


dy

protected double dy
2DDDA constant (distance between adjacent y-wall intersections).


lx

protected double lx
2DDDA variable - distance to the nearest x-wall.


ly

protected double ly
2DDDA variable - distance to the nearest y-wall.


minl

protected double minl
2DDDA variable - distance to the nearest wall.


bound

protected double bound
Ray-length searched so far.


result

protected java.util.SortedSet<UniformGrid.GridHeapItem> result
Result heap.


used

protected final java.util.BitSet used
Set of already examined objects.


act0

protected final double[] act0
Temporary array to hold vertex coordinates.


act1

protected final double[] act1

vert

protected final int[] vert
Temporary array for edge vertex handles.


t

protected final double[] t
T-bounds for ray-AABB intersection.


attrEdge

protected final int attrEdge
Accelerator: attribute holding edge vertices.


attrVertex

protected final int attrVertex
Accelerator: attribute holding vertex coordinates.

Constructor Detail

UniformGrid.RaySegmentIterator2D

protected UniformGrid.RaySegmentIterator2D()
Method Detail

init

public void init(double[] orig,
                 double[] dir)
Initializes all constants depending on the ray geometry.


insertCell

protected void insertCell(int index)
Inserts all objects from the given cell into the heap.


initPass

protected boolean initPass()
Initializes the pass (should be called at the beginning of each pass).

Returns:
true if the result set is empty.

reset

public void reset()
Reset the iterator.

Specified by:
reset in interface BrepIterator
Specified by:
reset in class DefaultBrepIterator

next

public final int next()
Returns the next object or NULL.

Specified by:
next in interface BrepIterator
Specified by:
next in class DefaultBrepIterator
Returns:
Brep.NULL if there is no next object available.