SketchSolver_Constraint::update();
}
+bool SketchSolver_ConstraintDistance::remove()
+{
+ removeConstraintsKeepingSign();
+ return SketchSolver_Constraint::remove();
+}
+
void SketchSolver_ConstraintDistance::addConstraintsToKeepSign()
{
std::shared_ptr<PlaneGCSSolver_Storage> aStorage =
void SketchSolver_ConstraintDistance::removeConstraintsKeepingSign()
{
+ if (!myOddPoint)
+ return; // no sign kept => nothing to remove
+
std::shared_ptr<PlaneGCSSolver_Storage> aStorage =
std::dynamic_pointer_cast<PlaneGCSSolver_Storage>(myStorage);
aParams.insert(myOddPoint->y);
aStorage->removeParameters(aParams);
- aGCSConstraints.pop_back();
- aGCSConstraints.pop_back();
+ // remove constraints keeping sign of point-line distance,
+ // not more than 2 additional constraints is possible
+ if (!aGCSConstraints.empty())
+ aGCSConstraints.pop_back();
+ if (!aGCSConstraints.empty())
+ aGCSConstraints.pop_back();
aConstraint->setConstraints(aGCSConstraints);
aStorage->addConstraint(myBaseConstraint, aConstraint);
+
+ myIsSigned = false;
}