Retrieve returns all objects that could collide with the given bounding box and passing the given filter function.
(find AABB, filter func(aabb AABBer) bool)
| 338 | |
| 339 | // Retrieve returns all objects that could collide with the given bounding box and passing the given filter function. |
| 340 | func (qt *Quadtree) Retrieve(find AABB, filter func(aabb AABBer) bool) []AABBer { |
| 341 | var foundIntersections []AABBer |
| 342 | |
| 343 | potentials := qt.root.Retrieve(find) |
| 344 | for _, p := range potentials { |
| 345 | if aabbOverlaps(find, p.AABB()) && (filter == nil || filter(p)) { |
| 346 | foundIntersections = append(foundIntersections, p) |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | return foundIntersections |
| 351 | } |
| 352 | |
| 353 | //Clear removes all items from the quadtree |
| 354 | func (qt *Quadtree) Clear() { |
no test coverage detected