Struct KDTreeNode

Struct Documentation

struct KDTreeNode

A single node of a kd tree.

A node covers the contiguous block of count_ points that starts at index start_ of the tree’s point array. An interior node is split along dimension splitDim_ into children lchild_ and rchild_; a leaf has splitDim_ = -1 and both children equal to nullNode. Its bounding box is not stored here but in flat arrays owned by the tree (see KDTree::nodeLo() and nodeHi()), so that a node is a small fixed-size record with no allocations of its own; classes built on KDTree that keep further per-node data (e.g. KernelDensity’s weight sums) do likewise, in arrays indexed by node.

Public Members

std::size_t start_ = 0

Index of the node’s first point

std::size_t count_ = 0

Number of points in the node

std::size_t lchild_ = nullNode

Index of the left child, or nullNode if this is a leaf

std::size_t rchild_ = nullNode

Index of the right child, or nullNode if this is a leaf

std::size_t parent_ = nullNode

Index of the parent node (nullNode for the root)

int splitDim_ = -1

Dimension along which the node is split, or -1 if this is a leaf