"L. Spiro Engine"

F:/My Projects/LSEngine/Modules/LSMathLib/Src/Plane/LSMPlane3.h

00001 
00019 #ifndef __LSM_PLANE3_H__
00020 #define __LSM_PLANE3_H__
00021 
00022 #include "../LSMMathLib.h"
00023 #include "../Vector/LSMVector3.h"
00024 #include "LSMPlane3Base.h"
00025 
00026 namespace lsm {
00027 
00028         
00029 
00038         class CPlane3 : public CPlane3Base<LSREAL, CVector3> {
00039                 // All is public.  This class has no secrets.
00040         public :
00041                 // == Various constructors.
00042                 LSE_INLINE LSE_CALLCTOR                         CPlane3();
00043                 LSE_INLINE LSE_CALLCTOR                         CPlane3( const CPlane3 &_pPlane );
00044                 LSE_INLINE LSE_CALLCTOR                         CPlane3( const CVector3 &_vPoint0, const CVector3 &_vPoint1, const CVector3 &_vPoint2 );
00045                 LSE_INLINE LSE_CALLCTOR                         CPlane3( const CVector3 &_vNormal, LSREAL _fDistance );
00046                 LSE_INLINE LSE_CALLCTOR                         CPlane3( const CVector3 &_vPoint, const CVector3 &_vNormal );
00047 
00048 
00049                 // == Functions.
00053                 LSE_INLINE LSVOID LSE_FCALL                     Normalize();
00054 
00055 
00056         private :
00057                 typedef CPlane3Base<LSDOUBLE, CVector3>
00058                                                                                         Parent;
00059         };
00060 
00061 
00062         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00063         // DEFINITIONS
00064         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00065         // == Various constructors.
00066         LSE_INLINE LSE_CALLCTOR CPlane3::CPlane3() {
00067         }
00068         LSE_INLINE LSE_CALLCTOR CPlane3::CPlane3( const CPlane3 &_pPlane ) {
00069                 (*this) = _pPlane;
00070         }
00071         LSE_INLINE LSE_CALLCTOR CPlane3::CPlane3( const CVector3 &_vPoint0, const CVector3 &_vPoint1, const CVector3 &_vPoint2 ) {
00072                 n = CVector3::CrossProduct( _vPoint1 - _vPoint0, _vPoint2 - _vPoint0 );
00073                 n.Normalize();
00074                 dist = n.Dot( _vPoint0 );
00075         }
00076         LSE_INLINE LSE_CALLCTOR CPlane3::CPlane3( const CVector3 &_vNormal, LSREAL _fDistance ) {
00077                 n = _vNormal;
00078                 dist = _fDistance;
00079         }
00080         LSE_INLINE LSE_CALLCTOR CPlane3::CPlane3( const CVector3 &_vPoint, const CVector3 &_vNormal ) {
00081                 n = _vNormal;
00082                 dist = n.Dot( _vPoint );
00083         }
00084 
00085         // == Functions.
00089         LSE_INLINE LSVOID LSE_FCALL CPlane3::Normalize() {
00090                 LSREAL fInvMag = CMathLib::InvSqrt( n.LenSq() );
00091 
00092                 n.x *= fInvMag;
00093                 n.y *= fInvMag;
00094                 n.z *= fInvMag;
00095                 dist *= fInvMag;
00096         }
00097 
00098 
00099 }       // namespace lsm
00100 
00101 #endif  // __LSM_PLANE3_H__
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator