Testing new quadtree

This commit is contained in:
Anuken
2020-02-10 11:29:58 -05:00
parent 81990cf16c
commit 86d5842868
3 changed files with 352 additions and 5 deletions
+2 -4
View File
@@ -101,19 +101,17 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
}
}
@SuppressWarnings("unchecked")
public void intersect(float x, float y, float width, float height, Cons<? super T> out){
//don't waste time for empty groups
if(isEmpty()) return;
tree().getIntersect(out, x, y, width, height);
tree.getIntersect(out, x, y, width, height);
}
@SuppressWarnings("unchecked")
public Array<T> intersect(float x, float y, float width, float height){
intersectArray.clear();
//don't waste time for empty groups
if(isEmpty()) return intersectArray;
tree().getIntersect(intersectArray, intersectRect.set(x, y, width, height));
tree.getIntersect(intersectArray, intersectRect.set(x, y, width, height));
return intersectArray;
}