-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
For some reason, when dealing with line segments using get(), all objects are returned. I'm thinking maybe I am misunderstanding what using a line segment actually does, but it definitely is not what I would expect.
Code example (es6):
import QuadTree from 'simple-quadtree'
let quadTree = QuadTree(0, 0, 100000, 100000)
// This should be the only collision
quadTree.put({x: 10, y: 10, w: 4, h: 4, obj: 'Yay'})
// Far away objects
quadTree.put({x: 200, y: 200, w: 4, h: 4, obj: 'Boo 1'})
quadTree.put({x: 300, y: 100, w: 4, h: 4, obj: 'Boo 2'})
// Here is where my confusion lies: all objects are returned instead of just the first one
let collisions = quadTree.get({x: 1, y: 11, dx: 1, dy: 0})
console.log('Quadtree Tests:')
console.log(collisions)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels