public class ConcurrentRegionQuadTree<T extends CollisionShape> extends ConcurrentPointQuadTree<T>
bottomLeft, bottomRight, ELEMENT_COLOR, elementLimitPerQuad, elements, lock, mergeWatermark, minimumQuadHeight, minimumQuadWidth, parent, QUAD_COLOR, topLeft, topRight, totalElementsCache, totalMerges| Constructor and Description |
|---|
ConcurrentRegionQuadTree(ConcurrentRegionQuadTree<T> parent,
float x,
float y,
float width,
float height)
Constructs a
ConcurrentRegionQuadTree as a child of another
ConcurrentRegionQuadTree |
ConcurrentRegionQuadTree(float minimumQuadWidth,
float minimumQuadHeight,
int elementLimitPerQuad,
int mergeWatermark,
float x,
float y,
float width,
float height)
Constructs a
ConcurrentRegionQuadTree with a specified minimum
quad size, element limit and watermark |
ConcurrentRegionQuadTree(int elementLimit,
float x,
float y,
float width,
float height)
Constructs a
ConcurrentRegionQuadTree with a specified element
limit and no merging watermark. |
ConcurrentRegionQuadTree(int elementLimit,
int mergeWatermark,
float x,
float y,
float width,
float height)
Constructs a
ConcurrentRegionQuadTree with a specified element
limit and watermark |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T element)
Adds an element to this
QuadTree |
void |
addAll(com.badlogic.gdx.utils.Array<T> elements)
Adds all element to this
QuadTree. |
protected boolean |
addElement(T element) |
protected boolean |
addElementToChild(T element) |
void |
debugRender(Graphics g) |
com.badlogic.gdx.utils.Array<T> |
getElements() |
void |
getElements(com.badlogic.gdx.utils.Array<T> result) |
void |
getElementsContainingPoint(com.badlogic.gdx.utils.Array<T> result,
Point point) |
com.badlogic.gdx.utils.Array<T> |
getElementsContainingPoint(Point point) |
void |
getElementsIntersectingLineSegment(com.badlogic.gdx.utils.Array<T> result,
LineSegment lineSegment) |
com.badlogic.gdx.utils.Array<T> |
getElementsIntersectingLineSegment(LineSegment lineSegment) |
void |
getElementsWithinArea(com.badlogic.gdx.utils.Array<T> result,
Shape area) |
com.badlogic.gdx.utils.Array<T> |
getElementsWithinArea(Shape area) |
int |
getTotalElements() |
void |
positionChanged(T moved) |
boolean |
remove(T element)
Removes an element from this
QuadTree |
void |
removeAll(com.badlogic.gdx.utils.Array<T> elementsToRemove)
Removes all elements in this
QuadTree and stores them in an Array |
protected boolean |
removeElement(T element,
boolean topDownInvocation) |
protected void |
subdivide() |
clear, clearTotalElementsCache, getElementLimitPerQuad, getMergeWatermark, getMinimumQuadHeight, getMinimumQuadWidth, getParent, getTotalMergeOperations, getTotalQuads, isMergable, merge, removeElementFromChildcontains, contains, contains, contains, contains, contains, copy, draw, edgeIterator, equals, fill, getCenterX, getCenterY, getDistanceTo, getDistanceTo, getHeight, getMaxX, getMaxY, getMinX, getMinY, getNumberOfSides, getPolygon, getRotation, getVertices, getWidth, getX, getY, hashCode, intersection, intersects, intersects, intersects, intersects, intersects, intersects, intersects, intersectsLineSegment, intersectsLineSegment, intersectsLineSegment, isCircle, lerp, rotate, rotateAround, scale, set, set, set, set, setCenter, setCenterX, setCenterY, setHeight, setRadius, setRotation, setRotationAround, setRotationAround, setSize, setSize, setWidth, setX, setY, toString, translateadd, intersects, subtractclone, finalize, getClass, notify, notifyAll, wait, wait, waitcontains, contains, getHeight, getMaxX, getMaxY, getRotation, getWidth, getX, getY, intersects, intersects, intersectsLineSegment, rotate, rotateAround, setRotation, setRotationAroundpublic ConcurrentRegionQuadTree(int elementLimit,
int mergeWatermark,
float x,
float y,
float width,
float height)
ConcurrentRegionQuadTree with a specified element
limit and watermarkelementLimit - The maximum number of elements in a
ConcurrentRegionQuadTree before it is split into 4
child quadsmergeWatermark - When a parent ConcurrentRegionQuadTree's total
elements go lower than this mark, the child
ConcurrentRegionQuadTrees will be merged back togetherx - The x coordinate of the ConcurrentRegionQuadTreey - The y coordiante of the ConcurrentRegionQuadTreewidth - The width of the ConcurrentRegionQuadTreeheight - The height of the ConcurrentRegionQuadTreepublic ConcurrentRegionQuadTree(int elementLimit,
float x,
float y,
float width,
float height)
ConcurrentRegionQuadTree with a specified element
limit and no merging watermark. As elements are removed, small sized
child ConcurrentRegionQuadTrees will not be merged back together.elementLimit - The maximum number of elements in a quad before it is split
into 4 child ConcurrentRegionQuadTreesx - The x coordinate of the ConcurrentRegionQuadTreey - The y coordiante of the ConcurrentRegionQuadTreewidth - The width of the ConcurrentRegionQuadTreeheight - The height of the ConcurrentRegionQuadTreepublic ConcurrentRegionQuadTree(ConcurrentRegionQuadTree<T> parent, float x, float y, float width, float height)
ConcurrentRegionQuadTree as a child of another
ConcurrentRegionQuadTreeparent - The parent ConcurrentRegionQuadTreex - The x coordinate of the ConcurrentRegionQuadTreey - The y coordiante of the ConcurrentRegionQuadTreewidth - The width of the ConcurrentRegionQuadTreeheight - The height of the ConcurrentRegionQuadTreepublic ConcurrentRegionQuadTree(float minimumQuadWidth,
float minimumQuadHeight,
int elementLimitPerQuad,
int mergeWatermark,
float x,
float y,
float width,
float height)
ConcurrentRegionQuadTree with a specified minimum
quad size, element limit and watermarkminimumQuadWidth - The minimum width of quads. Quads will not subdivide smaller
than this width.minimumQuadHeight - The minimum height of quads. Quads will not subdivide smaller
than this height.elementLimitPerQuad - The maximum number of elements in a quad before it is split
into 4 child ConcurrentRegionQuadTreesmergeWatermark - When a parent ConcurrentRegionQuadTree's total elements
go lower than this mark, the child
ConcurrentRegionQuadTrees will be merged back togetherx - The x coordinate of the ConcurrentRegionQuadTreey - The y coordiante of the ConcurrentRegionQuadTreewidth - The width of the ConcurrentRegionQuadTreeheight - The height of the ConcurrentRegionQuadTreepublic void debugRender(Graphics g)
debugRender in interface QuadTree<T extends CollisionShape>debugRender in class ConcurrentPointQuadTree<T extends CollisionShape>public void addAll(com.badlogic.gdx.utils.Array<T> elements)
QuadTreeQuadTree. Note that if an element exists outside of this QuadTree's bounds, it will not be addedaddAll in interface QuadTree<T extends CollisionShape>addAll in class ConcurrentPointQuadTree<T extends CollisionShape>elements - The elements to addpublic boolean add(T element)
QuadTreeQuadTreeadd in interface QuadTree<T extends CollisionShape>add in class ConcurrentPointQuadTree<T extends CollisionShape>element - The element to addprotected boolean addElement(T element)
addElement in class ConcurrentPointQuadTree<T extends CollisionShape>protected boolean addElementToChild(T element)
addElementToChild in class ConcurrentPointQuadTree<T extends CollisionShape>protected void subdivide()
subdivide in class ConcurrentPointQuadTree<T extends CollisionShape>public void removeAll(com.badlogic.gdx.utils.Array<T> elementsToRemove)
QuadTreeQuadTree and stores them in an ArrayremoveAll in interface QuadTree<T extends CollisionShape>removeAll in class ConcurrentPointQuadTree<T extends CollisionShape>elementsToRemove - After executing, this Array will contain all the removed elementspublic boolean remove(T element)
QuadTreeQuadTreeremove in interface QuadTree<T extends CollisionShape>remove in class ConcurrentPointQuadTree<T extends CollisionShape>element - The element to removeprotected boolean removeElement(T element, boolean topDownInvocation)
removeElement in class ConcurrentPointQuadTree<T extends CollisionShape>public com.badlogic.gdx.utils.Array<T> getElementsWithinArea(Shape area)
getElementsWithinArea in interface QuadTree<T extends CollisionShape>getElementsWithinArea in class ConcurrentPointQuadTree<T extends CollisionShape>public void getElementsWithinArea(com.badlogic.gdx.utils.Array<T> result, Shape area)
getElementsWithinArea in interface QuadTree<T extends CollisionShape>getElementsWithinArea in class ConcurrentPointQuadTree<T extends CollisionShape>public com.badlogic.gdx.utils.Array<T> getElementsContainingPoint(Point point)
getElementsContainingPoint in interface QuadTree<T extends CollisionShape>getElementsContainingPoint in class ConcurrentPointQuadTree<T extends CollisionShape>public void getElementsContainingPoint(com.badlogic.gdx.utils.Array<T> result, Point point)
getElementsContainingPoint in interface QuadTree<T extends CollisionShape>getElementsContainingPoint in class ConcurrentPointQuadTree<T extends CollisionShape>public com.badlogic.gdx.utils.Array<T> getElementsIntersectingLineSegment(LineSegment lineSegment)
getElementsIntersectingLineSegment in interface QuadTree<T extends CollisionShape>getElementsIntersectingLineSegment in class ConcurrentPointQuadTree<T extends CollisionShape>public void getElementsIntersectingLineSegment(com.badlogic.gdx.utils.Array<T> result, LineSegment lineSegment)
getElementsIntersectingLineSegment in interface QuadTree<T extends CollisionShape>getElementsIntersectingLineSegment in class ConcurrentPointQuadTree<T extends CollisionShape>public com.badlogic.gdx.utils.Array<T> getElements()
getElements in interface QuadTree<T extends CollisionShape>getElements in class ConcurrentPointQuadTree<T extends CollisionShape>public void getElements(com.badlogic.gdx.utils.Array<T> result)
getElements in interface QuadTree<T extends CollisionShape>getElements in class ConcurrentPointQuadTree<T extends CollisionShape>public int getTotalElements()
getTotalElements in interface QuadTree<T extends CollisionShape>getTotalElements in class ConcurrentPointQuadTree<T extends CollisionShape>public void positionChanged(T moved)
positionChanged in interface PositionChangeListener<T extends CollisionShape>positionChanged in class ConcurrentPointQuadTree<T extends CollisionShape>