TTK
|
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_ {} |
KDTree * | parent_ {} |
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} |
TTK KD-Tree.
using ttk::KDTree< dataType, Container >::KDTreeMap = std::vector<KDTree *> |
using ttk::KDTree< dataType, Container >::KDTreeRoot = std::unique_ptr<KDTree> |
|
default |
|
inline |
|
inline |
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 |
||
) |
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 |
||
) |
|
inline |
|
inline |
|
inline |
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.
|
inline |
|
inline |
|
inline |
|
inline |
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 | ||
) |
void ttk::KDTree< dataType, Container >::updateMinSubweight | ( | const int | weight_index = 0 | ) |
|
inline |
Container ttk::KDTree< dataType, Container >::coordinates_ {} |
Container ttk::KDTree< dataType, Container >::coords_max_ {} |
Container ttk::KDTree< dataType, Container >::coords_min_ {} |
|
protected |
int ttk::KDTree< dataType, Container >::id_ {} |
|
protected |
|
protected |
KDTreeRoot ttk::KDTree< dataType, Container >::left_ {} |
int ttk::KDTree< dataType, Container >::level_ {} |
std::vector<dataType> ttk::KDTree< dataType, Container >::min_subweights_ {} |
|
protected |
KDTree* ttk::KDTree< dataType, Container >::parent_ {} |
KDTreeRoot ttk::KDTree< dataType, Container >::right_ {} |
std::vector<dataType> ttk::KDTree< dataType, Container >::weight_ {} |