Skip to content

Commit

Permalink
Removed ability of AabbTree to resize client bounds using `AabbTree…
Browse files Browse the repository at this point in the history
….padding`. Removed `AabbTree.padding`.
  • Loading branch information
waynemwashuma committed Mar 6, 2024
1 parent fd680b2 commit c8456d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const canvasBound = new BoundingBox(
)
const bound = new BoundingBox(0, 0, renderer.width + 20, renderer.height + 20)
const quadtree = new QuadTree(bound, 3);
const aabbtree = new AabbTree(new Vector2(15, 15))
const aabbtree = new AabbTree()
const GRID_NUMBER = 20
const grid = new HashGrid(
renderer.width / GRID_NUMBER, renderer.height / GRID_NUMBER,
Expand Down
11 changes: 2 additions & 9 deletions src/aabbtree.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,9 @@ export class AabbTree {
*/
_pool = new Pool(0, () => new AabbTreeNode())
/**
*
* @param {Vector2} padding
* @type {AabbTreeNode<T> | null}
*/
constructor(padding = new Vector2(0, 0)) {
this.root = null
this.padding = padding
}
root = null
/**
* @private
* @param {AabbTreeNode<T> |null} node
Expand Down Expand Up @@ -140,9 +136,6 @@ export class AabbTree {
client.node = node
node.bounds.copy(bound)

Vector2.prototype.sub.call(node.bounds.min, this.padding)
Vector2.prototype.add.call(node.bounds.max, this.padding)

if (!this.root) {
this.root = node
return true
Expand Down

0 comments on commit c8456d3

Please sign in to comment.