"L. Spiro Engine"

F:/My Projects/LSEngine/Modules/LSMathLib/Src/Triangle/LSMTriangle3Ex.h

00001 
00016 #ifndef __LSM_TRIANGLE3EX_H__
00017 #define __LSM_TRIANGLE3EX_H__
00018 
00019 #include "../LSMMathLib.h"
00020 #include "LSMTriangle3.h"
00021 
00022 namespace lsm {
00023 
00031         class CTriangle3Ex : protected CTriangle3 {
00032         public :
00033                 // == Various constructors.
00034                 LSE_INLINE LSE_CALLCTOR                                         CTriangle3Ex();
00035                 LSE_INLINE LSE_CALLCTOR                                         CTriangle3Ex( const CVector3 _vArray[3] );
00036                 LSE_INLINE LSE_CALLCTOR                                         CTriangle3Ex( const CTriangle3 &_tTri );
00037                 LSE_INLINE LSE_CALLCTOR                                         CTriangle3Ex( const CTriangle3Ex &_tTri );
00038 
00039 
00040                 // == Operators.
00047                 LSE_INLINE const CVector3 & LSE_FCALL           operator [] ( LSUINT32 _ui32Index ) const;
00048 
00055                 LSE_INLINE LSBOOL LSE_FCALL                                     operator == ( const CTriangle3 &_tTri ) const;
00056 
00063                 LSE_INLINE LSBOOL LSE_FCALL                                     operator != ( const CTriangle3 &_tTri ) const;
00064 
00071                 LSE_INLINE LSBOOL LSE_FCALL                                     operator == ( const CTriangle3Ex &_teTri ) const;
00072 
00079                 LSE_INLINE LSBOOL LSE_FCALL                                     operator != ( const CTriangle3Ex &_tTri ) const;
00080 
00081 
00082                 // == Functions.
00088                 LSE_INLINE const CVector3 & LSE_FCALL           A() const;
00089 
00095                 LSE_INLINE const CVector3 & LSE_FCALL           B() const;
00096 
00102                 LSE_INLINE const CVector3 & LSE_FCALL           C() const;
00103 
00109                 LSE_INLINE const CVector3 & LSE_FCALL           N() const;
00110 
00116                 LSE_INLINE const LSREAL LSE_FCALL                       D00() const;
00117 
00123                 LSE_INLINE const LSREAL LSE_FCALL                       D01() const;
00124 
00130                 LSE_INLINE const LSREAL LSE_FCALL                       D11() const;
00131 
00137                 LSE_INLINE const LSREAL LSE_FCALL                       Denom() const;
00138 
00142                 LSE_INLINE LSVOID LSE_FCALL                                     ReverseOrder();
00143 
00152                 LSVOID LSE_FCALL                                                        Barycentric( const CVector3 &_vPoint,
00153                         LSREAL &_fU, LSREAL &_fV, LSREAL &_fW ) const;
00154 
00155 
00156         protected :
00157                 // == Members.
00158                 // The normal.
00159                 CVector3                                                                        m_vNormal;
00160                 // The barycentric terms.
00161                 LSREAL                                                                          m_fD00;
00162                 LSREAL                                                                          m_fD01;
00163                 LSREAL                                                                          m_fD11;
00164                 LSREAL                                                                          m_fDenom;
00165 
00166 
00167                 // == Functions.
00171                 LSVOID LSE_FCALL                                                        Update();
00172         };
00173 
00174 
00175         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00176         // DEFINITIONS
00177         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00178         // == Various constructors.
00179         LSE_INLINE LSE_CALLCTOR CTriangle3Ex::CTriangle3Ex() {
00180         }
00181         LSE_INLINE LSE_CALLCTOR CTriangle3Ex::CTriangle3Ex( const CVector3 _vArray[3] ) {
00182                 a = _vArray[0];
00183                 b = _vArray[1];
00184                 c = _vArray[2];
00185                 Update();
00186         }
00187         LSE_INLINE LSE_CALLCTOR CTriangle3Ex::CTriangle3Ex( const CTriangle3 &_tTri ) {
00188                 a = _tTri.a;
00189                 b = _tTri.b;
00190                 c = _tTri.c;
00191                 Update();
00192         }
00193         LSE_INLINE LSE_CALLCTOR CTriangle3Ex::CTriangle3Ex( const CTriangle3Ex &_tTri ) {
00194                 a = _tTri.a;
00195                 b = _tTri.b;
00196                 c = _tTri.c;
00197                 m_vNormal = _tTri.m_vNormal;
00198                 m_fD00 = _tTri.m_fD00;
00199                 m_fD01 = _tTri.m_fD01;
00200                 m_fD11 = _tTri.m_fD11;
00201                 m_fDenom = _tTri.m_fDenom;
00202         }
00203 
00204 
00205         // == Operators.
00212         LSE_INLINE const CVector3 & LSE_FCALL CTriangle3Ex::operator [] ( LSUINT32 _ui32Index ) const { return reinterpret_cast<const CVector3 *>(this)[_ui32Index]; }
00213 
00220         LSE_INLINE LSBOOL LSE_FCALL CTriangle3Ex::operator == ( const CTriangle3 &_tTri ) const {
00221                 return a == _tTri.a && b == _tTri.b && c == _tTri.c;
00222         }
00223 
00230         LSE_INLINE LSBOOL LSE_FCALL CTriangle3Ex::operator != ( const CTriangle3 &_tTri ) const {
00231                 return a != _tTri.a || b != _tTri.b || c != _tTri.c;
00232         }
00233 
00240         LSE_INLINE LSBOOL LSE_FCALL CTriangle3Ex::operator == ( const CTriangle3Ex &_teTri ) const {
00241                 return a == _teTri.a && b == _teTri.b && c == _teTri.c;
00242         }
00243 
00250         LSE_INLINE LSBOOL LSE_FCALL CTriangle3Ex::operator != ( const CTriangle3Ex &_teTri ) const {
00251                 return a != _teTri.a || b != _teTri.b || c != _teTri.c;
00252         }
00253 
00254         // == Functions.
00260         LSE_INLINE const CVector3 & LSE_FCALL CTriangle3Ex::A() const           { return a; }
00261 
00267         LSE_INLINE const CVector3 & LSE_FCALL CTriangle3Ex::B() const           { return b; }
00268 
00274         LSE_INLINE const CVector3 & LSE_FCALL CTriangle3Ex::C() const           { return c; }
00275 
00281         LSE_INLINE const CVector3 & LSE_FCALL CTriangle3Ex::N() const           { return m_vNormal; }
00282 
00288         LSE_INLINE const LSREAL LSE_FCALL CTriangle3Ex::D00() const                     { return m_fD00; }
00289 
00295         LSE_INLINE const LSREAL LSE_FCALL CTriangle3Ex::D01() const                     { return m_fD01; }
00296 
00302         LSE_INLINE const LSREAL LSE_FCALL CTriangle3Ex::D11() const                     { return m_fD11; }
00303 
00309         LSE_INLINE const LSREAL LSE_FCALL CTriangle3Ex::Denom() const           { return m_fDenom; }
00310 
00314         LSE_INLINE LSVOID LSE_FCALL CTriangle3Ex::ReverseOrder()                        { CMathLib::Swap( a, c ); }
00315 
00316 
00317 
00318 }       // namespace lsm
00319 
00320 #endif  // __LSM_TRIANGLE3EX_H__
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator