org.jmol.bspt
Class SphereIterator

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

public class SphereIterator
extends java.lang.Object

Iterator used for finding all points within a sphere or a hemisphere

Obtain a SphereIterator by calling Bspt.allocateSphereIterator().

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

re-initialize in order to reuse the same SphereIterator

Author:
Miguel, miguel@jmol.org

Method Summary
 float foundDistance2()
          After calling nextElement(), allows one to find out the value of the distance squared.
 boolean hasMoreElements()
          normal iterator predicate
 void initialize(Tuple center, float radius)
          initialize to return all points within the sphere defined by center and radius
 void initializeHemisphere(Tuple center, float radius)
          initialize to return all points within the hemisphere defined by center and radius.
 Tuple nextElement()
          normal iterator method
 void release()
          nulls internal references
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initialize

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

Parameters:
center -
radius -

initializeHemisphere

public void initializeHemisphere(Tuple 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 -

release

public void release()
nulls internal references


hasMoreElements

public boolean hasMoreElements()
normal iterator predicate

Returns:
boolean

nextElement

public Tuple 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