"L. Spiro Engine"
|
00001 00016 #ifndef __LSP_QUADTREENODE_H__ 00017 #define __LSP_QUADTREENODE_H__ 00018 00019 #include "../LSPPhysicsLib.h" 00020 #include "LinkedList/LSTLSingleLinkedList.h" 00021 #include "LSPQuadTreeObject.h" 00022 #include "Vector/LSMVector2.h" 00023 00024 namespace lsp { 00025 00032 class CQuadTreeNode { 00033 friend class CQuadTree; 00034 public : 00035 // == Various constructors. 00036 LSE_CALLCTOR CQuadTreeNode(); 00037 LSE_CALLCTOR ~CQuadTreeNode(); 00038 00039 00040 // == Functions. 00047 LSVOID LSE_CALL SetCenterAndRadius( const CVector2 &_vPos, LSREAL _fRadius ); 00048 00054 LSE_INLINE const CVector2 & LSE_CALL GetCenter() const; 00055 00061 LSE_INLINE LSREAL LSE_CALL GetRadius() const; 00062 00069 LSVOID LSE_CALL SetChild( LSUINT32 _ui32Index, CQuadTreeNode * _pqtnChild ); 00070 00077 LSBOOL LSE_CALL AddObject( CQuadTreeObject * _pqtoObject ); 00078 00084 LSVOID LSE_CALL RemObject( CQuadTreeObject * _pqtoObject ); 00085 00086 protected : 00087 // == Members. 00091 CSingleLinkedList<CQuadTreeObject *> m_sllObjects; 00092 00096 CQuadTreeNode * m_pqtnChildren[4]; 00097 00101 CVector2 m_vCenter; 00102 00106 LSREAL m_fRadius; 00107 }; 00108 00109 00110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00111 // DEFINITIONS 00112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00113 // == Functions. 00119 LSE_INLINE const CVector2 & LSE_CALL CQuadTreeNode::GetCenter() const { 00120 return m_vCenter; 00121 } 00122 00128 LSE_INLINE LSREAL LSE_CALL CQuadTreeNode::GetRadius() const { 00129 return m_fRadius; 00130 } 00131 00132 } // namespace lsp 00133 00134 #endif // __LSP_QUADTREENODE_H__