Sketcher: Fix symmetry of slot redundancy false positive (#26604)
* Sketcher: Fix symmetry of slot redundancy false positive Perturb symmetric geometries when using the 'create symmetric constraints' option to avoid numerical singularities in the solver (Jacobian Rank). If geometry is "perfect", the solver cannot distinguish between the derivative of a Symmetry constraint and an Equal constraint, flagging one as redundant.
This commit is contained in:
@@ -4385,6 +4385,21 @@ int SketchObject::addSymmetric(
|
||||
std::vector<Part::Geometry*> symgeos
|
||||
= getSymmetric(geoIdList, geoIdMap, isStartEndInverted, refGeoId, refPosId);
|
||||
|
||||
// Perturb geometry to avoid numerical singularities in the solver (Jacobian Rank).
|
||||
// If geometry is "perfect", the solver cannot distinguish between the derivative
|
||||
// of a Symmetry constraint and an Equal constraint, flagging one as redundant.
|
||||
// see https://github.com/FreeCAD/FreeCAD/issues/13551
|
||||
// This does not happen with other arcs types.
|
||||
if (addSymmetryConstraints) {
|
||||
for (auto* geo : symgeos) {
|
||||
if (auto* arc = dynamic_cast<Part::GeomArcOfCircle*>(geo)) {
|
||||
double start, end;
|
||||
arc->getRange(start, end, true);
|
||||
arc->setRange(start + Precision::Angular(), end, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
addGeometry(symgeos);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user