kdtree

This module is based on https://github.com/Mihail-K/kdtree.

Members

Functions

add
void add(KDNode!(k, T)* root, T[k] point, size_t depth)

Adds a new point to the kd tree.

elements
T[k][] elements(KDNode!(k, T)* node)

Creates a slice of all elements in the kd tree.

nearest
const(T[k]) nearest(KDNode!(k, T)* root, T[k] point)

Finds the neares neighbor in the kd tree using euclidean distance metric. root must not be empty.

rebalance
void rebalance(KDNode!(k, T)* root)

Rebalances the kd tree by creating a new tree with the same elements

size
size_t size(KDNode!(k, T)* node)

Counts the number of elements in the kd tree.

Structs

KDNode
struct KDNode(size_t k, T)
Undocumented in source.

Templates

kdTree
template kdTree(size_t k, T)

Creates a new kd tree.

Meta