GLC_lib
2.5.0

GLC_OctreeNode : A node of Space partioning implemented with octree. More...
#include <glc_octreenode.h>
Public Member Functions  
Constructor / Destructor  
GLC_OctreeNode (const GLC_BoundingBox &, GLC_OctreeNode *pParent=NULL)  
Construct a octree node from the given bounding box within the given octree node.  
GLC_OctreeNode (const GLC_OctreeNode &, GLC_OctreeNode *pParent=NULL)  
Construct a octree node from the first given octree node within the second given octree node.  
virtual  ~GLC_OctreeNode () 
Destructor.  
Private Types  
typedef QList< GLC_OctreeNode * >  NodeList 
Private Member Functions  
void  unableViewFlag (QSet< GLC_3DViewInstance * > *) 
Unable the node and sub node view flag.  
void  disableViewFlag (QSet< GLC_3DViewInstance * > *) 
Disable the node and sub node view flag.  
Private Attributes  
GLC_BoundingBox  m_BoundingBox 
Octree node bounding box.  
GLC_OctreeNode *  m_pParent 
Parent Octree node.  
NodeList  m_Children 
Children list of octree node.  
QSet< GLC_3DViewInstance * >  m_3DViewInstanceSet 
This node set of 3DViewInstance.  
bool  m_Empty 
Flag to know if the node is empty.  
Static Private Attributes  
static bool  m_useBoundingSphere = true 
Flag to know if intersection is calculated with bounding sphere.  
Get Functions  
GLC_BoundingBox &  boundingBox () 
bool  intersect (const GLC_BoundingBox &boundingBox) 
Return True if this octree node intersect the bounding box.  
bool  hasChild () const 
Return true if this octree has child octree node.  
GLC_OctreeNode *  childAt (int i) const 
Return the child octree node at the given index.  
int  childCount () const 
Return this octree node child octree node count.  
bool  hasGeometry () const 
Return true if this node contains 3D view instances.  
bool  isEmpty () const 
Return true if this octree node is empty.  
QSet< GLC_3DViewInstance * >  setOfIntersectedInstances (const GLC_BoundingBox &bBox) 
Return the list off instances inside or intersect the given bounding box.  
static bool  intersectionWithBoundingSphereUsed () 
Return true if intersection are calculated with bounded sphere.  
Set Functions  
void  addChildren () 
Add 8 octree node children to this octree node.  
void  addInstance (GLC_3DViewInstance *, int) 
Add 3d view instance in this octree node branch.  
void  updateViewableInstances (const GLC_Frustum &, QSet< GLC_3DViewInstance * > *pInstanceSet=NULL) 
Update 3d view instances visibility of this octree node branch from the given frustum.  
void  removeEmptyChildren () 
Remove empty child octree node from this octree node.  
static void  useBoundingSphereIntersection (bool) 
Set intersection to bounding sphere.  
GLC_OctreeNode : A node of Space partioning implemented with octree.
Definition at line 41 of file glc_octreenode.h.

private 
Definition at line 43 of file glc_octreenode.h.
GLC_OctreeNode::GLC_OctreeNode  (  const GLC_BoundingBox &  boundingBox, 
GLC_OctreeNode *  pParent = NULL 

) 
Construct a octree node from the given bounding box within the given octree node.
Definition at line 28 of file glc_octreenode.cpp.
Referenced by addChildren(), and GLC_OctreeNode().
GLC_OctreeNode::GLC_OctreeNode  (  const GLC_OctreeNode &  octreeNode, 
GLC_OctreeNode *  pParent = NULL 

) 
Construct a octree node from the first given octree node within the second given octree node.
Definition at line 39 of file glc_octreenode.cpp.
References GLC_OctreeNode(), and m_Children.

virtual 
void GLC_OctreeNode::addChildren  (  ) 
Add 8 octree node children to this octree node.
Definition at line 97 of file glc_octreenode.cpp.
References GLC_OctreeNode(), GLC_BoundingBox::isEmpty(), GLC_BoundingBox::lowerCorner(), m_BoundingBox, m_Children, GLC_Vector3d::setVect(), GLC_BoundingBox::upperCorner(), GLC_Vector3d::x(), GLC_Vector3d::y(), and GLC_Vector3d::z().
Referenced by addInstance().
void GLC_OctreeNode::addInstance  (  GLC_3DViewInstance *  pInstance, 
int  depth  
) 
Add 3d view instance in this octree node branch.
Definition at line 178 of file glc_octreenode.cpp.
References addChildren(), GLC_3DViewInstance::boundingBox(), intersect(), GLC_BoundingBox::isEmpty(), m_3DViewInstanceSet, m_Children, and m_Empty.
Referenced by GLC_Octree::updateSpacePartitioning().

inline 
Definition at line 65 of file glc_octreenode.h.
References m_BoundingBox.
Referenced by GLC_Octree::createBoxWithMaterial().

inline 
Return the child octree node at the given index.
The child must exist
Definition at line 77 of file glc_octreenode.h.
References m_Children.
Referenced by GLC_Octree::createBoxWithMaterial().

inline 
Return this octree node child octree node count.
Definition at line 84 of file glc_octreenode.h.
References m_Children.
Referenced by GLC_Octree::createBoxWithMaterial(), and setOfIntersectedInstances().

private 
Disable the node and sub node view flag.
Definition at line 359 of file glc_octreenode.cpp.
References m_3DViewInstanceSet, m_Children, and GLC_3DViewInstance::NoViewable.
Referenced by updateViewableInstances().

inline 
Return true if this octree has child octree node.
Definition at line 72 of file glc_octreenode.h.
References m_Children.
Referenced by GLC_Octree::createBoxWithMaterial().

inline 
Return true if this node contains 3D view instances.
Definition at line 88 of file glc_octreenode.h.
References m_3DViewInstanceSet.
Referenced by GLC_Octree::createBoxWithMaterial().

inline 
Return True if this octree node intersect the bounding box.
Definition at line 162 of file glc_octreenode.h.
References GLC_BoundingBox::intersect(), GLC_BoundingBox::intersectBoundingSphere(), m_BoundingBox, and m_useBoundingSphere.
Referenced by addInstance(), and setOfIntersectedInstances().

static 
Return true if intersection are calculated with bounded sphere.
Definition at line 65 of file glc_octreenode.cpp.
References m_useBoundingSphere.

inline 
Return true if this octree node is empty.
An empty node doesn't contains child and 3d view instance
Definition at line 93 of file glc_octreenode.h.
References m_Empty.
Referenced by GLC_Octree::createBox(), GLC_Octree::createBoxWithMaterial(), and removeEmptyChildren().
void GLC_OctreeNode::removeEmptyChildren  (  ) 
Remove empty child octree node from this octree node.
Definition at line 299 of file glc_octreenode.cpp.
References isEmpty(), m_3DViewInstanceSet, m_Children, m_Empty, m_pParent, and removeEmptyChildren().
Referenced by removeEmptyChildren(), and GLC_Octree::updateSpacePartitioning().
QSet< GLC_3DViewInstance * > GLC_OctreeNode::setOfIntersectedInstances  (  const GLC_BoundingBox &  bBox  ) 
Return the list off instances inside or intersect the given bounding box.
Definition at line 70 of file glc_octreenode.cpp.
References childCount(), intersect(), m_3DViewInstanceSet, and m_Children.
Referenced by GLC_Octree::listOfIntersectedInstances().

private 
Unable the node and sub node view flag.
Definition at line 338 of file glc_octreenode.cpp.
References GLC_3DViewInstance::FullViewable, m_3DViewInstanceSet, and m_Children.
Referenced by updateViewableInstances().
void GLC_OctreeNode::updateViewableInstances  (  const GLC_Frustum &  frustum, 
QSet< GLC_3DViewInstance * > *  pInstanceSet = NULL 

) 
Update 3d view instances visibility of this octree node branch from the given frustum.
Viewable 3d view instance are inserted the the given set if exist also the set is created
Definition at line 225 of file glc_octreenode.cpp.
References GLC_3DViewInstance::boundingBox(), GLC_Geometry::boundingBox(), GLC_BoundingBox::boundingSphereRadius(), GLC_BoundingBox::center(), disableViewFlag(), GLC_3DViewInstance::FullViewable, GLC_3DViewInstance::geomAt(), GLC_Frustum::InFrustum, GLC_Frustum::localizeBoundingBox(), GLC_Frustum::localizeSphere(), m_3DViewInstanceSet, m_BoundingBox, m_Children, GLC_3DViewInstance::matrix(), GLC_3DViewInstance::NoViewable, GLC_3DViewInstance::numberOfBody(), GLC_Frustum::OutFrustum, GLC_3DViewInstance::PartialViewable, GLC_Matrix4x4::scalingX(), GLC_3DViewInstance::setGeomViewable(), GLC_3DViewInstance::setViewable(), and unableViewFlag().
Referenced by GLC_Octree::updateViewableInstances().

static 
Set intersection to bounding sphere.
Definition at line 333 of file glc_octreenode.cpp.
References m_useBoundingSphere.

private 
This node set of 3DViewInstance.
Definition at line 152 of file glc_octreenode.h.
Referenced by addInstance(), disableViewFlag(), hasGeometry(), removeEmptyChildren(), setOfIntersectedInstances(), unableViewFlag(), and updateViewableInstances().

private 
Octree node bounding box.
Definition at line 143 of file glc_octreenode.h.
Referenced by addChildren(), boundingBox(), intersect(), and updateViewableInstances().

private 
Children list of octree node.
Definition at line 149 of file glc_octreenode.h.
Referenced by addChildren(), addInstance(), childAt(), childCount(), disableViewFlag(), GLC_OctreeNode(), hasChild(), removeEmptyChildren(), setOfIntersectedInstances(), unableViewFlag(), updateViewableInstances(), and ~GLC_OctreeNode().

private 
Flag to know if the node is empty.
Definition at line 155 of file glc_octreenode.h.
Referenced by addInstance(), isEmpty(), and removeEmptyChildren().

private 
Parent Octree node.
Definition at line 146 of file glc_octreenode.h.
Referenced by removeEmptyChildren().

staticprivate 
Flag to know if intersection is calculated with bounding sphere.
Definition at line 158 of file glc_octreenode.h.
Referenced by intersect(), intersectionWithBoundingSphereUsed(), and useBoundingSphereIntersection().