X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_ConstraintCoincidence.cpp;h=18594018c4f38fe3c38f00aa468eae76d1d478d2;hb=4f565b2204d3fba046aa8c851abada2a5a17bf6c;hp=b10d7e95d44f25e14850f441cd45410275752e05;hpb=29d446f4dd2969d80087745fe44adb5638d13de7;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp index b10d7e95d..18594018c 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + #include #include #include @@ -14,6 +16,12 @@ void SketchSolver_ConstraintCoincidence::getAttributes( if (theAttributes[1]) { myType = CONSTRAINT_PT_PT_COINCIDENT; + if (myStorage->isFixed(theAttributes[1]) && !myStorage->isFixed(theAttributes[0])) { + // fixed point should go first + EntityWrapperPtr aTemp = theAttributes[0]; + theAttributes[0] = theAttributes[1]; + theAttributes[1] = aTemp; + } // Set the slave (second) point the same as master (first) point. // This will allow to skip adding point-point coincidence to the set of constraints // and give us speed-up in solving the set of equations @@ -31,28 +39,3 @@ void SketchSolver_ConstraintCoincidence::getAttributes( } else myErrorMsg = SketchSolver_Error::INCORRECT_ATTRIBUTE(); } - - -static bool isBase(const std::list& theConstraints, AttributePtr theAttribute) -{ - AttributePtr anAttribute = theAttribute; - FeaturePtr aFeature; - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); - if (aRefAttr) { - if (aRefAttr->isObject()) - aFeature = ModelAPI_Feature::feature(aRefAttr->object()); - else - anAttribute = aRefAttr->attr(); - } - - std::list::const_iterator aCIt = theConstraints.begin(); - for (; aCIt != theConstraints.end(); ++aCIt) { - std::list aSubs = (*aCIt)->entities(); - std::list::const_iterator aSIt = aSubs.begin(); - for (; aSIt != aSubs.end(); ++aSIt) - if ((aFeature && (*aSIt)->isBase(aFeature)) || - (!aFeature && (*aSIt)->isBase(anAttribute))) - return true; - } - return false; -}