Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray3D::cOctree Class Reference

#include <cOctree.h>

Inheritance diagram for Gray3D::cOctree:
Gray3D::cOctreeNodeCont ISpatialTest

Public Member Functions

 cOctree ()
 
virtual ~cOctree ()
 
void AddToOctree (cOctreeObject *pObj, const cVector3f &vPos, float fRadius)
 
int TestTree () const
 validates tree structure More...
 
- Public Member Functions inherited from Gray3D::cOctreeNodeCont
 cOctreeNodeCont () noexcept
 
virtual ~cOctreeNodeCont ()
 
void FreeChildNode (CHILDIDX_t ci)
 
void FreeChildNodes ()
 
 UNITTEST_FRIEND (cOctree)
 run an heavy usage simulation to test More...
 

Static Public Member Functions

static CHILDIDX_t MakeRootIdx (const cVec3i &vPi) noexcept
 

Friends

class cOctreeNode
 

Additional Inherited Members

- Public Types inherited from Gray3D::cOctreeNodeCont
typedef int CHILDIDX_t
 0 to 7 k_NodeMax More...
 
- Static Public Attributes inherited from Gray3D::cOctreeNodeCont
static const CHILDIDX_t k_NodeMax = 8
 2x2x2 = 8 More...
 
- Protected Member Functions inherited from Gray3D::cOctreeNodeCont
bool TraverseIntersectHex (ISpatialTestVisitor *pResults, const cHexahedron &frustum, cHexahedron::PLANES_MASK_t planes)
 
virtual bool TraverseIntersectSphere (ISpatialTestVisitor *pResults, const cSpheref &sphere) const override
 
virtual bool TraverseIntersectBounds (ISpatialTestVisitor *pResults, const cBounds3f &bbox) const override
 
virtual bool TraverseIntersectHex (ISpatialTestVisitor *pResults, const cHexahedron &frustum) override
 
virtual bool TraverseIntersectSegment (ISpatialTestVisitor *pResults, const cSegment3f &segment) override
 
virtual bool TraverseAll (ISpatialTestVisitor *pResults) const override
 
- Protected Attributes inherited from Gray3D::cOctreeNodeCont
cOctreeNodem_aChildNodes [k_NodeMax]
 container for sparse 2x2x2 possible subdivided children. for each sign octant More...
 
CHILDIDX_t m_nChildNodes
 Number of actually populated m_aChildNodes. <= 8. More...
 
int m_iSpatialTestVal
 validation value. incremented periodically (per frame?) More...
 

Detailed Description

high performance loose octree implementation it can be thought of as "3d hash table" based on object's positions its very fast - for continuous updates too spatial and object-size leveled - fast spatialization with early rejection of objects by size adaptive hash granularity based on object's sizes multi-thread-safe for reading and not MT-safe for modifying octree objects must be derived from cSpatialObject

Constructor & Destructor Documentation

◆ cOctree()

Gray3D::cOctree::cOctree ( )

◆ ~cOctree()

Gray3D::cOctree::~cOctree ( )
virtual

Member Function Documentation

◆ AddToOctree()

void Gray3D::cOctree::AddToOctree ( cOctreeObject pObj,
const cVector3f vPos,
float  fRadius 
)

Add or replace/move object in octree

◆ MakeRootIdx()

static CHILDIDX_t Gray3D::cOctree::MakeRootIdx ( const cVec3i vPi)
inlinestaticnoexcept

Make a Hash ID similar to MakeChildIdx(). based sort of on the sign bit ??

Returns
0 to 7 k_NodeMax

◆ TestTree()

int Gray3D::cOctree::TestTree ( ) const

validates tree structure

Validate all the nodes in the tree.

Friends And Related Function Documentation

◆ cOctreeNode

friend class cOctreeNode
friend

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