X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSketchPlugin%2FSketchPlugin_MacroEllipse.cpp;h=d11764a6004e94ca8467d9ea9e4fe56e24007464;hb=cdbbde4803e9c320204d537d22af4ac7ef024962;hp=2cf1cbc7f011bcf9ff4c7a6e314d46c57f395705;hpb=59d7c196ce4f5ed43cb550ee5caecd68676abfb3;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_MacroEllipse.cpp b/src/SketchPlugin/SketchPlugin_MacroEllipse.cpp index 2cf1cbc7f..d11764a60 100644 --- a/src/SketchPlugin/SketchPlugin_MacroEllipse.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroEllipse.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2019 CEA/DEN, EDF R&D +// Copyright (C) 2017-2021 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -44,6 +44,7 @@ #include #include +static const double TOLERANCE = 1.e-7; SketchPlugin_MacroEllipse::SketchPlugin_MacroEllipse() : SketchPlugin_SketchEntity(), @@ -169,6 +170,9 @@ void SketchPlugin_MacroEllipse::attributeChanged(const std::string& theID) anEllipsePoints[0]->setY(0.5 * (anEllipsePoints[0]->y() + anEllipsePoints[1]->y())); } + if (anEllipsePoints[0]->distance(anEllipsePoints[1]) < TOLERANCE) + return; // ellipse is not valid + std::shared_ptr anEllipse; if (aNbInitialized == 2) { GeomDir2dPtr aXDir(new GeomAPI_Dir2d(anEllipsePoints[1]->x() - anEllipsePoints[0]->x(),