public class PointQuadTree<T extends Positionable> extends Rectangle implements QuadTree<T>
| Modifier and Type | Field and Description | 
|---|---|
| protected PointQuadTree<T> | bottomLeft | 
| protected PointQuadTree<T> | bottomRight | 
| static float | DEFAULT_MINIMUM_QUAD_SIZE | 
| static com.badlogic.gdx.graphics.Color | ELEMENT_COLOR | 
| protected int | elementLimitPerQuad | 
| protected com.badlogic.gdx.utils.Array<T> | elements | 
| protected int | mergeWatermark | 
| protected float | minimumQuadHeight | 
| protected float | minimumQuadWidth | 
| protected PointQuadTree<T> | parent | 
| static com.badlogic.gdx.graphics.Color | QUAD_COLOR | 
| protected PointQuadTree<T> | topLeft | 
| protected PointQuadTree<T> | topRight | 
| protected int | totalElementsCache | 
| Constructor and Description | 
|---|
| PointQuadTree(float minimumQuadWidth,
             float minimumQuadHeight,
             int elementLimitPerQuad,
             int mergeWatermark,
             float x,
             float y,
             float width,
             float height)Constructs a  PointQuadTreewith a specified minimum quad size,
 element limit and watermark | 
| PointQuadTree(int elementLimitPerQuad,
             float x,
             float y,
             float width,
             float height)Constructs a  PointQuadTreewith a specified element limit and no
 merging watermark. | 
| PointQuadTree(int elementLimitPerQuad,
             int mergeWatermark,
             float x,
             float y,
             float width,
             float height)Constructs a  PointQuadTreewith a specified element limit and
 watermark | 
| PointQuadTree(PointQuadTree<T> parent,
             float x,
             float y,
             float width,
             float height)Constructs a  PointQuadTreeas a child of anotherPointQuadTree | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | add(T element)Adds an element to this  QuadTree | 
| void | addAll(com.badlogic.gdx.utils.Array<T> elementsToAdd)Adds all element to this  QuadTree. | 
| protected boolean | addElement(T element) | 
| protected boolean | addElementToChild(T element) | 
| void | clear()Same a  QuadTree.removeAll(Array)except the results are not stored | 
| protected void | clearTotalElementsCache() | 
| void | debugRender(Graphics g) | 
| int | getElementLimitPerQuad() | 
| 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 | getMergeWatermark() | 
| float | getMinimumQuadHeight() | 
| float | getMinimumQuadWidth() | 
| QuadTree<T> | getParent() | 
| int | getTotalElements() | 
| int | getTotalQuads() | 
| boolean | hasChildQuads() | 
| protected boolean | isMergable() | 
| protected void | merge() | 
| 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  QuadTreeand stores them in anArray | 
| protected boolean | removeElement(T element) | 
| protected boolean | removeElementFromChild(T element) | 
| protected void | subdivide() | 
contains, 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 static final float DEFAULT_MINIMUM_QUAD_SIZE
public static com.badlogic.gdx.graphics.Color QUAD_COLOR
public static com.badlogic.gdx.graphics.Color ELEMENT_COLOR
protected PointQuadTree<T extends Positionable> parent
protected PointQuadTree<T extends Positionable> topLeft
protected PointQuadTree<T extends Positionable> topRight
protected PointQuadTree<T extends Positionable> bottomLeft
protected PointQuadTree<T extends Positionable> bottomRight
protected com.badlogic.gdx.utils.Array<T extends Positionable> elements
protected final int elementLimitPerQuad
protected final int mergeWatermark
protected final float minimumQuadWidth
protected final float minimumQuadHeight
protected int totalElementsCache
public PointQuadTree(int elementLimitPerQuad,
                     int mergeWatermark,
                     float x,
                     float y,
                     float width,
                     float height)
PointQuadTree with a specified element limit and
 watermarkelementLimitPerQuad - The maximum number of elements in a quad before it is split
            into 4 child PointQuadTreesmergeWatermark - When a parent PointQuadTree's total elements go lower
            than this mark, the child PointQuadTrees will be
            merged back togetherx - The x coordinate of the PointQuadTreey - The y coordiante of the PointQuadTreewidth - The width of the PointQuadTreeheight - The height of the PointQuadTreepublic PointQuadTree(int elementLimitPerQuad,
                     float x,
                     float y,
                     float width,
                     float height)
PointQuadTree with a specified element limit and no
 merging watermark. As elements are removed, small sized child
 PointQuadTrees will not be merged back together.elementLimitPerQuad - The maximum number of elements in a quad before it is split
            into 4 child PointQuadTreesx - The x coordinate of the PointQuadTreey - The y coordiante of the PointQuadTreewidth - The width of the PointQuadTreeheight - The height of the PointQuadTreepublic PointQuadTree(PointQuadTree<T> parent, float x, float y, float width, float height)
PointQuadTree as a child of another
 PointQuadTreeparent - The parent PointQuadTreex - The x coordinate of the PointQuadTreey - The y coordiante of the PointQuadTreewidth - The width of the PointQuadTreeheight - The height of the PointQuadTreepublic PointQuadTree(float minimumQuadWidth,
                     float minimumQuadHeight,
                     int elementLimitPerQuad,
                     int mergeWatermark,
                     float x,
                     float y,
                     float width,
                     float height)
PointQuadTree 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 PointQuadTreesmergeWatermark - When a parent PointQuadTree's total elements go lower
            than this mark, the child PointQuadTrees will be
            merged back togetherx - The x coordinate of the PointQuadTreey - The y coordiante of the PointQuadTreewidth - The width of the PointQuadTreeheight - The height of the PointQuadTreepublic void debugRender(Graphics g)
debugRender in interface QuadTree<T extends Positionable>public void addAll(com.badlogic.gdx.utils.Array<T> elementsToAdd)
QuadTreeQuadTree. Note that if an element exists outside of this QuadTree's bounds, it will not be addedaddAll in interface QuadTree<T extends Positionable>elementsToAdd - The elements to addpublic boolean add(T element)
QuadTreeQuadTreeadd in interface QuadTree<T extends Positionable>element - The element to addprotected boolean addElement(T element)
protected boolean addElementToChild(T element)
protected void subdivide()
protected boolean isMergable()
protected void merge()
public void removeAll(com.badlogic.gdx.utils.Array<T> elementsToRemove)
QuadTreeQuadTree and stores them in an ArrayremoveAll in interface QuadTree<T extends Positionable>elementsToRemove - After executing, this Array will contain all the removed elementspublic boolean remove(T element)
QuadTreeQuadTreeremove in interface QuadTree<T extends Positionable>element - The element to removepublic void clear()
QuadTreeQuadTree.removeAll(Array) except the results are not storedclear in interface QuadTree<T extends Positionable>protected boolean removeElementFromChild(T element)
protected boolean removeElement(T element)
public com.badlogic.gdx.utils.Array<T> getElementsWithinArea(Shape area)
getElementsWithinArea in interface QuadTree<T extends Positionable>public void getElementsWithinArea(com.badlogic.gdx.utils.Array<T> result, Shape area)
getElementsWithinArea in interface QuadTree<T extends Positionable>public com.badlogic.gdx.utils.Array<T> getElementsContainingPoint(Point point)
getElementsContainingPoint in interface QuadTree<T extends Positionable>public void getElementsContainingPoint(com.badlogic.gdx.utils.Array<T> result, Point point)
getElementsContainingPoint in interface QuadTree<T extends Positionable>public com.badlogic.gdx.utils.Array<T> getElementsIntersectingLineSegment(LineSegment lineSegment)
getElementsIntersectingLineSegment in interface QuadTree<T extends Positionable>public void getElementsIntersectingLineSegment(com.badlogic.gdx.utils.Array<T> result, LineSegment lineSegment)
getElementsIntersectingLineSegment in interface QuadTree<T extends Positionable>public com.badlogic.gdx.utils.Array<T> getElements()
getElements in interface QuadTree<T extends Positionable>public void getElements(com.badlogic.gdx.utils.Array<T> result)
getElements in interface QuadTree<T extends Positionable>public int getTotalQuads()
getTotalQuads in interface QuadTree<T extends Positionable>public int getTotalElements()
getTotalElements in interface QuadTree<T extends Positionable>protected void clearTotalElementsCache()
public void positionChanged(T moved)
positionChanged in interface PositionChangeListener<T extends Positionable>public QuadTree<T> getParent()
getParent in interface QuadTree<T extends Positionable>public int getElementLimitPerQuad()
public int getMergeWatermark()
public boolean hasChildQuads()
public float getMinimumQuadWidth()
getMinimumQuadWidth in interface QuadTree<T extends Positionable>public float getMinimumQuadHeight()
getMinimumQuadHeight in interface QuadTree<T extends Positionable>