org.jmol.bspt

Class 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
Bsptbspt
float[]centerValues
floatcx
floatcy
floatcz
protected floatdx
protected floatdy
protected floatdz
Leafleaf
intleafIndex
floatradius
intsp
Element[]stack
booleantHemisphere
Constructor Summary
CubeIterator(Bspt bspt)
Method Summary
voidfindLeftLeaf()
does the work
floatfoundDistance2()
After calling nextElement(), allows one to find out the value of the distance squared.
booleanhasMoreElements()
normal iterator predicate
voidinitialize(Point3f center, float radius)
initialize to return all points within the sphere defined by center and radius
voidinitializeHemisphere(Point3f center, float radius)
initialize to return all points within the hemisphere defined by center and radius.
protected booleanisWithinRadius(Point3f t)
checks one Point3f for distance
Point3fnextElement()
normal iterator method
voidrelease()
nulls internal references

Field Detail

bspt

Bspt bspt

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

leaf

Leaf leaf

leafIndex

int leafIndex

radius

float radius

sp

int sp

stack

Element[] stack

tHemisphere

boolean tHemisphere

Constructor Detail

CubeIterator

CubeIterator(Bspt bspt)

Method Detail

findLeftLeaf

private void findLeftLeaf()
does the work

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

hasMoreElements

public boolean hasMoreElements()
normal iterator predicate

Returns: boolean

initialize

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

Parameters: center radius

initializeHemisphere

public void initializeHemisphere(Point3f center, float radius)
initialize to return all points within the hemisphere defined by center and radius.

the points returned are those that have a coordinate value >= to center along the first (x) dimension

Note that if you are iterating through all points, and two points are within radius and have the same x coordinate, then each will return the other.

Parameters: center radius

isWithinRadius

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

Parameters: t

Returns: boolean

nextElement

public Point3f nextElement()
normal iterator method

Returns: Tuple

release

public void release()
nulls internal references