mirror of
https://github.com/mourner/flatbush.git
synced 2025-12-08 17:36:26 +00:00
fixed naming
This commit is contained in:
parent
eaf4e334c3
commit
cbc136d576
24
index.js
24
index.js
@ -237,24 +237,20 @@ export default class Flatbush {
|
||||
|
||||
// check if node bbox is completely inside query bbox
|
||||
if (minX <= nodeMinX && minY <= nodeMinY && maxX >= nodeMaxX && maxY >= nodeMaxY) {
|
||||
let pos_start = pos;
|
||||
let pos_end = pos;
|
||||
let posStart = pos;
|
||||
let posEnd = pos;
|
||||
|
||||
// depth search while not leaf
|
||||
while (pos_start >= this.numItems * 4) {
|
||||
pos_start = this._indices[pos_start >> 2] | 0;
|
||||
const pos_end_start = this._indices[pos_end >> 2] | 0;
|
||||
pos_end = Math.min(pos_end_start + this.nodeSize * 4, upperBound(pos_end_start, this._levelBounds))-4;
|
||||
while (posStart >= this.numItems * 4) {
|
||||
posStart = this._indices[posStart >> 2] | 0;
|
||||
const posEndStart = this._indices[posEnd >> 2] | 0;
|
||||
posEnd = Math.min(posEndStart + this.nodeSize * 4, upperBound(posEndStart, this._levelBounds)) - 4;
|
||||
}
|
||||
|
||||
for (let /** @type number */ leaf_pos = pos_start; leaf_pos <= pos_end; leaf_pos += 4) {
|
||||
const nodeMinX = this._boxes[leaf_pos + 0];
|
||||
const nodeMinY = this._boxes[leaf_pos + 1];
|
||||
const nodeMaxX = this._boxes[leaf_pos + 2];
|
||||
const nodeMaxY = this._boxes[leaf_pos + 3];
|
||||
const leaf_index = this._indices[leaf_pos >> 2];
|
||||
if (filterFn === undefined || filterFn(leaf_index)) {
|
||||
results.push(leaf_index); // leaf item
|
||||
for (let /** @type number */ leafPos = posStart; leafPos <= posEnd; leafPos += 4) {
|
||||
const leafIndex = this._indices[leafPos >> 2];
|
||||
if (filterFn === undefined || filterFn(leafIndex)) {
|
||||
results.push(leafIndex); // leaf item
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user