"L. Spiro Engine"

F:/My Projects/LSEngine/Modules/LSPhysicsLib/Src/BoundingBoxes/LSPAabb.h

00001 
00016 #ifndef __LSP_LSP_AABB_H__
00017 #define __LSP_LSP_AABB_H__
00018 
00019 #include "../LSPPhysicsLib.h"
00020 #include "Line/LSMRay3.h"
00021 #include "Line/LSMLineSeg3.h"
00022 #include "Matrix/LSMMatrix4x4.h"
00023 #include "Plane/LSMPlane3.h"
00024 #include "Vector/LSMVector3.h"
00025 
00026 namespace lsp {
00027 
00028         // == Enumerations.
00032         enum LSP_AABB_CORNERS {
00033                 LSP_AC_FORWARD_LEFT_BOTTOM,
00034                 LSP_AC_FORWARD_LEFT_TOP,
00035                 LSP_AC_FORWARD_RIGHT_BOTTOM,
00036                 LSP_AC_FORWARD_RIGHT_TOP,
00037 
00038                 LSP_AC_BACK_LEFT_BOTTOM,
00039                 LSP_AC_BACK_LEFT_TOP,
00040                 LSP_AC_BACK_RIGHT_BOTTOM,
00041                 LSP_AC_BACK_RIGHT_TOP,
00042         };
00043 
00050         class CAabb {
00051                 // All is public.  This class has no secrets.
00052         public :
00053                 // == Functions.
00057                 LSVOID LSE_CALL                                                 MakeInfinitelySmall();
00058 
00065                 LSVOID LSE_CALL                                                 ComputeAabbFromPointArray( const CVector3 * _pvPoints, LSUINT32 _uiTotal );
00066 
00074                 LSVOID LSE_CALL                                                 ComputeAabbFromAabbAndMatrix( const CAabb &_aabbOther, const CMatrix4x4 &_mTrans );
00075 
00081                 LSVOID LSE_CALL                                                 Encompass( const CAabb &_aabbOther );
00082 
00088                 LSVOID LSE_CALL                                                 Encompass( const CVector3 &_vOther );
00089 
00095                 LSVOID LSE_CALL                                                 Expand( LSREAL _fAmount );
00096 
00103                 LSVOID LSE_CALL                                                 GetBox( CVector3 _vPoints[8] ) const;
00104 
00110                 CVector3 LSE_CALL                                               GetCenter() const;
00111 
00117                 LSREAL LSE_CALL                                                 GetSizeX() const;
00118 
00124                 LSREAL LSE_CALL                                                 GetSizeY() const;
00125 
00131                 LSREAL LSE_CALL                                                 GetSizeZ() const;
00132 
00138                 LSREAL LSE_CALL                                                 GetVolume() const;
00139 
00140 
00141 
00142                 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00143                 // DISTANCE TESTS
00144                 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00145                 // == Points.
00152                 CVector3 LSE_CALL                                               ClosestPointToPoint( const CVector3 &_vPoint ) const;
00153                 
00161                 LSREAL LSE_CALL                                                 GetSqDistFromPoint( const CVector3 &_vPoint ) const;
00162 
00169                 CVector3 LSE_CALL                                               GetCorner( LSUINT32 _ui32Mask ) const;
00170 
00171 
00172                 // == Members.
00176                 CVector3                                                                m_vMin;
00177 
00181                 CVector3                                                                m_vMax;
00182         };
00183 
00184 
00185         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00186         // DEFINITIONS
00187         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00188         // == Functions.
00194         LSE_INLINE LSREAL LSE_CALL CAabb::GetSizeX() const {
00195                 return m_vMax.x - m_vMin.x;
00196         }
00197 
00203         LSE_INLINE LSREAL LSE_CALL CAabb::GetSizeY() const {
00204                 return m_vMax.y - m_vMin.y;
00205         }
00206 
00212         LSE_INLINE LSREAL LSE_CALL CAabb::GetSizeZ() const {
00213                 return m_vMax.z - m_vMin.z;
00214         }
00215 
00221         LSE_INLINE LSREAL LSE_CALL CAabb::GetVolume() const {
00222                 return GetSizeX() * GetSizeY() * GetSizeZ();
00223         }
00224 
00225 }       // namespace lsp
00226 
00227 #endif  // __LSP_LSP_AABB_H__
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator