@Test public void testGetElementsContainingPoint() { rootQuad.add(box1); rootQuad.add(box2); rootQuad.add(box3); rootQuad.add(box4); Array<CollisionBox> collisionBoxs = rootQuad.getElementsContainingPoint(new Point(16, 16)); Assert.assertEquals(1, collisionBoxs.size); Assert.assertEquals(true, collisionBoxs.contains(box1, false)); collisionBoxs = rootQuad.getElementsContainingPoint(new Point(112, 16)); Assert.assertEquals(1, collisionBoxs.size); Assert.assertEquals(true, collisionBoxs.contains(box2, false)); collisionBoxs = rootQuad.getElementsContainingPoint(new Point(16, 112)); Assert.assertEquals(1, collisionBoxs.size); Assert.assertEquals(true, collisionBoxs.contains(box3, false)); collisionBoxs = rootQuad.getElementsContainingPoint(new Point(112, 112)); Assert.assertEquals(1, collisionBoxs.size); Assert.assertEquals(true, collisionBoxs.contains(box4, false)); }
@Override public void getElementsContainingPoint(Array<T> result, Point point) { lock.lockRead(); if (topLeft != null) { if (topLeft.contains(point)) { topLeft.getElementsContainingPoint(result, point); } if (topRight.contains(point)) { topRight.getElementsContainingPoint(result, point); } if (bottomLeft.contains(point)) { bottomLeft.getElementsContainingPoint(result, point); } if (bottomRight.contains(point)) { bottomRight.getElementsContainingPoint(result, point); } } addElementsContainingPoint(result, point); lock.unlockRead(); }
ConcurrentRegionQuadTree extends ConcurrentPointQuadTree<T> { @Override public void getElementsContainingPoint(Array<T> result, Point point) { lock.lockRead(); if (topLeft != null) { if (topLeft.contains(point)) { topLeft.getElementsContainingPoint(result, point); } if (topRight.contains(point)) { topRight.getElementsContainingPoint(result, point); } if (bottomLeft.contains(point)) { bottomLeft.getElementsContainingPoint(result, point); } if (bottomRight.contains(point)) { bottomRight.getElementsContainingPoint(result, point); } } addElementsContainingPoint(result, point); lock.unlockRead(); } }
ConcurrentRegionQuadTree extends ConcurrentPointQuadTree<T> { @Override public void getElementsContainingPoint(Array<T> result, Point point) { lock.lockRead(); if (topLeft != null) { if (topLeft.contains(point)) { topLeft.getElementsContainingPoint(result, point); } if (topRight.contains(point)) { topRight.getElementsContainingPoint(result, point); } if (bottomLeft.contains(point)) { bottomLeft.getElementsContainingPoint(result, point); } if (bottomRight.contains(point)) { bottomRight.getElementsContainingPoint(result, point); } } addElementsContainingPoint(result, point); lock.unlockRead(); } ConcurrentRegionQuadTree(int elementLimit, int mergeWatermark, float x, float y, float width, float height);  ConcurrentRegionQuadTree(int elementLimit, float x, float y, float width, float height);  ConcurrentRegionQuadTree(ConcurrentRegionQuadTree<T> parent, float x, float y, float width, float height);  ConcurrentRegionQuadTree(float minimumQuadWidth, float minimumQuadHeight, int elementLimitPerQuad,
			int mergeWatermark, float x, float y, float width, float height); }
ConcurrentRegionQuadTree extends ConcurrentPointQuadTree<T> { @Override public void getElementsContainingPoint(Array<T> result, Point point) { lock.lockRead(); if (topLeft != null) { if (topLeft.contains(point)) { topLeft.getElementsContainingPoint(result, point); } if (topRight.contains(point)) { topRight.getElementsContainingPoint(result, point); } if (bottomLeft.contains(point)) { bottomLeft.getElementsContainingPoint(result, point); } if (bottomRight.contains(point)) { bottomRight.getElementsContainingPoint(result, point); } } addElementsContainingPoint(result, point); lock.unlockRead(); } ConcurrentRegionQuadTree(int elementLimit, int mergeWatermark, float x, float y, float width, float height);  ConcurrentRegionQuadTree(int elementLimit, float x, float y, float width, float height);  ConcurrentRegionQuadTree(ConcurrentRegionQuadTree<T> parent, float x, float y, float width, float height);  ConcurrentRegionQuadTree(float minimumQuadWidth, float minimumQuadHeight, int elementLimitPerQuad,
			int mergeWatermark, float x, float y, float width, float height); @Override void debugRender(Graphics g); @Override void addAll(Array<T> elements); @Override boolean add(T element); @Override void removeAll(Array<T> elementsToRemove); @Override boolean remove(T element); @Override void getElementsWithinArea(Array<T> result, Shape area); @Override void getElementsWithinArea(Array<T> result, Shape area, QuadTreeSearchDirection searchDirection); @Override Array<T> getElementsContainingArea(Shape area, boolean entirelyContained); @Override Array<T> getElementsContainingArea(Shape area, QuadTreeSearchDirection searchDirection, boolean entirelyContained); @Override void getElementsContainingArea(Array<T> result, Shape area, boolean entirelyContained); @Override void getElementsContainingArea(Array<T> result, Shape area, QuadTreeSearchDirection searchDirection, boolean entirelyContained); @Override void getElementsContainingPoint(Array<T> result, Point point); @Override void getElementsContainingPoint(Array<T> result, Point point, QuadTreeSearchDirection searchDirection); @Override void getElementsIntersectingLineSegment(Array<T> result, LineSegment lineSegment); @Override void getElementsIntersectingLineSegment(Array<T> result, LineSegment lineSegment, QuadTreeSearchDirection searchDirection); @Override Array<T> getElements(); @Override void getElements(Array<T> result); @Override int getTotalElements(); @Override void positionChanged(T moved); }
ConcurrentRegionQuadTree extends ConcurrentPointQuadTree<T> { @Override public void getElementsContainingPoint(Array<T> result, Point point) { lock.lockRead(); if (topLeft != null) { if (topLeft.contains(point)) { topLeft.getElementsContainingPoint(result, point); } if (topRight.contains(point)) { topRight.getElementsContainingPoint(result, point); } if (bottomLeft.contains(point)) { bottomLeft.getElementsContainingPoint(result, point); } if (bottomRight.contains(point)) { bottomRight.getElementsContainingPoint(result, point); } } addElementsContainingPoint(result, point); lock.unlockRead(); } ConcurrentRegionQuadTree(int elementLimit, int mergeWatermark, float x, float y, float width, float height);  ConcurrentRegionQuadTree(int elementLimit, float x, float y, float width, float height);  ConcurrentRegionQuadTree(ConcurrentRegionQuadTree<T> parent, float x, float y, float width, float height);  ConcurrentRegionQuadTree(float minimumQuadWidth, float minimumQuadHeight, int elementLimitPerQuad,
			int mergeWatermark, float x, float y, float width, float height); @Override void debugRender(Graphics g); @Override void addAll(Array<T> elements); @Override boolean add(T element); @Override void removeAll(Array<T> elementsToRemove); @Override boolean remove(T element); @Override void getElementsWithinArea(Array<T> result, Shape area); @Override void getElementsWithinArea(Array<T> result, Shape area, QuadTreeSearchDirection searchDirection); @Override Array<T> getElementsContainingArea(Shape area, boolean entirelyContained); @Override Array<T> getElementsContainingArea(Shape area, QuadTreeSearchDirection searchDirection, boolean entirelyContained); @Override void getElementsContainingArea(Array<T> result, Shape area, boolean entirelyContained); @Override void getElementsContainingArea(Array<T> result, Shape area, QuadTreeSearchDirection searchDirection, boolean entirelyContained); @Override void getElementsContainingPoint(Array<T> result, Point point); @Override void getElementsContainingPoint(Array<T> result, Point point, QuadTreeSearchDirection searchDirection); @Override void getElementsIntersectingLineSegment(Array<T> result, LineSegment lineSegment); @Override void getElementsIntersectingLineSegment(Array<T> result, LineSegment lineSegment, QuadTreeSearchDirection searchDirection); @Override Array<T> getElements(); @Override void getElements(Array<T> result); @Override int getTotalElements(); @Override void positionChanged(T moved);  }