Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. queryRange(rangeAABB) {
  2. var foundballs = [];
  3. if (!this.boundaryAABB.intersectsAABB(rangeAABB)) {
  4. return foundballs;
  5. }
  6. for (let c of this.balls) {
  7. if (rangeAABB.containsball(c)) {
  8. foundballs.push(c);
  9. }
  10. }
  11. if (this.nw == null) {
  12. return foundballs;
  13. }
  14. Array.prototype.push.apply(foundballs, this.nw.queryRange(rangeAABB));
  15. Array.prototype.push.apply(foundballs, this.ne.queryRange(rangeAABB));
  16. Array.prototype.push.apply(foundballs, this.sw.queryRange(rangeAABB));
  17. Array.prototype.push.apply(foundballs, this.se.queryRange(rangeAABB));
  18. return foundballs;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement