Package arc.math.geom
Class QuadTree<T extends QuadTree.QuadTreeObject>
java.lang.Object
arc.math.geom.QuadTree<T>
- Type Parameters:
T
- The type of object this quad tree should contain. An object only requires some way of getting rough bounds.
A basic quad tree.
This class represents any node, but you will likely only interact with the root node.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Represents an object in a QuadTree. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
any
(float x, float y, float width, float height) void
clear()
Removes all objects.getFittingChild
(Rect boundingBox) void
getObjects
(Seq<T> out) Adds all quadtree objects to the specified Seq.protected void
void
Inserts an object into this node or its child nodes.void
Processes objects that may intersect the given rectangle.void
Fills the out parameter with any objects that may intersect the given rectangle.void
Processes objects that may intersect the given rectangle.void
Fills the out parameter with any objects that may intersect the given rectangle.boolean
Removes an object from this node or its child nodes.protected void
split()
protected void
unsplit()
-
Field Details
-
tmp
-
maxObjectsPerNode
protected static final int maxObjectsPerNode- See Also:
-
bounds
-
objects
-
botLeft
-
botRight
-
topLeft
-
topRight
-
leaf
public boolean leaf -
totalObjects
public int totalObjects
-
-
Constructor Details
-
QuadTree
-
-
Method Details
-
split
protected void split() -
unsplit
protected void unsplit() -
insert
Inserts an object into this node or its child nodes. This will split a leaf node if it exceeds the object limit. -
remove
Removes an object from this node or its child nodes. -
clear
public void clear()Removes all objects. -
getFittingChild
-
intersect
Processes objects that may intersect the given rectangle.This will never result in false positives.
-
any
public boolean any(float x, float y, float width, float height) - Returns:
- whether an object overlaps this rectangle. This will never result in false positives.
-
intersect
Processes objects that may intersect the given rectangle.This will never result in false positives.
-
intersect
Fills the out parameter with any objects that may intersect the given rectangle.This will result in false positives, but never a false negative.
-
intersect
Fills the out parameter with any objects that may intersect the given rectangle. -
getObjects
Adds all quadtree objects to the specified Seq. -
newChild
-
hitbox
-