Simple kd-tree node data structure for use with PointKDTree. More...
#include <kdtree.h>
Public Types | |
enum | { ELeafFlag = 0x10 , EAxisMask = 0x0F } |
typedef _PointType | PointType |
typedef _DataRecord | DataRecord |
typedef uint32_t | IndexType |
typedef PointType::Scalar | Scalar |
Public Member Functions | |
GenericKDTreeNode () | |
Initialize a KD-tree node. | |
GenericKDTreeNode (const PointType &position, const DataRecord &data) | |
Initialize a KD-tree node with the given data record. | |
IndexType | getRightIndex (IndexType self) const |
Given the current node's index, return the index of the right child. | |
void | setRightIndex (IndexType self, IndexType value) |
Given the current node's index, set the right child index. | |
IndexType | getLeftIndex (IndexType self) const |
Given the current node's index, return the index of the left child. | |
void | setLeftIndex (IndexType self, IndexType value) |
Given the current node's index, set the left child index. | |
bool | isLeaf () const |
Check whether this is a leaf node. | |
void | setLeaf (bool value) |
Specify whether this is a leaf node. | |
uint16_t | getAxis () const |
Return the split axis associated with this node. | |
void | setAxis (uint8_t axis) |
Set the split flags associated with this node. | |
const PointType & | getPosition () const |
Return the position associated with this node. | |
void | setPosition (const PointType &value) |
Set the position associated with this node. | |
DataRecord & | getData () |
Return the data record associated with this node. | |
const DataRecord & | getData () const |
Return the data record associated with this node (const version) | |
void | setData (const DataRecord &val) |
Set the data record associated with this node. | |
Public Attributes | |
PointType | position |
IndexType | right |
DataRecord | data |
uint8_t | flags |
Simple kd-tree node data structure for use with PointKDTree.
This class is an example of how one might write a space-efficient kd-tree node that is compatible with the PointKDTree class. The implementation supports associating a custom data record with each node and works up to 16 dimensions.
_PointType | Underlying point data type (e.g. TPoint3<float>) |
_DataRecord | Custom storage that should be associated with each tree node |