CMS 3D CMS Logo

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 53 of file KDTreeLinkerTools.h.

Constructor & Destructor Documentation

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

Definition at line 62 of file KDTreeLinkerTools.h.

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

Member Function Documentation

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

Definition at line 81 of file KDTreeLinkerTools.h.

81  {
82  poolSize = sizeData*2-1;
83  median.resize(poolSize);
84  right.resize(poolSize);
85  dimOther.resize(poolSize);
86  data.resize(poolSize);
87  };
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 67 of file KDTreeLinkerTools.h.

67  {
68  median.clear();
69  right.clear();
70  dimOther.clear();
71  data.clear();
72  poolSize = -1;
73  poolPos = -1;
74  }
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 64 of file KDTreeLinkerTools.h.

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

Definition at line 76 of file KDTreeLinkerTools.h.

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

Definition at line 89 of file KDTreeLinkerTools.h.

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

Definition at line 97 of file KDTreeLinkerTools.h.

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

Member Data Documentation

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

Definition at line 56 of file KDTreeLinkerTools.h.

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

Definition at line 54 of file KDTreeLinkerTools.h.

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

Definition at line 60 of file KDTreeLinkerTools.h.

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

Definition at line 59 of file KDTreeLinkerTools.h.

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

Definition at line 55 of file KDTreeLinkerTools.h.

Referenced by progressbar.Bar::update(), and progressbar.BouncingBar::update().