K-d tree: Difference between revisions

Updated first D entry
(Updated second D entry)
(Updated first D entry)
Line 212:
Points are values, the code is templated on the the dimensionality of the points and the floating point type of the coordinate. Instead of sorting it uses the faster topN, that partitions the points array in two halves around their median.
<lang d>// Implmentation following pseudocode from
// "An intoductoryintroductory tutorial on kd-trees" by Andrew W. Moore,
// Carnegie Mellon University, PDF accessed from:
// http://www.autonlab.org/autonweb/14665
Line 245:
immutable int split;
KdNode!(k, F)* left, right;
 
// This naive ctor is currently necessary
this(in Point!(k, F) domElt_, in int split_,
KdNode!(k, F)* left_, KdNode!(k, F)* right_) pure nothrow {
this.domElt = domElt_;
this.split = split_;
this.left = left_;
this.right = right_;
}
}