NuKDDistOrd< T, D > Class Template Reference

Functor defining an ordering based on distance to a fixed point. More...

List of all members.

Public Member Functions

 NuKDDistOrd (NuKDPt< D > q)
bool operator() (const NuKDPtWithPayload< T, D > &a, const NuKDPtWithPayload< T, D > &b) const

Protected Attributes

NuKDPt< D > p

Detailed Description

template<class T, unsigned int D>
class NuKDDistOrd< T, D >

Functor defining an ordering based on distance to a fixed point.

Definition at line 30 of file NuKDTree.cxx.


Constructor & Destructor Documentation

template<class T, unsigned int D>
NuKDDistOrd< T, D >::NuKDDistOrd ( NuKDPt< D >  q  )  [inline]

Definition at line 33 of file NuKDTree.cxx.

00033 : p(q){}


Member Function Documentation

template<class T, unsigned int D>
bool NuKDDistOrd< T, D >::operator() ( const NuKDPtWithPayload< T, D > &  a,
const NuKDPtWithPayload< T, D > &  b 
) const [inline]

Definition at line 34 of file NuKDTree.cxx.

References NuKDDistOrd< T, D >::p, NuKDPtWithPayload< T, D >::pt, and SQR.

00036   {
00037     float dista = 0;
00038     float distb = 0;
00039     for(unsigned int d = 0; d < D; ++d){
00040       dista += SQR(a.pt[d]-p[d]);
00041       distb += SQR(b.pt[d]-p[d]);
00042     }
00043 
00044     return dista > distb;
00045   }


Member Data Documentation

template<class T, unsigned int D>
NuKDPt<D> NuKDDistOrd< T, D >::p [protected]

Definition at line 47 of file NuKDTree.cxx.

Referenced by NuKDDistOrd< T, D >::operator()().


The documentation for this class was generated from the following file:

Generated on 16 Jan 2018 for loon by  doxygen 1.6.1