CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
KDTreeNodes< DATA > Struct Template Reference

#include <KDTreeLinkerTools.h>

Public Member Functions

void build (int sizeData)
 
void clear ()
 
bool empty () const
 
int getNextNode ()
 
constexpr bool isLeaf (int right) const
 
bool isLeafIndex (int index) const
 
constexpr KDTreeNodes ()
 
int size () const
 

Public Attributes

std::vector< DATA > data
 
std::vector< float > dimOther
 
std::vector< float > median
 
int poolPos
 
int poolSize
 
std::vector< int > right
 

Detailed Description

template<typename DATA>
struct KDTreeNodes< DATA >

Definition at line 52 of file KDTreeLinkerTools.h.

Constructor & Destructor Documentation

template<typename DATA >
constexpr KDTreeNodes< DATA >::KDTreeNodes ( )
inline

Definition at line 61 of file KDTreeLinkerTools.h.

61 : poolSize(-1), poolPos(-1) {}

Member Function Documentation

template<typename DATA >
void KDTreeNodes< DATA >::build ( int  sizeData)
inline

Definition at line 80 of file KDTreeLinkerTools.h.

References KDTreeNodes< DATA >::data, KDTreeNodes< DATA >::dimOther, KDTreeNodes< DATA >::median, KDTreeNodes< DATA >::poolSize, and KDTreeNodes< DATA >::right.

80  {
81  poolSize = sizeData*2-1;
82  median.resize(poolSize);
83  right.resize(poolSize);
84  dimOther.resize(poolSize);
85  data.resize(poolSize);
86  };
std::vector< int > right
std::vector< float > dimOther
std::vector< float > median
std::vector< DATA > data
template<typename DATA >
void KDTreeNodes< DATA >::clear ( void  )
inline

Definition at line 66 of file KDTreeLinkerTools.h.

References KDTreeNodes< DATA >::data, KDTreeNodes< DATA >::dimOther, KDTreeNodes< DATA >::median, KDTreeNodes< DATA >::poolPos, KDTreeNodes< DATA >::poolSize, and KDTreeNodes< DATA >::right.

66  {
67  median.clear();
68  right.clear();
69  dimOther.clear();
70  data.clear();
71  poolSize = -1;
72  poolPos = -1;
73  }
std::vector< int > right
std::vector< float > dimOther
std::vector< float > median
std::vector< DATA > data
template<typename DATA >
bool KDTreeNodes< DATA >::empty ( void  ) const
inline

Definition at line 63 of file KDTreeLinkerTools.h.

References KDTreeNodes< DATA >::poolPos.

63 { return poolPos == -1; }
template<typename DATA >
int KDTreeNodes< DATA >::getNextNode ( )
inline

Definition at line 75 of file KDTreeLinkerTools.h.

References KDTreeNodes< DATA >::poolPos.

75  {
76  ++poolPos;
77  return poolPos;
78  }
template<typename DATA >
constexpr bool KDTreeNodes< DATA >::isLeaf ( int  right) const
inline

Definition at line 88 of file KDTreeLinkerTools.h.

Referenced by KDTreeNodes< DATA >::isLeafIndex().

88  {
89  // Valid values of right are always >= 2
90  // index 0 is the root, and 1 is the first left node
91  // Exploit index values 0 and 1 to mark which of dim1/dim2 is the
92  // current one in recSearch() at the depth of the leaf.
93  return right < 2;
94  }
std::vector< int > right
template<typename DATA >
bool KDTreeNodes< DATA >::isLeafIndex ( int  index) const
inline

Definition at line 96 of file KDTreeLinkerTools.h.

References KDTreeNodes< DATA >::isLeaf(), and KDTreeNodes< DATA >::right.

96  {
97  return isLeaf(right[index]);
98  }
constexpr bool isLeaf(int right) const
std::vector< int > right
template<typename DATA >
int KDTreeNodes< DATA >::size ( void  ) const
inline

Definition at line 64 of file KDTreeLinkerTools.h.

References KDTreeNodes< DATA >::poolPos.

64 { return poolPos + 1; }

Member Data Documentation

template<typename DATA >
std::vector<DATA> KDTreeNodes< DATA >::data
template<typename DATA >
std::vector<float> KDTreeNodes< DATA >::dimOther

Definition at line 55 of file KDTreeLinkerTools.h.

Referenced by KDTreeNodes< DATA >::build(), and KDTreeNodes< DATA >::clear().

template<typename DATA >
std::vector<float> KDTreeNodes< DATA >::median

Definition at line 53 of file KDTreeLinkerTools.h.

Referenced by KDTreeNodes< DATA >::build(), and KDTreeNodes< DATA >::clear().

template<typename DATA >
int KDTreeNodes< DATA >::poolPos
template<typename DATA >
int KDTreeNodes< DATA >::poolSize

Definition at line 58 of file KDTreeLinkerTools.h.

Referenced by KDTreeNodes< DATA >::build(), and KDTreeNodes< DATA >::clear().

template<typename DATA >
std::vector<int> KDTreeNodes< DATA >::right