TTK
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
ttk::KDTree< dataType, Container > Class Template Reference

TTK KD-Tree. More...

#include <KDTree.h>

Public Types

using KDTreeRoot = std::unique_ptr< KDTree >
 
using KDTreeMap = std::vector< KDTree * >
 

Public Member Functions

 KDTree ()=default
 
 KDTree (const bool include_weights, const int p)
 
 KDTree (KDTree *const father, const int coords_number, const bool is_left)
 
KDTreeMap build (dataType *data, const int &ptNumber, const int &dimension, const std::vector< std::vector< dataType > > &weights={}, const int &weightNumber=1, const int &nodeNumber=-1, const bool &preciseBoundingBox=false)
 
void buildRecursive (dataType *data, std::vector< int > &idx_side, const int &ptNumber, const int &dimension, KDTree< dataType, Container > *parent, KDTreeMap &correspondence_map, const int &nodeNumber, const int &maximumLevel, int &createdNumberNode, const std::vector< std::vector< dataType > > &weights={}, const int &weightNumber=1)
 
void updateWeight (const dataType new_weight, const int weight_index=0)
 
void updateMinSubweight (const int weight_index=0)
 
void getKClosest (const unsigned int k, const Container &coordinates, KDTreeMap &neighbours, std::vector< dataType > &costs, const int weight_index=0)
 
template<typename PowerFunc >
void recursiveGetKClosest (const unsigned int k, const Container &coordinates, KDTreeMap &neighbours, std::vector< dataType > &costs, const int weight_index, const PowerFunc &power)
 
template<typename PowerFunc >
dataType getCost (const Container &coordinates, const PowerFunc &power) const
 
template<typename PowerFunc >
dataType distanceToBox (const KDTree< dataType, Container > &subtree, const Container &coordinates, const PowerFunc &power) const
 
const std::vector< dataType > & getCoordinates () const
 
dataType getWeight (const int weight_index=0) const
 
dataType getMinSubWeight (const int weight_index=0) const
 
bool isLeaf () const
 
bool isRoot () const
 

Public Attributes

KDTreeRoot left_ {}
 
KDTreeRoot right_ {}
 
KDTreeparent_ {}
 
int id_ {}
 
Container coordinates_ {}
 
Container coords_min_ {}
 
Container coords_max_ {}
 
int level_ {}
 
std::vector< dataType > weight_ {}
 
std::vector< dataType > min_subweights_ {}
 

Protected Attributes

bool is_left_ {}
 
int coords_number_ {0}
 
int p_ {2}
 
bool include_weights_ {false}
 

Detailed Description

template<typename dataType, typename Container>
class ttk::KDTree< dataType, Container >

TTK KD-Tree.

Author
Joseph Budin josep.nosp@m.h.bu.nosp@m.din@p.nosp@m.olyt.nosp@m.echni.nosp@m.que..nosp@m.edu
Date
June 2018

Definition at line 21 of file KDTree.h.

Member Typedef Documentation

◆ KDTreeMap

template<typename dataType , typename Container >
using ttk::KDTree< dataType, Container >::KDTreeMap = std::vector<KDTree *>

Definition at line 37 of file KDTree.h.

◆ KDTreeRoot

template<typename dataType , typename Container >
using ttk::KDTree< dataType, Container >::KDTreeRoot = std::unique_ptr<KDTree>

Definition at line 36 of file KDTree.h.

Constructor & Destructor Documentation

◆ KDTree() [1/3]

template<typename dataType , typename Container >
ttk::KDTree< dataType, Container >::KDTree ( )
default

◆ KDTree() [2/3]

template<typename dataType , typename Container >
ttk::KDTree< dataType, Container >::KDTree ( const bool  include_weights,
const int  p 
)
inline

Definition at line 54 of file KDTree.h.

◆ KDTree() [3/3]

template<typename dataType , typename Container >
ttk::KDTree< dataType, Container >::KDTree ( KDTree< dataType, Container > *const  father,
const int  coords_number,
const bool  is_left 
)
inline

Definition at line 58 of file KDTree.h.

Member Function Documentation

◆ build()

template<typename dataType , typename Container >
ttk::KDTree< dataType, Container >::KDTreeMap ttk::KDTree< dataType, Container >::build ( dataType *  data,
const int &  ptNumber,
const int &  dimension,
const std::vector< std::vector< dataType > > &  weights = {},
const int &  weightNumber = 1,
const int &  nodeNumber = -1,
const bool &  preciseBoundingBox = false 
)

Definition at line 154 of file KDTree.h.

◆ buildRecursive()

template<typename dataType , typename Container >
void ttk::KDTree< dataType, Container >::buildRecursive ( dataType *  data,
std::vector< int > &  idx_side,
const int &  ptNumber,
const int &  dimension,
KDTree< dataType, Container > *  parent,
KDTreeMap correspondence_map,
const int &  nodeNumber,
const int &  maximumLevel,
int &  createdNumberNode,
const std::vector< std::vector< dataType > > &  weights = {},
const int &  weightNumber = 1 
)

Definition at line 301 of file KDTree.h.

◆ distanceToBox()

template<typename dataType , typename Container >
template<typename PowerFunc >
dataType ttk::KDTree< dataType, Container >::distanceToBox ( const KDTree< dataType, Container > &  subtree,
const Container &  coordinates,
const PowerFunc &  power 
) const
inline

Definition at line 120 of file KDTree.h.

◆ getCoordinates()

template<typename dataType , typename Container >
const std::vector< dataType > & ttk::KDTree< dataType, Container >::getCoordinates ( ) const
inline

Definition at line 134 of file KDTree.h.

◆ getCost()

template<typename dataType , typename Container >
template<typename PowerFunc >
dataType ttk::KDTree< dataType, Container >::getCost ( const Container &  coordinates,
const PowerFunc &  power 
) const
inline

Definition at line 110 of file KDTree.h.

◆ getKClosest()

template<typename dataType , typename Container >
void ttk::KDTree< dataType, Container >::getKClosest ( const unsigned int  k,
const Container &  coordinates,
KDTreeMap neighbours,
std::vector< dataType > &  costs,
const int  weight_index = 0 
)

Puts the k closest points to the given coordinates in the "neighbours" vector along with their costs in the "costs" vector The output is not sorted, if you are interested in the k nearest neighbours in the order, will need to sort them according to their cost.

Definition at line 433 of file KDTree.h.

◆ getMinSubWeight()

template<typename dataType , typename Container >
dataType ttk::KDTree< dataType, Container >::getMinSubWeight ( const int  weight_index = 0) const
inline

Definition at line 140 of file KDTree.h.

◆ getWeight()

template<typename dataType , typename Container >
dataType ttk::KDTree< dataType, Container >::getWeight ( const int  weight_index = 0) const
inline

Definition at line 137 of file KDTree.h.

◆ isLeaf()

template<typename dataType , typename Container >
bool ttk::KDTree< dataType, Container >::isLeaf ( ) const
inline

Definition at line 143 of file KDTree.h.

◆ isRoot()

template<typename dataType , typename Container >
bool ttk::KDTree< dataType, Container >::isRoot ( ) const
inline

Definition at line 146 of file KDTree.h.

◆ recursiveGetKClosest()

template<typename dataType , typename Container >
template<typename PowerFunc >
void ttk::KDTree< dataType, Container >::recursiveGetKClosest ( const unsigned int  k,
const Container &  coordinates,
KDTreeMap neighbours,
std::vector< dataType > &  costs,
const int  weight_index,
const PowerFunc &  power 
)

Definition at line 462 of file KDTree.h.

◆ updateMinSubweight()

template<typename dataType , typename Container >
void ttk::KDTree< dataType, Container >::updateMinSubweight ( const int  weight_index = 0)

Definition at line 406 of file KDTree.h.

◆ updateWeight()

template<typename dataType , typename Container >
void ttk::KDTree< dataType, Container >::updateWeight ( const dataType  new_weight,
const int  weight_index = 0 
)
inline

Definition at line 88 of file KDTree.h.

Member Data Documentation

◆ coordinates_

template<typename dataType , typename Container >
Container ttk::KDTree< dataType, Container >::coordinates_ {}

Definition at line 45 of file KDTree.h.

◆ coords_max_

template<typename dataType , typename Container >
Container ttk::KDTree< dataType, Container >::coords_max_ {}

Definition at line 47 of file KDTree.h.

◆ coords_min_

template<typename dataType , typename Container >
Container ttk::KDTree< dataType, Container >::coords_min_ {}

Definition at line 46 of file KDTree.h.

◆ coords_number_

template<typename dataType , typename Container >
int ttk::KDTree< dataType, Container >::coords_number_ {0}
protected

Definition at line 27 of file KDTree.h.

◆ id_

template<typename dataType , typename Container >
int ttk::KDTree< dataType, Container >::id_ {}

Definition at line 44 of file KDTree.h.

◆ include_weights_

template<typename dataType , typename Container >
bool ttk::KDTree< dataType, Container >::include_weights_ {false}
protected

Definition at line 33 of file KDTree.h.

◆ is_left_

template<typename dataType , typename Container >
bool ttk::KDTree< dataType, Container >::is_left_ {}
protected

Definition at line 25 of file KDTree.h.

◆ left_

template<typename dataType , typename Container >
KDTreeRoot ttk::KDTree< dataType, Container >::left_ {}

Definition at line 39 of file KDTree.h.

◆ level_

template<typename dataType , typename Container >
int ttk::KDTree< dataType, Container >::level_ {}

Definition at line 48 of file KDTree.h.

◆ min_subweights_

template<typename dataType , typename Container >
std::vector<dataType> ttk::KDTree< dataType, Container >::min_subweights_ {}

Definition at line 51 of file KDTree.h.

◆ p_

template<typename dataType , typename Container >
int ttk::KDTree< dataType, Container >::p_ {2}
protected

Definition at line 30 of file KDTree.h.

◆ parent_

template<typename dataType , typename Container >
KDTree* ttk::KDTree< dataType, Container >::parent_ {}

Definition at line 41 of file KDTree.h.

◆ right_

template<typename dataType , typename Container >
KDTreeRoot ttk::KDTree< dataType, Container >::right_ {}

Definition at line 40 of file KDTree.h.

◆ weight_

template<typename dataType , typename Container >
std::vector<dataType> ttk::KDTree< dataType, Container >::weight_ {}

Definition at line 50 of file KDTree.h.


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