@@ -76,7 +76,7 @@ void MORUnilateralInteractionConstraint<DataTypes>::buildConstraintMatrix(const
7676 c1_it.addCol (c.m1 , -c.norm );
7777 c1_it.addCol (c.m2 , c.norm );
7878
79- if (c.mu > 0.0 )
79+ if (c.parameters . hasTangentialComponent () )
8080 {
8181 c1_it = c1.writeLine (c.id + 1 );
8282 c1_it.setCol (c.m1 , -c.t );
@@ -108,16 +108,16 @@ void MORUnilateralInteractionConstraint<DataTypes>::buildConstraintMatrix(const
108108 for (unsigned int i = 0 ; i < contacts.size (); i++)
109109 {
110110 auto & c = contacts[i];
111- myMuForAllContacts = c.mu ;
111+ myMuForAllContacts = c.parameters . mu ;
112112 c.id = i;
113- if (c. mu == 0.0 )
113+ if (!c. parameters . hasTangentialComponent () )
114114 if (contactIndices (c.m2 ) != -1 && lambdaModes (contactIndices (c.m2 ),numMode)!=0.0 ){
115115 c1_it.addCol (c.m1 , -lambdaModes (contactIndices (c.m2 ),numMode)*c.norm );
116116 c2_it.addCol (c.m2 , lambdaModes (contactIndices (c.m2 ),numMode)*c.norm );
117117 somethingAdded = true ;
118118 }
119119
120- if (c.mu > 0.0 )
120+ if (c.parameters . hasTangentialComponent () )
121121 {
122122 if (contactIndices (3 *c.m2 ) != -1 && lambdaModes (contactIndices (3 *c.m2 ),numMode)!=0.0 ){
123123 c1_it.addCol (c.m1 , -lambdaModes (contactIndices (3 *c.m2 ),numMode)*c.norm );
@@ -176,27 +176,6 @@ void MORUnilateralInteractionConstraint<DataTypes>::buildConstraintMatrix(const
176176// contactId = contactId - 3;
177177}
178178
179- template <class DataTypes >
180- void MORUnilateralInteractionConstraint<DataTypes>::getConstraintViolation(const core::ConstraintParams *cparams, linearalgebra::BaseVector *v, const DataVecCoord &, const DataVecCoord &
181- , const DataVecDeriv &, const DataVecDeriv &)
182- {
183- switch (cparams->constOrder ())
184- {
185- case core::ConstraintParams::POS_AND_VEL :
186- case core::ConstraintParams::POS :
187- getPositionViolation (v);
188- break ;
189-
190- case core::ConstraintParams::ACC :
191- case core::ConstraintParams::VEL :
192- UnilateralLagrangianConstraint<DataTypes>::getVelocityViolation (v);
193- break ;
194-
195- default :
196- msg_error () << this ->getClassName () << " doesn't implement " << cparams->getName () << " constraint violation" ;
197- break ;
198- }
199- }
200179
201180template <class DataTypes >
202181void MORUnilateralInteractionConstraint<DataTypes>::getPositionViolation(linearalgebra::BaseVector *v)
@@ -265,7 +244,7 @@ void MORUnilateralInteractionConstraint<DataTypes>::getPositionViolation(lineara
265244 }
266245
267246 // Sets dfree in global violation vector
268- if (c. mu == 0.0 ){
247+ if (!c. parameters . hasTangentialComponent () ){
269248
270249 for (int k=0 ;k<reducedContacts.size ();k++){
271250 if (contactIndices (c.m2 ) != -1 )
@@ -312,10 +291,10 @@ void MORUnilateralInteractionConstraint<DataTypes>::getConstraintResolution(cons
312291 for (unsigned int i=0 ; i<reducedContacts.size (); i++)
313292 {
314293 auto & c = contacts[0 ];
315- if (c.mu > 0.0 )
294+ if (c.parameters . hasTangentialComponent () )
316295 {
317296 i = i+2 ;
318- UnilateralConstraintResolutionWithFriction* ucrwf = new UnilateralConstraintResolutionWithFriction (c.mu , nullptr , &contactsStatus[i]);
297+ UnilateralConstraintResolutionWithFriction* ucrwf = new UnilateralConstraintResolutionWithFriction (c.parameters . mu , nullptr , &contactsStatus[i]);
319298 ucrwf->setTolerance (customTolerance);
320299 resTab[offset] = ucrwf;
321300 // TODO : cette méthode de stockage des forces peu mal fonctionner avec 2 threads quand on utilise l'haptique
0 commit comments