void PlaneGCSSolver_Solver::addFictiveConstraintIfNecessary()
{
- if (!myConstraints.empty() &&
- myConstraints.find(CID_MOVEMENT) == myConstraints.end())
- return;
+ bool hasOnlyMovement = true;
+ for (ConstraintMap::iterator anIt = myConstraints.begin();
+ anIt != myConstraints.end() && hasOnlyMovement; ++anIt)
+ hasOnlyMovement = anIt->first == CID_MOVEMENT;
+ if (!hasOnlyMovement)
+ return; // regular constraints are available too
if (myFictiveConstraint)
return; // no need several fictive constraints
void PlaneGCSSolver_Solver::removeFictiveConstraint()
{
if (myFictiveConstraint) {
- myEquationSystem->removeConstraint(myFictiveConstraint);
+ myEquationSystem->clearByTag(myFictiveConstraint->getTag());
myParameters.pop_back();
GCS::VEC_pD aParams = myFictiveConstraint->params();
- for (GCS::VEC_pD::iterator anIt = aParams.begin(); anIt != aParams.end(); ++ anIt)
- delete *anIt;
+ for (GCS::VEC_pD::iterator anIt = aParams.begin(); anIt != aParams.end(); ++anIt) {
+ double* aPar = *anIt;
+ delete aPar;
+ }
delete myFictiveConstraint;
myFictiveConstraint = 0;
}