public class ConcurrentRegionQuadTree<T extends Sizeable> extends ConcurrentPointQuadTree<T>
bottomLeft, bottomRight, ELEMENT_COLOR, elementLimitPerQuad, elements, lock, mergeWatermark, minimumQuadHeight, minimumQuadWidth, parent, QUAD_COLOR, topLeft, topRight, totalElementsCache, totalMerges
geometry, positionChangeListeners, sizeChangeListeners
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(org.mini2Dx.gdx.utils.Array<T> elements)
Adds all element to this
QuadTree . |
protected boolean |
addElement(T element) |
protected void |
addElementsContainingPoint(org.mini2Dx.gdx.utils.Array<T> result,
Point point) |
protected void |
addElementsIntersectingLineSegment(org.mini2Dx.gdx.utils.Array<T> result,
LineSegment lineSegment) |
protected void |
addElementsWithinArea(org.mini2Dx.gdx.utils.Array<T> result,
Shape area) |
protected boolean |
addElementToChild(T element) |
void |
debugRender(Graphics g) |
org.mini2Dx.gdx.utils.Array<T> |
getElements() |
void |
getElements(org.mini2Dx.gdx.utils.Array<T> result) |
void |
getElementsContainingPoint(org.mini2Dx.gdx.utils.Array<T> result,
Point point) |
void |
getElementsContainingPoint(org.mini2Dx.gdx.utils.Array<T> result,
Point point,
QuadTreeSearchDirection searchDirection) |
void |
getElementsIntersectingLineSegment(org.mini2Dx.gdx.utils.Array<T> result,
LineSegment lineSegment) |
void |
getElementsIntersectingLineSegment(org.mini2Dx.gdx.utils.Array<T> result,
LineSegment lineSegment,
QuadTreeSearchDirection searchDirection) |
void |
getElementsWithinArea(org.mini2Dx.gdx.utils.Array<T> result,
Shape area) |
void |
getElementsWithinArea(org.mini2Dx.gdx.utils.Array<T> result,
Shape area,
QuadTreeSearchDirection searchDirection) |
int |
getTotalElements() |
void |
positionChanged(T moved) |
boolean |
remove(T element)
Removes an element from this
QuadTree |
void |
removeAll(org.mini2Dx.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, getElementsContainingPoint, getElementsContainingPoint, getElementsIntersectingLineSegment, getElementsIntersectingLineSegment, getElementsWithinArea, getElementsWithinArea, getMergeWatermark, getMinimumQuadHeight, getMinimumQuadWidth, getParent, getTotalMergeOperations, getTotalQuads, intersects, isMergable, merge, removeElementFromChild
contains, contains, contains, contains, contains, copy, dispose, draw, edgeIterator, equals, fill, getCenterX, getCenterY, getDistanceTo, getHeight, getMaxX, getMaxY, getMinX, getMinY, getNumberOfSides, getPolygon, getRotation, getVertices, getWidth, getX, getY, hashCode, intersection, intersects, intersects, intersects, intersects, intersects, intersects, intersectsLineSegment, intersectsLineSegment, isCircle, lerp, rotate, rotateAround, scale, set, set, setCenter, setCenterX, setCenterY, setHeight, setRadius, setRotation, setRotationAround, setSize, setSize, setWidth, setX, setXY, setXY, setY, toString, translate
add, addPostionChangeListener, addSizeChangeListener, clearPositionChangeListeners, clearPositionListeners, clearPositionListeners, clearSizeChangeListeners, clearSizeListeners, clearSizeListeners, getDistanceTo, intersects, moveTowards, moveTowards, notifyPositionChangeListeners, notifyPositionListeners, notifyPositionListeners, notifySizeChangeListeners, notifySizeListeners, notifySizeListeners, removePositionChangeListener, removePositionListener, removePositionListener, removeSizeChangeListener, removeSizeListener, removeSizeListener, setRotationAround, subtract
public 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
ConcurrentRegionQuadTree
s will be merged back togetherx
- The x coordinate of the ConcurrentRegionQuadTree
y
- The y coordiante of the ConcurrentRegionQuadTree
width
- The width of the ConcurrentRegionQuadTree
height
- The height of the ConcurrentRegionQuadTree
public 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 ConcurrentRegionQuadTree
s will not be merged back together.elementLimit
- The maximum number of elements in a quad before it is split
into 4 child ConcurrentRegionQuadTree
sx
- The x coordinate of the ConcurrentRegionQuadTree
y
- The y coordiante of the ConcurrentRegionQuadTree
width
- The width of the ConcurrentRegionQuadTree
height
- The height of the ConcurrentRegionQuadTree
public ConcurrentRegionQuadTree(ConcurrentRegionQuadTree<T> parent, float x, float y, float width, float height)
ConcurrentRegionQuadTree
as a child of another
ConcurrentRegionQuadTree
parent
- The parent ConcurrentRegionQuadTree
x
- The x coordinate of the ConcurrentRegionQuadTree
y
- The y coordiante of the ConcurrentRegionQuadTree
width
- The width of the ConcurrentRegionQuadTree
height
- The height of the ConcurrentRegionQuadTree
public 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 ConcurrentRegionQuadTree
smergeWatermark
- When a parent ConcurrentRegionQuadTree
's total elements
go lower than this mark, the child
ConcurrentRegionQuadTree
s will be merged back togetherx
- The x coordinate of the ConcurrentRegionQuadTree
y
- The y coordiante of the ConcurrentRegionQuadTree
width
- The width of the ConcurrentRegionQuadTree
height
- The height of the ConcurrentRegionQuadTree
public void debugRender(Graphics g)
debugRender
in interface QuadTree<T extends Sizeable>
debugRender
in class ConcurrentPointQuadTree<T extends Sizeable>
public void addAll(org.mini2Dx.gdx.utils.Array<T> elements)
QuadTree
QuadTree
. Note that if an element exists outside of this QuadTree's bounds, it will not be addedpublic boolean add(T element)
QuadTree
QuadTree
protected boolean addElement(T element)
addElement
in class ConcurrentPointQuadTree<T extends Sizeable>
protected boolean addElementToChild(T element)
addElementToChild
in class ConcurrentPointQuadTree<T extends Sizeable>
protected void subdivide()
subdivide
in class ConcurrentPointQuadTree<T extends Sizeable>
public void removeAll(org.mini2Dx.gdx.utils.Array<T> elementsToRemove)
QuadTree
QuadTree
and stores them in an Array
public boolean remove(T element)
QuadTree
QuadTree
protected boolean removeElement(T element, boolean topDownInvocation)
removeElement
in class ConcurrentPointQuadTree<T extends Sizeable>
protected void addElementsWithinArea(org.mini2Dx.gdx.utils.Array<T> result, Shape area)
addElementsWithinArea
in class ConcurrentPointQuadTree<T extends Sizeable>
public void getElementsWithinArea(org.mini2Dx.gdx.utils.Array<T> result, Shape area)
getElementsWithinArea
in interface QuadTree<T extends Sizeable>
getElementsWithinArea
in class ConcurrentPointQuadTree<T extends Sizeable>
public void getElementsWithinArea(org.mini2Dx.gdx.utils.Array<T> result, Shape area, QuadTreeSearchDirection searchDirection)
getElementsWithinArea
in interface QuadTree<T extends Sizeable>
getElementsWithinArea
in class ConcurrentPointQuadTree<T extends Sizeable>
protected void addElementsContainingPoint(org.mini2Dx.gdx.utils.Array<T> result, Point point)
addElementsContainingPoint
in class ConcurrentPointQuadTree<T extends Sizeable>
public void getElementsContainingPoint(org.mini2Dx.gdx.utils.Array<T> result, Point point)
getElementsContainingPoint
in interface QuadTree<T extends Sizeable>
getElementsContainingPoint
in class ConcurrentPointQuadTree<T extends Sizeable>
public void getElementsContainingPoint(org.mini2Dx.gdx.utils.Array<T> result, Point point, QuadTreeSearchDirection searchDirection)
getElementsContainingPoint
in interface QuadTree<T extends Sizeable>
getElementsContainingPoint
in class ConcurrentPointQuadTree<T extends Sizeable>
protected void addElementsIntersectingLineSegment(org.mini2Dx.gdx.utils.Array<T> result, LineSegment lineSegment)
addElementsIntersectingLineSegment
in class ConcurrentPointQuadTree<T extends Sizeable>
public void getElementsIntersectingLineSegment(org.mini2Dx.gdx.utils.Array<T> result, LineSegment lineSegment)
getElementsIntersectingLineSegment
in interface QuadTree<T extends Sizeable>
getElementsIntersectingLineSegment
in class ConcurrentPointQuadTree<T extends Sizeable>
public void getElementsIntersectingLineSegment(org.mini2Dx.gdx.utils.Array<T> result, LineSegment lineSegment, QuadTreeSearchDirection searchDirection)
getElementsIntersectingLineSegment
in interface QuadTree<T extends Sizeable>
getElementsIntersectingLineSegment
in class ConcurrentPointQuadTree<T extends Sizeable>
public org.mini2Dx.gdx.utils.Array<T> getElements()
getElements
in interface QuadTree<T extends Sizeable>
getElements
in class ConcurrentPointQuadTree<T extends Sizeable>
public void getElements(org.mini2Dx.gdx.utils.Array<T> result)
getElements
in interface QuadTree<T extends Sizeable>
getElements
in class ConcurrentPointQuadTree<T extends Sizeable>
public int getTotalElements()
getTotalElements
in interface QuadTree<T extends Sizeable>
getTotalElements
in class ConcurrentPointQuadTree<T extends Sizeable>
public void positionChanged(T moved)
positionChanged
in interface PositionChangeListener<T extends Sizeable>
positionChanged
in class ConcurrentPointQuadTree<T extends Sizeable>