#include <TAPsSpring.hpp>

Public Member Functions | |
| T | GetConstantK () const |
| T | GetCurrentLength () const |
| T | GetDampingD () const |
| Vector3< T > | GetForce () const |
| Particle< T > & | GetParticleOne () |
| Particle< T > & | GetParticleTwo () |
| T | GetRestLengthL () const |
| Spring (Particle< T > &P1, Particle< T > &P2, T k, T d) | |
| Spring (Particle< T > &P1, Particle< T > &P2, T k, T d, T l) | |
| ~Spring () | |
Private Member Functions | |
| Spring< T > const & | operator= (Spring< T > const &S) |
Private Attributes | |
| Particle< T > & | m_rcP1 |
| Particle< T > & | m_rcP2 |
| T | m_tD |
| T | m_tK |
| T | m_tL |
Friends | |
| class | Cloth< T > |
| class | DeformMesh< T > |
| std::ostream & | operator<< (std::ostream &output, Spring< T > const &S) |
Definition at line 22 of file TAPsSpring.hpp.
| Spring< T >::Spring | ( | Particle< T > & | P1, | |
| Particle< T > & | P2, | |||
| T | k, | |||
| T | d | |||
| ) | [inline] |
Definition at line 37 of file TAPsSpring.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 }
| T Spring< T >::GetConstantK | ( | ) | const [inline] |
| T Spring< T >::GetCurrentLength | ( | ) | const [inline] |
| T Spring< T >::GetDampingD | ( | ) | const [inline] |
Definition at line 62 of file TAPsSpring.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 }
| T Spring< T >::GetRestLengthL | ( | ) | const [inline] |
friend class Cloth< T > [friend] |
Definition at line 27 of file TAPsSpring.hpp.
friend class DeformMesh< T > [friend] |
Definition at line 26 of file TAPsSpring.hpp.
| std::ostream& operator<< | ( | std::ostream & | output, | |
| Spring< T > const & | S | |||
| ) | [friend] |
Definition at line 30 of file TAPsSpring.hpp.
00031 { 00032 output << "Spring<" << typeid(T).name() << "> ==> " 00033 << "\n -------START--SPRING--INFO-------" 00034 << "\n Particle #1: " << S.m_rcP1 00035 << "\n Particle #2: " << S.m_rcP2 00036 << "\n K Constant: " << S.m_tK 00037 << "\n D Damping: " << S.m_tD 00038 << "\n L Length: " << S.m_tL 00039 << "\n Current Length: " << S.GetCurrentLength() 00040 << "\n Force: " << S.GetForce() 00041 << "\n --------END--SPRING--INFO--------\n"; 00042 return output; 00043 }
Definition at line 47 of file TAPsSpring.hpp.
Definition at line 48 of file TAPsSpring.hpp.
Definition at line 50 of file TAPsSpring.hpp.
Definition at line 49 of file TAPsSpring.hpp.
Definition at line 51 of file TAPsSpring.hpp.
1.5.6