|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.geom.Vec3D
toxi.geom.AABB
toxi.geom.PointOctree
public class PointOctree
Implements a spatial subdivision tree to work efficiently with large numbers of 3D particles. This octree can only be used for particle type objects and does NOT support 3D mesh geometry as other forms of Octrees do. For further reference also see the OctreeDemo in the /examples folder.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class toxi.geom.Vec3D |
---|
Vec3D.Axis |
Field Summary |
---|
Fields inherited from class toxi.geom.Vec3D |
---|
MAX_VALUE, MIN_VALUE, x, X_AXIS, y, Y_AXIS, z, Z_AXIS, ZERO |
Constructor Summary | |
---|---|
PointOctree(Vec3D o,
float size)
Constructs a new PointOctree node within the AABB cube volume: {o.x, o.y, o.z} ... |
Method Summary | |
---|---|
boolean |
addAll(java.util.Collection<Vec3D> points)
Adds all points of the collection to the octree. |
boolean |
addPoint(Vec3D p)
Adds a new point/particle to the tree structure. |
boolean |
containsPoint(ReadonlyVec3D p)
Checks if the point is within the given shape/volume. |
void |
empty()
|
PointOctree[] |
getChildren()
|
int |
getDepth()
|
PointOctree |
getLeafForPoint(ReadonlyVec3D 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()
|
ReadonlyVec3D |
getOffset()
|
PointOctree |
getParent()
|
java.util.List<Vec3D> |
getPoints()
|
java.util.ArrayList<Vec3D> |
getPointsWithinBox(AABB b)
Selects all stored points within the given axis-aligned bounding box. |
java.util.ArrayList<Vec3D> |
getPointsWithinSphere(Sphere s)
Selects all stored points within the given sphere volume |
java.util.ArrayList<Vec3D> |
getPointsWithinSphere(Vec3D sphereOrigin,
float clipRadius)
Selects all stored points within the given sphere volume |
float |
getSize()
|
boolean |
remove(ReadonlyVec3D p)
Removes a point from the tree and (optionally) tries to release memory by reducing now empty sub-branches. |
void |
removeAll(java.util.Collection<Vec3D> 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.AABB |
---|
copy, fromMinMax, getExtent, getMax, getMin, getNormalForPoint, includePoint, intersectsBox, intersectsRay, intersectsSphere, intersectsSphere, intersectsTriangle, set, set, set, setExtent, toMesh, toMesh, updateBounds |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PointOctree(Vec3D o, float size)
o
- tree originsize
- size of the tree volume along a single axisMethod Detail |
---|
public boolean addAll(java.util.Collection<Vec3D> points)
points
- point collection
public boolean addPoint(Vec3D p)
p
-
public boolean containsPoint(ReadonlyVec3D p)
Shape3D
containsPoint
in interface Shape3D
containsPoint
in class AABB
public void empty()
public PointOctree[] getChildren()
public int getDepth()
public PointOctree getLeafForPoint(ReadonlyVec3D p)
p
- point to check
public float getMinNodeSize()
public float getNodeSize()
public int getNumChildren()
public ReadonlyVec3D getOffset()
public PointOctree getParent()
public java.util.List<Vec3D> getPoints()
public java.util.ArrayList<Vec3D> getPointsWithinBox(AABB b)
b
- AABB
public java.util.ArrayList<Vec3D> getPointsWithinSphere(Sphere s)
s
- sphere
public java.util.ArrayList<Vec3D> getPointsWithinSphere(Vec3D sphereOrigin, float clipRadius)
sphereOrigin
- clipRadius
-
public float getSize()
public boolean remove(ReadonlyVec3D p)
p
- point to delete
public void removeAll(java.util.Collection<Vec3D> points)
public void setMinNodeSize(float minNodeSize)
minNodeSize
- public void setTreeAutoReduction(boolean state)
state
- true, to enable featurepublic java.lang.String toString()
toString
in class AABB
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |