Package toxi.geom
Class PointQuadtree
java.lang.Object
toxi.geom.Rect
toxi.geom.PointQuadtree
- All Implemented Interfaces:
Shape2D
,SpatialIndex<Vec2D>
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.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPointQuadtree
(float x, float y, float w, float h) PointQuadtree
(PointQuadtree parent, float x, float y, float w, float h) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
boolean
itemsWithinRadius
(Vec2D p, float radius, List<Vec2D> results) itemsWithinRect
(Rect bounds, List<Vec2D> results) void
prewalk
(QuadtreeVisitor visitor) boolean
int
size()
boolean
Methods inherited from class toxi.geom.Rect
containsPoint, copy, equals, fromCenterExtent, getArea, getAspect, getBottom, getBottomLeft, getBottomRight, getBoundingCircle, getBoundingRect, getBounds, getCentroid, getCircumference, getDimensions, getEdge, getEdges, getLeft, getMappedPointInRect, getRandomPoint, getRight, getTop, getTopLeft, getTopRight, getUnmappedPointInRect, growToContainPoint, hashCode, intersectionRectWith, intersectsCircle, intersectsRay, intersectsRect, scale, set, set, setDimension, setPosition, toPolygon2D, toPolygon2D, toString, translate, translate, union, unionRectWith
-
Constructor Details
-
PointQuadtree
public PointQuadtree(float x, float y, float w, float h) -
PointQuadtree
-
PointQuadtree
-
-
Method Details
-
clear
public void clear()- Specified by:
clear
in interfaceSpatialIndex<Vec2D>
-
findNode
-
index
- Specified by:
index
in interfaceSpatialIndex<Vec2D>
-
isIndexed
- Specified by:
isIndexed
in interfaceSpatialIndex<Vec2D>
-
itemsWithinRadius
- Specified by:
itemsWithinRadius
in interfaceSpatialIndex<Vec2D>
-
itemsWithinRect
-
prewalk
-
reindex
- Specified by:
reindex
in interfaceSpatialIndex<Vec2D>
-
size
public int size()- Specified by:
size
in interfaceSpatialIndex<Vec2D>
-
unindex
- Specified by:
unindex
in interfaceSpatialIndex<Vec2D>
-