Auxiliary class for determination of smallest distance between pair of 3D points.  
 More...
#include <JGeometry3DToolkit.hh>
 | 
|   | JSmallestDistance3D () | 
|   | Default constructor.  
  | 
|   | 
| template<class T >  | 
| double  | operator() (T __begin, T __end) const | 
|   | Get smallest distance between two points.  
  | 
|   | 
 | 
| template<class T >  | 
| static double  | getDmin (T __begin, T __end) | 
|   | Recursive method to find the smallest distance.  
  | 
|   | 
Auxiliary class for determination of smallest distance between pair of 3D points. 
Definition at line 134 of file JGeometry3DToolkit.hh.
 
◆ JSmallestDistance3D()
  
  
      
        
          | JGEOMETRY3D::JSmallestDistance3D::JSmallestDistance3D  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ getDmin()
template<class T > 
  
  
      
        
          | static double JGEOMETRY3D::JSmallestDistance3D::getDmin  | 
          ( | 
          T |           __begin,  | 
         
        
           | 
           | 
          T |           __end ) | 
         
       
   | 
  
inlinestaticprotected   | 
  
 
Recursive method to find the smallest distance. 
- Parameters
 - 
  
    | __begin | begin of data  | 
    | __end | end of data  | 
  
   
- Returns
 - minimal distance 
 
Definition at line 144 of file JGeometry3DToolkit.hh.
  145    {
  147 
  148      const int N = 
distance(__begin, __end);
 
  149 
  150      if (N <= 3) {
  151 
  152        double Dmin = numeric_limits<double>::max();
  153 
  154        for (T i = __begin; i != __end; ++i) {
  155          for (T j = i; ++
j != __end; ) {
 
  156 
  157            const double d = getDistance(*i, *j);
  158 
  159            if (d < Dmin) {
  160              Dmin = d;
  161            }
  162          }
  163        }
  164 
  165        return Dmin;
  166 
  167      } else {
  168 
  169        T i = __begin;
  170 
  172 
  173        const double dl   = 
getDmin(__begin, i);
 
  174        const double dr   = 
getDmin(i,   __end);
 
  175 
  176        const double Dmin = min(dl, dr);
  177 
  178        T il = i;
  179        T ir = i;
  180 
  181        while (--il != __begin && i ->getZ() - il->getZ() < Dmin) {}
  182        while (++ir != __end   && ir->getZ() - i ->getZ() < Dmin) {}
  183 
  185 
  187 
  188        return min(Dmin, dz);
  189      }
  190    }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
 
static const JCompareZ compareZ
Function object for sorting elements.
 
static double getDmin(T __begin, T __end)
Recursive method to find the smallest distance.
 
static const JSmallestDistance2D getSmallestDistance2D
Function object for smallest distance determination.
 
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
 
 
 
 
◆ operator()()
template<class T > 
  
  
      
        
          | double JGEOMETRY3D::JSmallestDistance3D::operator()  | 
          ( | 
          T |           __begin,  | 
         
        
           | 
           | 
          T |           __end ) const | 
         
       
   | 
  
inline   | 
  
 
Get smallest distance between two points. 
Note that this method changes the order of the elements.
- Parameters
 - 
  
    | __begin | begin of data  | 
    | __end | end of data  | 
  
   
- Returns
 - minimal distance 
 
Definition at line 232 of file JGeometry3DToolkit.hh.
  233    {
  235 
  237 
  238      return getDmin(__begin, __end);
 
  239    }
 
 
 
◆ compareZ
  
  
      
        
          | const JCompareZ JGEOMETRY3D::JSmallestDistance3D::compareZ | 
         
       
   | 
  
static   | 
  
 
 
The documentation for this class was generated from the following file: