![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsParticleVertex.hpp 00003 ******************************************************************************/ 00007 /****************************************************************************** 00008 SUKITTI PUNAK (11/08/2004) 00009 UPDATE (08/06/2010) 00010 ******************************************************************************/ 00011 #include "TAPsParticleVertex.hpp" 00012 // Using Inclusion Model (i.e. definitions are included in declarations) 00013 // (this name.cpp is included in name.hpp) 00014 // Each friend is defined directly inside its declaration. 00015 00016 BEGIN_NAMESPACE_TAPs 00017 //============================================================================= 00018 // Constructors and Destructor 00019 //----------------------------------------------------------------------------- 00020 // ParticleVertex Constructor 00021 template <typename T> 00022 ParticleVertex<T>::ParticleVertex 00023 ( 00024 Vertex<T> const & vertex, 00025 bool fixed 00026 ) : ParticleBase<T>() 00027 , m_rcPosit( vertex.GetPosition() ) 00028 , m_rcNormal( vertex.GetNormal() ) 00029 {} 00030 //----------------------------------------------------------------------------- 00031 // ParticleVertex Constructor 00032 template <typename T> 00033 ParticleVertex<T>::ParticleVertex 00034 ( 00035 T mass, 00036 Vector3<T> const & vPosition, 00037 Vector3<T> const & vNormal, 00038 Vector3<T> const & vVelocity, 00039 Vector3<T> const & vAcceleration, 00040 Vector3<T> const & vForce, 00041 bool fixed 00042 ) : ParticleBase<T>( mass, vVelocity, vAcceleration, vForce, fixed ) 00043 , m_rcPosit( vPosition ) 00044 , m_rcNormal( vNormal ) 00045 {} 00046 //----------------------------------------------------------------------------- 00047 // ParticleVertex Constructor 00048 template <typename T> 00049 ParticleVertex<T>::ParticleVertex 00050 ( 00051 T mass, 00052 Vertex<T> & vertex, 00053 Vector3<T> const & vVelocity, 00054 Vector3<T> const & vAcceleration, 00055 Vector3<T> const & vForce, 00056 bool fixed 00057 ) : ParticleBase<T>( mass, vVelocity, vAcceleration, vForce, fixed ) 00058 , m_rcPosit( vertex.GetPosition() ) 00059 , m_rcNormal( vertex.GetNormal() ) 00060 {} 00061 //----------------------------------------------------------------------------- 00062 // ParticleVertex Destructor 00063 template <typename T> 00064 ParticleVertex<T>::~ParticleVertex () 00065 {} 00066 //----------------------------------------------------------------------------- 00067 // Return this object info as a string 00068 template <typename T> 00069 std::string ParticleVertex<T>::StrInfo () const 00070 { 00071 std::stringstream ss; 00072 ss << "ParticleVertex<" << typeid(T).name() << "> ==> " 00073 << "\n Mass: " << GetMass() 00074 << "\n Normal: " << GetNormal() 00075 << "\n Position: " << GetPosition() 00076 << "\n Velocity: " << GetVelocity() 00077 << "\n Acceleration: " << GetAcceleration() 00078 << "\n Force: " << GetForce() 00079 << "\n Fix Status: " << ( GetFixStatus() == true ? "true" : "false" ) 00080 << "\n"; 00081 return ss.str(); 00082 } 00083 //----------------------------------------------------------------------------- 00084 //============================================================================= 00085 // Get/Set Functions 00086 //----------------------------------------------------------------------------- 00087 template <typename T> 00088 inline Vector3<T> const & ParticleVertex<T>::RefToNormal () const 00089 { return m_rcNormal; } 00090 //----------------------------------------------------------------------------- 00091 template <typename T> 00092 inline Vector3<T> & ParticleVertex<T>::RefToNormal () 00093 { return m_rcNormal; } 00094 //----------------------------------------------------------------------------- 00095 template <typename T> 00096 inline Vector3<T> const & ParticleVertex<T>::GetNormal () const 00097 { return m_rcNormal; } 00098 //----------------------------------------------------------------------------- 00099 template <typename T> 00100 inline void ParticleVertex<T>::SetNormal ( Vector3<T> const &v ) 00101 { m_rcNormal = v; } 00102 //----------------------------------------------------------------------------- 00103 template <typename T> 00104 inline void ParticleVertex<T>::SetNormal ( T x, T y, T z ) 00105 { m_rcNormal.SetXYZ( x, y, z ); } 00106 //----------------------------------------------------------------------------- 00107 template <typename T> 00108 inline Vector3<T> const & ParticleVertex<T>::RefToPosition () const 00109 { return m_rcPosit; } 00110 //----------------------------------------------------------------------------- 00111 template <typename T> 00112 inline Vector3<T> & ParticleVertex<T>::RefToPosition () 00113 { return m_rcPosit; } 00114 //----------------------------------------------------------------------------- 00115 template <typename T> 00116 inline Vector3<T> const & ParticleVertex<T>::GetPosition () const 00117 { return m_rcPosit; } 00118 //----------------------------------------------------------------------------- 00119 template <typename T> 00120 inline void ParticleVertex<T>::SetPosition ( Vector3<T> const &v ) 00121 { m_rcPosit = v; } 00122 //----------------------------------------------------------------------------- 00123 template <typename T> 00124 inline void ParticleVertex<T>::SetPosition ( T x, T y, T z ) 00125 { m_rcPosit.SetXYZ( x, y, z ); } 00126 //----------------------------------------------------------------------------- 00127 //============================================================================= 00128 END_NAMESPACE_TAPs 00129 //345678901234567890123456789012345678901234567890123456789012345678901234567890 00130 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8