org.jmol.bspt
Class CubeIterator

java.lang.Object
  extended by org.jmol.bspt.CubeIterator

public class CubeIterator
extends Object

Iterator used for finding all points within a box or a hemi-box

Obtain a CubeIterator by calling Bspt.allocateCubeIterator().

call initialize(...) or initializeHemizphere(...)

re-initialize in order to reuse the same CubeIterator

Author:
Miguel, miguel@jmol.org

Field Summary
(package private)  Bspt bspt
           
(package private)  float[] centerValues
           
private  float cx
           
private  float cy
           
private  float cz
           
protected  float dx
           
protected  float dy
           
protected  float dz
           
(package private)  Leaf leaf
           
(package private)  int leafIndex
           
(package private)  float radius
           
(package private)  int sp
           
(package private)  Element[] stack
           
(package private)  boolean tHemisphere
           
 
Constructor Summary
CubeIterator(Bspt bspt)
           
 
Method Summary
private  void findLeftLeaf()
          does the work
 float foundDistance2()
          After calling nextElement(), allows one to find out the value of the distance squared.
 boolean hasMoreElements()
          normal iterator predicate
 void initialize(Point3f center, float radius, boolean hemisphereOnly)
          initialize to return all points within the sphere defined by center and radius
private  boolean isWithinRadius(Point3f t)
          checks one Point3f for distance
 Point3f nextElement()
          normal iterator method
 void release()
          nulls internal references
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bspt

Bspt bspt

stack

Element[] stack

sp

int sp

leafIndex

int leafIndex

leaf

Leaf leaf

radius

float radius

centerValues

float[] centerValues

cx

private float cx

cy

private float cy

cz

private float cz

dx

protected float dx

dy

protected float dy

dz

protected float dz

tHemisphere

boolean tHemisphere
Constructor Detail

CubeIterator

CubeIterator(Bspt bspt)
Method Detail

initialize

public void initialize(Point3f center,
                       float radius,
                       boolean hemisphereOnly)
initialize to return all points within the sphere defined by center and radius

Parameters:
center -
radius -
hemisphereOnly -

release

public void release()
nulls internal references


hasMoreElements

public boolean hasMoreElements()
normal iterator predicate

Returns:
boolean

nextElement

public Point3f nextElement()
normal iterator method

Returns:
Tuple

foundDistance2

public float foundDistance2()
After calling nextElement(), allows one to find out the value of the distance squared. To get the distance just take the sqrt.

Returns:
float

findLeftLeaf

private void findLeftLeaf()
does the work


isWithinRadius

private boolean isWithinRadius(Point3f t)
checks one Point3f for distance

Parameters:
t -
Returns:
boolean