From: azv Date: Tue, 19 Dec 2017 07:41:55 +0000 (+0300) Subject: Issue #2374: SIGSEGV when adding a distance constraint on a circle center and another... X-Git-Tag: V_2.10.1~31 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3012077f57fffba56427829c17ff80a428f9a39d;p=modules%2Fshaper.git Issue #2374: SIGSEGV when adding a distance constraint on a circle center and another edge Fix incorrect projecting of circular shape when it is not in plane parallel to the sketch plane. --- diff --git a/src/SketchPlugin/SketchPlugin_Projection.cpp b/src/SketchPlugin/SketchPlugin_Projection.cpp index 4c6dfefc2..0f441f390 100644 --- a/src/SketchPlugin/SketchPlugin_Projection.cpp +++ b/src/SketchPlugin/SketchPlugin_Projection.cpp @@ -204,6 +204,10 @@ void SketchPlugin_Projection::computeProjection(const std::string& theID) std::shared_ptr aCircle = anEdge->circle(); double aRadius = aCircle->radius(); + double aNormalsDot = aCircle->normal()->dot(aSketchPlane->direction()); + if (fabs(fabs(aNormalsDot) - 1.0) > tolerance) + return; // circle is not in the plane, parallel to the sketch plane + std::shared_ptr aCenter = aSketchPlane->project(aCircle->center()); std::shared_ptr aCenterInSketch = sketch()->to2D(aCenter); @@ -227,7 +231,11 @@ void SketchPlugin_Projection::computeProjection(const std::string& theID) std::shared_ptr aCenter = aSketchPlane->project(aCircle->center()); std::shared_ptr aCenterInSketch = sketch()->to2D(aCenter); - bool isInversed = aCircle->normal()->dot(aSketchPlane->direction()) < 0.; + double aNormalsDot = aCircle->normal()->dot(aSketchPlane->direction()); + if (fabs(fabs(aNormalsDot) - 1.0) > tolerance) + return; // arc is not in the plane, parallel to the sketch plane + + bool isInversed = aNormalsDot < 0.; if (!hasPrevProj) aProjection = sketch()->addFeature(SketchPlugin_Arc::ID());