SpringVertex< T > Class Template Reference

#include <TAPsSpringVertex.hpp>

Collaboration diagram for SpringVertex< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

GetConstantK () const
GetCurrentLength () const
GetDampingD () const
Vector3< T > GetForce () const
ParticleVertex< T > & GetParticleVertexOne ()
ParticleVertex< T > & GetParticleVertexTwo ()
GetRestLengthL () const
 SpringVertex (ParticleVertex< T > &P1, ParticleVertex< T > &P2, T k, T d)
 SpringVertex (ParticleVertex< T > &P1, ParticleVertex< T > &P2, T k, T d, T l)
 ~SpringVertex ()

Private Member Functions

SpringVertex< T > const & operator= (SpringVertex< T > const &S)

Private Attributes

ParticleVertex< T > & m_rcP1
ParticleVertex< T > & m_rcP2
m_tD
m_tK
m_tL

Friends

std::ostream & operator<< (std::ostream &output, SpringVertex< T > const &S)


Detailed Description

template<typename T>
class SpringVertex< T >

Definition at line 17 of file TAPsSpringVertex.hpp.


Constructor & Destructor Documentation

template<typename T>
BEGIN_NAMESPACE_TAPs SpringVertex< T >::SpringVertex ( ParticleVertex< T > &  P1,
ParticleVertex< T > &  P2,
k,
d,
l 
) [inline]

Definition at line 22 of file TAPsSpringVertex.cpp.

00026     : 
00027     m_rcP1( P1 ), 
00028     m_rcP2( P2 ), 
00029     m_tK( k ), 
00030     m_tD( d ), 
00031     m_tL( l )
00032 {}

template<typename T>
SpringVertex< T >::SpringVertex ( ParticleVertex< T > &  P1,
ParticleVertex< T > &  P2,
k,
d 
) [inline]

Definition at line 37 of file TAPsSpringVertex.cpp.

00041     : 
00042     m_rcP1( P1 ), 
00043     m_rcP2( P2 ), 
00044     m_tK( k ), 
00045     m_tD( d )
00046 {
00047     T x = P2.GetPosition().GetX() - P1.GetPosition().GetX();
00048     T y = P2.GetPosition().GetY() - P1.GetPosition().GetY();
00049     T z = P2.GetPosition().GetZ() - P1.GetPosition().GetZ();
00050     m_tL = sqrt( x*x + y*y + z*z );
00051 }

template<typename T>
SpringVertex< T >::~SpringVertex (  )  [inline]

Definition at line 55 of file TAPsSpringVertex.cpp.

00056 {}


Member Function Documentation

template<typename T>
T SpringVertex< T >::GetConstantK (  )  const [inline]

Definition at line 97 of file TAPsSpringVertex.cpp.

00098 {   return m_tK;    }

template<typename T>
T SpringVertex< T >::GetCurrentLength (  )  const [inline]

Definition at line 112 of file TAPsSpringVertex.cpp.

00113 {   return ( m_rcP1.GetPosition() - m_rcP2.GetPosition() ).Length();    }

template<typename T>
T SpringVertex< T >::GetDampingD (  )  const [inline]

Definition at line 102 of file TAPsSpringVertex.cpp.

00103 {   return m_tD;    }

template<typename T>
Vector3< T > SpringVertex< T >::GetForce (  )  const [inline]

Definition at line 62 of file TAPsSpringVertex.cpp.

00063 {
00064     // Local Variables ---------------------------------------------------------
00065     // spring current length vector
00066     Vector3<T> cL = ( m_rcP1.GetPosition() - m_rcP2.GetPosition() );
00067     // spring current length scalar
00068     T scl = cL.Length();
00069     // velocity difference of the two particles linked by the spring
00070     Vector3<T> V = ( m_rcP1.GetVelocity() - m_rcP2.GetVelocity() );
00071 
00072     // F1 = -{Ks(l - r) + Kd[(V1-V2)*L]/l}*L/l
00073     // F2 = -F1
00074     //   where Ks = spring stiffness, Kd = spring damping,
00075     //     V1 and V2 are velocity of particles linked by the spring
00076     //     r = spring rest length
00077     //     L = vector of difference of positions of particle#1 and #2
00078     //     l = magnitude of L
00079     return -( (m_tK * (scl - m_tL)) +  (m_tD * ((V*cL) / scl)) ) * (cL / scl);
00080 }

template<typename T>
ParticleVertex< T > & SpringVertex< T >::GetParticleVertexOne (  )  [inline]

Definition at line 87 of file TAPsSpringVertex.cpp.

00088 {   return m_rcP1;  }

template<typename T>
ParticleVertex< T > & SpringVertex< T >::GetParticleVertexTwo (  )  [inline]

Definition at line 92 of file TAPsSpringVertex.cpp.

00093 {   return m_rcP2;  }

template<typename T>
T SpringVertex< T >::GetRestLengthL (  )  const [inline]

Definition at line 107 of file TAPsSpringVertex.cpp.

00108 {   return m_tL;    }

template<typename T>
SpringVertex<T> const& SpringVertex< T >::operator= ( SpringVertex< T > const &  S  )  [private]


Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  output,
SpringVertex< T > const &  S 
) [friend]

Definition at line 21 of file TAPsSpringVertex.hpp.

00022     {
00023         output  << "Spring<" << typeid(T).name() << "> ==> "
00024                 << "\n  -------START--SPRING_VERTEX--INFO-------"
00025                 << "\n  ParticleVertex #1: " << S.m_rcP1
00026                 << "\n  ParticleVertex #2: " << S.m_rcP2
00027                 << "\n  K Constant: " << S.m_tK
00028                 << "\n  D Damping:  " << S.m_tD
00029                 << "\n  L Length:   " << S.m_tL
00030                 << "\n  Force:      " << S.GetForce()
00031                 << "\n  Current Length: " << S.GetCurrentLength()
00032                 << "\n  --------END--SPRING_VERTEX--INFO--------\n";
00033         return output;
00034     }


Member Data Documentation

template<typename T>
ParticleVertex<T>& SpringVertex< T >::m_rcP1 [private]

Definition at line 38 of file TAPsSpringVertex.hpp.

template<typename T>
ParticleVertex<T>& SpringVertex< T >::m_rcP2 [private]

Definition at line 39 of file TAPsSpringVertex.hpp.

template<typename T>
T SpringVertex< T >::m_tD [private]

Definition at line 41 of file TAPsSpringVertex.hpp.

template<typename T>
T SpringVertex< T >::m_tK [private]

Definition at line 40 of file TAPsSpringVertex.hpp.

template<typename T>
T SpringVertex< T >::m_tL [private]

Definition at line 42 of file TAPsSpringVertex.hpp.


The documentation for this class was generated from the following files:

Generated on Mon Oct 13 11:45:57 2008 for TAPs by  doxygen 1.5.6