TAPs 0.7.7.3
TAPsParticleBase.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsParticleBase.hpp
00003 ******************************************************************************/
00007 /******************************************************************************
00008 SUKITTI PUNAK   (08/06/2010)
00009 UPDATE          (08/06/2010)
00010 ******************************************************************************/
00011 #ifndef TAPs_PARTICLE_BASE_HPP
00012 #define TAPs_PARTICLE_BASE_HPP
00013 
00014 #include "../Core/TAPsVector3.hpp"
00015 
00016 BEGIN_NAMESPACE_TAPs
00017 //=============================================================================
00018 // Forward Class Declarations
00019 template <typename T>   class DeformMesh;
00020 template <typename T>   class DeformMeshWithCut;
00021 template <typename T>   class Cloth;
00022 template <typename T>   class Spring;
00023 //=============================================================================
00024 template <typename T>
00025 class ParticleBase {
00026 //=============================================================================
00027     //-------------------------------------------------------------------------
00028     // Friend Classes
00029     friend class DeformMesh<T>;
00030     friend class DeformMeshWithCut<T>;
00031     friend class Cloth<T>;
00032     friend class Spring<T>;
00033     //-------------------------------------------------------------------------
00034     // Friend Function
00035     friend std::ostream & operator<< ( std::ostream &output, ParticleBase<T> const &P )
00036     {
00037         return output << P.StrInfo();
00038     }
00039 //-----------------------------------------------------------------------------
00040 protected:
00041     // Data Members     ========================================================
00042     T           m_tMass;        // mass
00043     //Vector3<T>    m_vtNormal;     // normal vector
00044     //Vector3<T>    m_vtPosit;      // position vector
00045     Vector3<T>  m_vtVeloc;      // velocity vector
00046     Vector3<T>  m_vtAccel;      // acceleration vector
00047     Vector3<T>  m_vtForce;      // force vector
00048     bool        m_bFixed;       // fixed/unfixed
00049     //-------------------------------------------------------------------------
00050 public:
00051     // Member Functions     ====================================================
00052 
00054     ParticleBase ();
00055 
00057     ParticleBase ( 
00058         T                   mass, 
00059         //Vector3<T> const &    vPosition, 
00060         Vector3<T> const &  vVelocity, 
00061         Vector3<T> const &  vAcceleration, 
00062         Vector3<T> const &  vForce, 
00063         bool                fixed = false );
00064 
00066     ParticleBase ( ParticleBase<T> const &P );
00067 
00069     ~ParticleBase ();
00070 
00072     ParticleBase<T> const & operator= ( ParticleBase<T> const &P );
00073 
00075     virtual std::string StrInfo () const;
00076 
00077     //-------------------------------------------------------------------------
00078     // Get/Set Functions
00079     inline T    GetMass () const;
00080     inline void SetMass ( T );
00081 
00082     inline Vector3<T> const & RefToVelocity () const;
00083     inline Vector3<T>       & RefToVelocity ();
00084     inline Vector3<T> const & GetVelocity () const;
00085     inline void         SetVelocity ( Vector3<T> const & );
00086     inline void         SetVelocity ( T x, T y, T z );
00087 
00088     inline Vector3<T> const & RefToAcceleration () const;
00089     inline Vector3<T>       & RefToAcceleration ();
00090     inline Vector3<T> const & GetAcceleration () const;
00091     inline void         SetAcceleration ( Vector3<T> const & );
00092     inline void         SetAcceleration ( T x, T y, T z );
00093 
00094     inline Vector3<T> const & RefToForce () const;
00095     inline Vector3<T>       & RefToForce ();
00096     inline Vector3<T> const & GetForce () const;
00097     inline void         SetForce ( Vector3<T> const & );
00098     inline void         SetForce ( T x, T y, T z );
00099 
00100     inline bool GetFixStatus () const;
00101     inline void SetFixStatus ( bool );
00102 
00103     //-------------------------------------------------------------------------
00104     // Virtual Functions:
00105     // Must be overrided by child classes
00106     // REMARK: No const for Vector3<T> & and no const after the get fns so that 
00107     //         the return ref can be modified.
00108     inline virtual Vector3<T> const & RefToNormal () const = 0;
00109     inline virtual Vector3<T>       & RefToNormal () = 0;
00110     inline virtual Vector3<T> const & GetNormal () const = 0;
00111     inline virtual void SetNormal ( Vector3<T> const & ) = 0;
00112     inline virtual void SetNormal ( T x, T y, T z ) = 0;
00113     inline virtual Vector3<T> const & RefToPosition () const = 0;
00114     inline virtual Vector3<T>       & RefToPosition () = 0;
00115     inline virtual Vector3<T> const & GetPosition () const = 0;
00116     inline virtual void SetPosition ( Vector3<T> const & ) = 0;
00117     inline virtual void SetPosition ( T x, T y, T z ) = 0;
00118 
00119     //-------------------------------------------------------------------------
00120 }; // END CLASS ParticleBase
00121 //=============================================================================
00122 END_NAMESPACE_TAPs
00123 //-----------------------------------------------------------------------------
00124 // Include definition if TAPs_USE_EXPORT is not defined
00125 //#if !defined( TAPs_USE_EXPORT )
00126     #include "TAPsParticleBase.cpp"
00127 //#endif
00128 //-----------------------------------------------------------------------------
00129 #endif
00130 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00131 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines