17 class CKDNode :
public std::enable_shared_from_this<CKDNode>
26 :
CKDNode(key, value, lvalue_cast(
std::make_pair(Mat(), Mat())), 0, 0, nullptr, nullptr) {}
37 DllExport
CKDNode(pair_mat_t &boundingBox, byte splitVal,
int splitDim, std::shared_ptr<CKDNode> left, std::shared_ptr<CKDNode> right)
38 :
CKDNode(EmptyMat, 0, boundingBox, splitVal, splitDim, left, right) {}
50 DllExport
void save(FILE *pFile)
const;
65 DllExport
void findNearestNeighbors(
const Mat &key,
size_t maxNeighbors, pair_mat_t &searchBox,
float &searchRadius, std::vector<std::shared_ptr<const CKDNode>> &nearestNeighbors)
const;
97 DllExport std::shared_ptr<CKDNode>
Left(
void)
const {
return m_pLeft; }
106 DllExport
CKDNode(Mat &key, byte value, pair_mat_t &boundingBox, byte splitVal,
int splitDim, std::shared_ptr<CKDNode> left, std::shared_ptr<CKDNode> right);
k-D Node class for the k-D Tree data structure
pair_mat_t getBoundingBox(void) const
Returns the spatial bounding box, containing all the keys for the current branch. ...
std::shared_ptr< CKDNode > m_pRight
Mat getKey(void) const
Returns the key of the leaf-node (k-d point)
std::shared_ptr< CKDNode > m_pLeft
CKDNode(Mat &key, byte value)
Leaf node constructor.
std::shared_ptr< CKDNode > Right(void) const
Returns the pointer to the right child.
int getSplitDim(void) const
Returns the split dimension of the branch-node.
byte getValue(void) const
Returns the value of the leaf-node.
CKDNode(pair_mat_t &boundingBox, byte splitVal, int splitDim, std::shared_ptr< CKDNode > left, std::shared_ptr< CKDNode > right)
Branch node constructor.
bool operator=(const CKDNode)=delete
bool isLeaf(void) const
Checks whether the node is either leaf or brach node.
std::shared_ptr< CKDNode > Left(void) const
Returns the pointer to the left child.
void findNearestNeighbors(const Mat &key, size_t maxNeighbors, pair_mat_t &searchBox, float &searchRadius, std::vector< std::shared_ptr< const CKDNode >> &nearestNeighbors) const
Auxiliary recursive method for finding the k-nearest (in terms of the Euclidian distance between the ...
byte getSplitVal(void) const
Returns the split value of the brach-node.
void save(FILE *pFile) const
Saves the state of the node to the file.