![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsAdvSimConstraint_VertexIdVsHEVertex.cpp 00003 ******************************************************************************/ 00007 /****************************************************************************** 00008 SUKITTI PUNAK (04/30/2010) 00009 UPDATE (01/24/2010) 00010 ******************************************************************************/ 00011 #include "TAPsAdvSimConstraint_VertexIdVsHEVertex.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 00019 //----------------------------------------------------------------------------- 00020 template <typename T> 00021 AdvSimConstraint_VertexIdVsHEVertex<T>::AdvSimConstraint_VertexIdVsHEVertex ( 00022 unsigned int vertexID, 00023 HEVertex<T> * pHEVertex, 00024 T forceRatio, 00025 T forceScaleForModel1, 00026 T forceScaleForModel2, 00027 T forceThresholdForModel1 = 1, 00028 T forceThresholdForModel2 = 1, 00029 bool bEnforceVertexOfModel1 = true, 00030 bool bEnforceVertexOfModel2 = true 00031 ) 00032 : AdvSimConstraint_Base_AvsB( forceRatio, forceScaleForModel1, forceScaleForModel2, forceThresholdForModel1, forceThresholdForModel2, bEnforceVertexOfModel1, bEnforceVertexOfModel2 ) 00033 , m_uiVertexID_Model1( vertexID ) 00034 , m_pHEVertex_Model2( pHEVertex ) 00035 {} 00036 //----------------------------------------------------------------------------- 00037 template <typename T> 00038 AdvSimConstraint_VertexIdVsHEVertex<T>::AdvSimConstraint_VertexIdVsHEVertex ( AdvSimConstraint_VertexIdVsHEVertex<T> const &orig ) 00039 : AdvSimConstraint_Base_AvsB( orig ) 00040 , m_uiVertexID_Model1( orig.m_uiVertexID_Model1 ) 00041 , m_pHEVertex_Model2( orig.m_pHEVertex_Model2 ) 00042 {} 00043 //----------------------------------------------------------------------------- 00044 template <typename T> 00045 AdvSimConstraint_VertexIdVsHEVertex<T>::~AdvSimConstraint_VertexIdVsHEVertex () 00046 { 00047 //ClearConstraint(); 00048 } 00049 //----------------------------------------------------------------------------- 00050 template <typename T> 00051 std::string AdvSimConstraint_VertexIdVsHEVertex<T>::StrInfo () const 00052 { 00053 std::ostringstream ss; 00054 ss << "AdvSimConstraint_VertexIdVsHEVertex<" << typeid(T).name() << ">"; 00055 ss << "\n\tVertex ID from modelA: " << GetVertexIDFromModel_1(); 00056 ss << "\n\tpHEVertex from modelB: " << GetPtrToVertexFromModel_2(); 00057 ss << "\n" << AdvSimConstraint_Base_AvsB<T>::StrInfo(); 00058 return ss.str(); 00059 } 00060 //----------------------------------------------------------------------------- 00061 //============================================================================= 00062 // Assignment Operator 00063 //----------------------------------------------------------------------------- 00064 template <typename T> 00065 AdvSimConstraint_VertexIdVsHEVertex<T> & AdvSimConstraint_VertexIdVsHEVertex<T>::operator= ( AdvSimConstraint_VertexIdVsHEVertex<T> const &orig ) 00066 { 00067 *dynamic_cast< AdvSimConstraint_Base_AvsB<T>* >( this ) = orig; 00068 m_uiVertexID_Model1 = orig.m_uiVertexID_Model1; 00069 m_pHEVertex_Model2 = orig.m_pHEVertex_Model2; 00070 return *this; 00071 } 00072 //----------------------------------------------------------------------------- 00073 00074 //----------------------------------------------------------------------------- 00075 template <typename T> 00076 void AdvSimConstraint_VertexIdVsHEVertex<T>::EnforceConstraint () 00077 { 00078 //PrtNotImplementedYet( "EnforceConstraint()" ); 00079 // Can't do enforcing, since the stored data is not enough. 00080 } 00081 //----------------------------------------------------------------------------- 00082 template <typename T> 00083 void AdvSimConstraint_VertexIdVsHEVertex<T>::ClearConstraint () 00084 { 00085 //PrtNotImplementedYet( "ClearConstraint()" ); 00086 // No need to clear, since the stored data does not really do any constraint. 00087 } 00088 //----------------------------------------------------------------------------- 00089 00090 00091 //----------------------------------------------------------------------------- 00092 #if defined(__gl_h_) || defined(__GL_H__) 00093 template <typename T> 00094 void AdvSimConstraint_VertexIdVsHEVertex<T>::Draw () const 00095 { 00096 Vector3<T> & ov = m_pHEVertex_Model2->RefToPosition(); 00097 glPushAttrib( GL_ALL_ATTRIB_BITS ); 00098 glDisable( GL_LIGHTING ); 00099 glColor3f( 1, 0, 0 ); 00100 glPointSize( 5 ); 00101 glBegin( GL_POINTS ); 00102 glVertex3fv( ov.GetDataFloat() ); 00103 glEnd(); 00104 glPopAttrib(); 00105 } 00106 #endif 00107 //----------------------------------------------------------------------------- 00108 //============================================================================= 00109 END_NAMESPACE_TAPs 00110 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00111 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----