Merge pull request #21200 from Snuffleupagus/Intersector-grid-push

Shorten how intersectors are added to the grid in the `Intersector` constructor
This commit is contained in:
Jonas Jenwald 2026-04-30 12:56:38 +02:00 committed by GitHub
commit adf07ea51c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -192,11 +192,7 @@ class Intersector {
const h = Math.floor((iMax - iMin) / STEPS);
for (let i = iMin; i <= iMin + h * STEPS; i += STEPS) {
for (let j = 0; j <= w; j++) {
let existing = this.#grid[i + j];
if (!existing) {
this.#grid[i + j] = existing = [];
}
existing.push(intersector);
(this.#grid[i + j] ??= []).push(intersector);
}
}
}