KrisLibrary  1.0.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Geometry::Octree Class Reference
Inheritance diagram for Geometry::Octree:
Geometry::OctreePointSet Geometry::OctreeScalarField

Public Member Functions

 Octree (const AABB3D &bb)
 Creates a single-node octree with the given bounding box.
 
int NumNodes () const
 Returns the number of nodes in the octree.
 
int Size () const
 Returns the number of nodes in the octree.
 
bool IsLeaf (const OctreeNode &n) const
 Tests whether a node is a leaf.
 
int Depth (const OctreeNode &n) const
 Returns the depth of the node in the tree (root is depth 0)
 
int Index (const OctreeNode &n) const
 Returns the index of the node.
 
const OctreeNodeNode (int index) const
 Returns the node for a given index.
 
OctreeNodeNode (int index)
 Returns the node for a given index.
 
int MaxDepth () const
 Returns the maximum depth of the tree.
 
void SplitToDepth (int d)
 splits the Octree uniformly to the given depth d
 
void SplitToDepth (OctreeNode &n, int d)
 
OctreeNodeSplitToDepth (OctreeNode &n, const Vector3 &point, int d)
 
void SplitToResolution (const Vector3 &res)
 splits the Octree uniformly to the given resolution res
 
void SplitToResolution (OctreeNode &n, const Vector3 &res)
 
OctreeNodeSplitToResolution (OctreeNode &n, const Vector3 &point, const Vector3 &res)
 
int Child (const OctreeNode &n, const Vector3 &pt) const
 Returns the child index in which pt is located (0-7, not the node index)
 
void Range (const OctreeNode &n, int child, AABB3D &bbchild) const
 Returns the bounding box of a hypothetical child of n.
 
OctreeNodeLookup (const Vector3 &point)
 Finds the leaf node containing point or NULL if no such node exists.
 
OctreeNodeLookup (OctreeNode &root, const Vector3 &point)
 Same as above, but given a root node for searching.
 
OctreeNodeLookup (OctreeNode &root, const Vector3 &point, int depthMax)
 
void BoxLookup (const Vector3 &bmin, const Vector3 &bmax, vector< int > &nodeIndices) const
 
void BoxLookup (const Box3D &b, vector< int > &nodeIndices) const
 Returns the indices of all leaf nodes overlapping the 3D box b.
 
void BallLookup (const Vector3 &c, Real r, vector< int > &nodeIndices) const
 
void RayLookup (const Ray3D &ray, vector< int > &nodeindices) const
 Returns the sorted list of leaf nodes that intersect the ray.
 
void FattenedRayLookup (const Ray3D &ray, Real radius, vector< int > &nodeindices) const
 
virtual void Split (int nodeindex)
 Splits the given node (once).
 
virtual void Join (int nodeindex)
 Joins the given node and all descendants.
 

Protected Member Functions

virtual int AddNode (int parent=-1)
 
virtual void DeleteNode (int)
 
void _RayLookup (int nodeindex, const Ray3D &ray, vector< int > &nodeindices) const
 
void _FattenedRayLookup (int nodeindex, const Ray3D &ray, Real radius, vector< int > &nodeindices) const
 

Protected Attributes

vector< OctreeNodenodes
 
list< int > freeNodes
 

Member Function Documentation

void Octree::BallLookup ( const Vector3 c,
Real  r,
vector< int > &  nodeIndices 
) const

Returns the indices of all leaf nodes overlapping the sphere of radius r centered at c

void Octree::BoxLookup ( const Vector3 bmin,
const Vector3 bmax,
vector< int > &  nodeIndices 
) const

Returns the indices of all leaf nodes overlapping the axis-aligned box [bmax,bmin]

void Octree::FattenedRayLookup ( const Ray3D ray,
Real  radius,
vector< int > &  nodeindices 
) const

Returns the sorted list of leaf nodes that intersect the ray fattened by the given radius

OctreeNode * Octree::Lookup ( OctreeNode root,
const Vector3 point,
int  depthMax 
)

Same as above, but given a root node for searching and a maximum recursion depth

void Octree::SplitToDepth ( OctreeNode n,
int  d 
)

Splits the given node to the given depth d. Note: n is invalidated after this call!

OctreeNode * Octree::SplitToDepth ( OctreeNode n,
const Vector3 point,
int  d 
)

Splits the octree until the point is contained within a cell of the given depth d. Returns the leaf node containing point. Note: n is invalidated after this call!

void Octree::SplitToResolution ( OctreeNode n,
const Vector3 res 
)

Splits the given node to the given resolution res. Note: n is invalidated after this call!

OctreeNode * Octree::SplitToResolution ( OctreeNode n,
const Vector3 point,
const Vector3 res 
)

Splits the octree until the point is contained within a cell of the given resolution res. Returns the leaf node containing point. Note: n is invalidated after this call!


The documentation for this class was generated from the following files: