#include <TAPsSpringVertex.hpp>

Public Member Functions | |
| T | GetConstantK () const |
| T | GetCurrentLength () const |
| T | GetDampingD () const |
| Vector3< T > | GetForce () const |
| ParticleVertex< T > & | GetParticleVertexOne () |
| ParticleVertex< T > & | GetParticleVertexTwo () |
| T | 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 |
| T | m_tD |
| T | m_tK |
| T | m_tL |
Friends | |
| std::ostream & | operator<< (std::ostream &output, SpringVertex< T > const &S) |
Definition at line 17 of file TAPsSpringVertex.hpp.
| BEGIN_NAMESPACE_TAPs SpringVertex< T >::SpringVertex | ( | ParticleVertex< T > & | P1, | |
| ParticleVertex< T > & | P2, | |||
| T | k, | |||
| T | d, | |||
| T | l | |||
| ) | [inline] |
| SpringVertex< T >::SpringVertex | ( | ParticleVertex< T > & | P1, | |
| ParticleVertex< T > & | P2, | |||
| T | k, | |||
| T | 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 }
| SpringVertex< T >::~SpringVertex | ( | ) | [inline] |
| T SpringVertex< T >::GetConstantK | ( | ) | const [inline] |
| T SpringVertex< T >::GetCurrentLength | ( | ) | const [inline] |
| T SpringVertex< T >::GetDampingD | ( | ) | const [inline] |
| 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 }
| ParticleVertex< T > & SpringVertex< T >::GetParticleVertexOne | ( | ) | [inline] |
| ParticleVertex< T > & SpringVertex< T >::GetParticleVertexTwo | ( | ) | [inline] |
| T SpringVertex< T >::GetRestLengthL | ( | ) | const [inline] |
| SpringVertex<T> const& SpringVertex< T >::operator= | ( | SpringVertex< T > const & | S | ) | [private] |
| 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 }
ParticleVertex<T>& SpringVertex< T >::m_rcP1 [private] |
Definition at line 38 of file TAPsSpringVertex.hpp.
ParticleVertex<T>& SpringVertex< T >::m_rcP2 [private] |
Definition at line 39 of file TAPsSpringVertex.hpp.
T SpringVertex< T >::m_tD [private] |
Definition at line 41 of file TAPsSpringVertex.hpp.
T SpringVertex< T >::m_tK [private] |
Definition at line 40 of file TAPsSpringVertex.hpp.
T SpringVertex< T >::m_tL [private] |
Definition at line 42 of file TAPsSpringVertex.hpp.
1.5.6