September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -26,7 +26,7 @@ class Kd_tree(n, bounds) {
|
|||
}
|
||||
|
||||
var s2 = ((split + 1) % d.len); # cycle coordinates
|
||||
Kd_node(d: d, split :split,
|
||||
Kd_node(d: d, split: split,
|
||||
left: self.nk2(s2, exset.first(m)),
|
||||
right: self.nk2(s2, exset.last(m-1)));
|
||||
}
|
||||
|
|
@ -96,12 +96,12 @@ func find_nearest(k, t, p) {
|
|||
}
|
||||
|
||||
func show_nearest(k, heading, kd, p) {
|
||||
print <<"-END"
|
||||
print <<-"END"
|
||||
#{heading}:
|
||||
Point: [#{p.join(',')}]
|
||||
END
|
||||
var n = find_nearest(k, kd, p);
|
||||
print <<"-END"
|
||||
print <<-"END"
|
||||
Nearest neighbor: [#{n.nearest.join(',')}]
|
||||
Distance: #{sqrt(n.dist_sqd)}
|
||||
Nodes visited: #{n.nodes_visited()}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue