Skip to content

Commit

Permalink
improve performance for small-radius knn queries
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Apr 21, 2023
1 parent eaca470 commit ce745ee
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ export default class Flatbush {
const dx = axisDist(x, this._boxes[pos], this._boxes[pos + 2]);
const dy = axisDist(y, this._boxes[pos + 1], this._boxes[pos + 3]);
const dist = dx * dx + dy * dy;
if (dist > maxDistSquared) continue;

if (nodeIndex >= this.numItems * 4) {
q.push(index << 1, dist); // node (use even id)
Expand Down

0 comments on commit ce745ee

Please sign in to comment.