TAPs 0.7.7.3
TAPsParticle.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsParticle.hpp
00003 ******************************************************************************/
00007 /******************************************************************************
00008 SUKITTI PUNAK   (09/15/2004)
00009 UPDATE          (08/06/2010)
00010 ******************************************************************************/
00011 #ifndef TAPs_PARTICLE_HPP
00012 #define TAPs_PARTICLE_HPP
00013 
00014 #include "TAPsParticleBase.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 Particle : public /*virtual*/ ParticleBase<T> {
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, Particle<T> const &P )
00036     {
00037         return output << P.StrInfo();
00038     }
00039 //-----------------------------------------------------------------------------
00040 private:
00041     // Data Members     ========================================================
00042     Vector3<T>  m_vtNormal;     // normal vector
00043     Vector3<T>  m_vtPosit;      // position vector
00044     //-------------------------------------------------------------------------
00045 public:
00046     // Member Functions     ====================================================
00047 
00049     Particle ();
00050 
00052     Particle ( 
00053         T                   mass, 
00054         Vector3<T> const &  vPosition, 
00055         Vector3<T> const &  vVelocity, 
00056         Vector3<T> const &  vAcceleration, 
00057         Vector3<T> const &  vForce, 
00058         bool                fixed = false );
00059 
00061     Particle ( Particle<T> const &P );
00062 
00064     ~Particle ();
00065 
00067     Particle<T> const & operator= ( Particle<T> const &P );
00068 
00070     virtual std::string StrInfo () const;
00071 
00072     //-------------------------------------------------------------------------
00073     // Get/Set Functions
00074 
00075     // Virtual Functions:
00076     // Overrided from ParticleBase<T>
00077     inline virtual Vector3<T> const & RefToNormal () const;
00078     inline virtual Vector3<T>       & RefToNormal ();
00079     inline virtual Vector3<T> const & GetNormal () const;
00080     inline virtual void SetNormal ( Vector3<T> const & );
00081     inline virtual void SetNormal ( T x, T y, T z );
00082     inline virtual Vector3<T> const & RefToPosition () const;
00083     inline virtual Vector3<T>       & RefToPosition ();
00084     inline virtual Vector3<T> const & GetPosition () const;
00085     inline virtual void SetPosition ( Vector3<T> const & );
00086     inline virtual void SetPosition ( T x, T y, T z );
00087 
00088     //-------------------------------------------------------------------------
00089 }; // END CLASS Particle
00090 //=============================================================================
00091 END_NAMESPACE_TAPs
00092 //-----------------------------------------------------------------------------
00093 // Include definition if TAPs_USE_EXPORT is not defined
00094 //#if !defined( TAPs_USE_EXPORT )
00095     #include "TAPsParticle.cpp"
00096 //#endif
00097 //-----------------------------------------------------------------------------
00098 #endif
00099 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00100 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
00101 
00102 
00103 
00104 //TESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTE
00105 //
00106 //      TAPsParticle    T E S T    P R O G R A M
00107 //
00108 //TESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTE
00109 /*
00110 #include <iostream>
00111 #include <iomanip>
00112 using std::cout;
00113 using std::setw;
00114 #include "../Core/Physics/TAPsParticle.h"
00115 
00116 int main()
00117 {
00118     TAPs::Particle<float> P1( 1, TAPs::Vector3<float>( 0,0,0 ), TAPs::Vector3<float>( 1,0,0 ), 
00119                              TAPs::Vector3<float>( 0,1,0 ), TAPs::Vector3<float>( 0,0,1 ), true );
00120     TAPs::Particle<float> P2( 1, TAPs::Vector3<float>( 1,1,1 ), TAPs::Vector3<float>( 0.5,0,0 ), 
00121                              TAPs::Vector3<float>( 0,0.5,0 ), TAPs::Vector3<float>( 0,0,0.5 ) );
00122 
00123 
00124     cout << "P1 ==>" << P1;
00125     cout << "P2 ==>" << P2;
00126     cout << "test copy ctor ==> P3( P1 ) ==>";
00127     TAPs::Particle<float> P3( P1 );
00128     cout << P3;
00129     cout << "test assignment op ==> P3 = P2 ==>";
00130     cout << (P3 = P2);
00131 
00132     cout << "\nP3.GetNormal()   ==> " << P3.GetNormal() << "\n";
00133     cout << "P3.GetPosition() ==> " << P3.GetPosition() << "\n";
00134     cout << "P3.GetVelocity() ==> " << P3.GetVelocity() << "\n";
00135     cout << "P3.GetAcceleration() ==> " << P3.GetAcceleration() << "\n";
00136     cout << "P3.GetForce() ==> " << P3.GetForce() << "\n";
00137     cout << std::boolalpha;
00138     cout << "P3.GetFixStatus() ==> " << P3.GetFixStatus() << "\n";
00139 
00140     P3.SetNormal( TAPs::Vector3<float>(1,2,3) );
00141     cout << "\nP3.SetNormal( TAPs::Vector3<float>(1,2,3) ) " << P3.GetNormal() << "\n";
00142     P3.SetPosition( TAPs::Vector3<float>(4,5,6) );
00143     cout << "P3.SetPosition( TAPs::Vector3<float>(4,5,6) ) " << P3.GetPosition() << "\n";
00144     P3.SetVelocity( TAPs::Vector3<float>(7,8,9) );
00145     cout << "P3.SetVelocity( TAPs::Vector3<float>(7,8,9) ) " << P3.GetVelocity() << "\n";
00146     P3.SetAcceleration( TAPs::Vector3<float>(.1f,.2f,.3f) );
00147     cout << "P3.SetAcceleration( TAPs::Vector3<float>(.1f,.2f,.3f) ) " << P3.GetAcceleration() << "\n";
00148     P3.SetForce( TAPs::Vector3<float>(.4f,.5f,.6f) );
00149     cout << "P3.SetForce( TAPs::Vector3<float>(.4f,.5f,.6f) ) " << P3.GetForce() << "\n";
00150     P3.SetFixStatus( true );
00151     cout << "P3.SetFixStatus( true ) " << P3.GetFixStatus() << "\n";
00152 }
00153 */
00154 //TESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines