|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.geom.Rect
toxi.geom.PointQuadtree
public class PointQuadtree
Implements a spatial subdivision tree to work efficiently with large numbers of 2D particles. This quadtree can only be used for particle type objects and does NOT support 2D mesh geometry as other forms of quadtree might do. For further reference also see the QuadtreeDemo in the /examples folder.
Field Summary |
---|
Fields inherited from class toxi.geom.Rect |
---|
height, width, x, y |
Constructor Summary | |
---|---|
PointQuadtree(Vec2D o,
float size)
Constructs a new PointQuadtree node within the Rect: {o.x, o.y} ... |
Method Summary | |
---|---|
boolean |
addAll(java.util.Collection<Vec2D> points)
Adds all points of the collection to the quadtree. |
boolean |
addPoint(Vec2D p)
Adds a new point/particle to the tree structure. |
boolean |
containsPoint(ReadonlyVec2D p)
Checks if the given point is within the rectangle's bounds. |
void |
empty()
|
PointQuadtree[] |
getChildren()
|
int |
getDepth()
|
PointQuadtree |
getLeafForPoint(ReadonlyVec2D p)
Finds the leaf node which spatially relates to the given point |
float |
getMinNodeSize()
Returns the minimum size of nodes (in world units). |
float |
getNodeSize()
|
int |
getNumChildren()
|
ReadonlyVec2D |
getOffset()
|
PointQuadtree |
getParent()
|
java.util.List<Vec2D> |
getPoints()
|
java.util.ArrayList<Vec2D> |
getPointsWithinRect(Rect r)
Selects all stored points within the given axis-aligned bounding box. |
float |
getSize()
|
boolean |
remove(ReadonlyVec2D p)
Removes a point from the tree and (optionally) tries to release memory by reducing now empty sub-branches. |
void |
removeAll(java.util.Collection<Vec2D> points)
|
void |
setMinNodeSize(float minNodeSize)
|
void |
setTreeAutoReduction(boolean state)
Enables/disables auto reduction of branches after points have been deleted from the tree. |
java.lang.String |
toString()
|
Methods inherited from class toxi.geom.Rect |
---|
copy, fromCenterExtent, getArea, getAspect, getBottom, getBottomRight, getCentroid, getCircumference, getDimensions, getEdge, getLeft, getRight, getTop, getTopLeft, intersectsRay, intersectsRect, scale, set, set, setDimension, setPosition, toPolygon2D, union |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface toxi.geom.Shape2D |
---|
getArea, getCircumference |
Constructor Detail |
---|
public PointQuadtree(Vec2D o, float size)
o
- tree originsize
- size of the tree along a single axisMethod Detail |
---|
public boolean addAll(java.util.Collection<Vec2D> points)
points
- point collection
public boolean addPoint(Vec2D p)
p
-
public boolean containsPoint(ReadonlyVec2D p)
Rect
containsPoint
in interface Shape2D
containsPoint
in class Rect
p
- point to check
public void empty()
public PointQuadtree[] getChildren()
public int getDepth()
public PointQuadtree getLeafForPoint(ReadonlyVec2D p)
p
- point to check
public float getMinNodeSize()
public float getNodeSize()
public int getNumChildren()
public ReadonlyVec2D getOffset()
public PointQuadtree getParent()
public java.util.List<Vec2D> getPoints()
public java.util.ArrayList<Vec2D> getPointsWithinRect(Rect r)
r
- clipping rect
public float getSize()
public boolean remove(ReadonlyVec2D p)
p
- point to delete
public void removeAll(java.util.Collection<Vec2D> points)
public void setMinNodeSize(float minNodeSize)
minNodeSize
- public void setTreeAutoReduction(boolean state)
state
- true, to enable featurepublic java.lang.String toString()
toString
in class Rect
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |