Anonymous user
K-d tree: Difference between revisions
Updated D entry
(Updated first D entry) |
(Updated D entry) |
||
Line 222:
struct Point(size_t k, F) if (isFloatingPoint!F) {
F[k] data;
// Define opIndexAssign and opIndex for dmd.
▲ // alias data this; // kills DMD std.algorithm.swap inlining
enum size_t length = k;
Line 428 ⟶ 422:
{{out|Output, using the ldc2 compiler}}
<pre>Wikipedia example data:
Point:
Nearest neighbor:
Distance: 1.41421
Nodes visited: 3
k-d tree with 400000 random 3D float points (construction time: 250 ms):
Point:
Nearest neighbor:
Distance: 0.00790531
Nodes visited: 54
|