Package org.jmol.bspt

Class CubeIterator


  • public class CubeIterator
    extends java.lang.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

      Fields 
      Modifier and Type Field Description
      private Bspt bspt  
      private float cx  
      private float cy  
      private float cz  
      private float dx  
      private float dy  
      private float dz  
      private Leaf leaf  
      private int leafIndex  
      private float radius  
      private int sp  
      private Element[] stack  
      private boolean tHemisphere  
    • Constructor Summary

      Constructors 
      Constructor Description
      CubeIterator​(Bspt bspt)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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​(javajs.util.T3 center, float radius, boolean hemisphereOnly)
      initialize to return all points within the sphere defined by center and radius
      private boolean isWithinRadius​(javajs.util.T3 t)
      checks one Point3f for box-based distance
      javajs.util.T3 nextElement()
      normal iterator method
      void release()
      nulls internal references
      (package private) void set​(Bspt bspt)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • bspt

        private Bspt bspt
      • sp

        private int sp
      • leafIndex

        private int leafIndex
      • leaf

        private Leaf leaf
      • radius

        private float radius
      • cx

        private float cx
      • cy

        private float cy
      • cz

        private float cz
      • dx

        private float dx
      • dy

        private float dy
      • dz

        private float dz
      • tHemisphere

        private boolean tHemisphere
    • Constructor Detail

      • CubeIterator

        CubeIterator​(Bspt bspt)
    • Method Detail

      • set

        void set​(Bspt bspt)
      • initialize

        public void initialize​(javajs.util.T3 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 javajs.util.T3 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​(javajs.util.T3 t)
        checks one Point3f for box-based distance
        Parameters:
        t -
        Returns:
        boolean