From: azv Date: Wed, 8 Jun 2016 12:40:07 +0000 (+0300) Subject: Stable search of start vertex in SketchBuilder X-Git-Tag: V_2.4.0~127 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4b955ed4a21aefd4c8ef36fd5b99ede2b61d4dcc;p=modules%2Fshaper.git Stable search of start vertex in SketchBuilder --- diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp index 8096443c1..7ee838ba2 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp @@ -19,10 +19,13 @@ #include #include +#include static TopoDS_Vertex findStartVertex(const TopoDS_Shape& theShape) { + static const double aTol = Precision::PConfusion(); + TopExp_Explorer anExp(theShape, TopAbs_VERTEX); TopoDS_Vertex aStart = TopoDS::Vertex(anExp.Current()); gp_Pnt aStartPnt(BRep_Tool::Pnt(aStart)); @@ -32,10 +35,10 @@ static TopoDS_Vertex findStartVertex(const TopoDS_Shape& theShape) for (anExp.Next(); anExp.More(); anExp.Next()) { aCurrent = TopoDS::Vertex(anExp.Current()); aCurrentPnt = BRep_Tool::Pnt(aCurrent); - if ((aCurrentPnt.X() > aStartPnt.X()) || - (aCurrentPnt.X() == aStartPnt.X() && aCurrentPnt.Y() > aStartPnt.Y()) || - (aCurrentPnt.X() == aStartPnt.X() && aCurrentPnt.Y() == aStartPnt.Y() && - aCurrentPnt.Z() > aStartPnt.Z())) { + if ((aCurrentPnt.X() > aStartPnt.X() + aTol) || + (aCurrentPnt.X() > aStartPnt.X() - aTol && aCurrentPnt.Y() > aStartPnt.Y() + aTol) || + (aCurrentPnt.X() > aStartPnt.X() - aTol && aCurrentPnt.Y() > aStartPnt.Y() - aTol && + aCurrentPnt.Z() > aStartPnt.Z() + aTol)) { aStart = aCurrent; aStartPnt = aCurrentPnt; }