X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_SketchBuilder.cpp;h=3b3b4d5489c9180e3863883ad115cedc53a44bdd;hb=6247f2aee086ecb9ef0b81b922c8d544ded2cf7c;hp=8096443c1b2b2f6ff7bf613b3a336cfa0b612f2c;hpb=f433b07b58eb10ebfe657ec9116129840c0d88bf;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp index 8096443c1..3b3b4d548 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; } @@ -112,7 +115,7 @@ void GeomAlgoAPI_SketchBuilder::createFaces( if (!aStartFound) { const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current()); TopoDS_Vertex aV1, aV2; - TopExp::Vertices(anEdge, aV1, aV2); + TopExp::Vertices(anEdge, aV1, aV2, Standard_True); if (aV1.IsSame(aStartVertex) == Standard_True) aStartFound = true; else @@ -144,9 +147,9 @@ void GeomAlgoAPI_SketchBuilder::createFaces(const std::shared_ptr& const std::shared_ptr& theDirX, const std::shared_ptr& theNorm, const std::shared_ptr& theWire, - std::list >& theResultFaces) + std::list >& theResultFaces) { - std::shared_ptr aWire = + std::shared_ptr aWire = std::dynamic_pointer_cast(theWire); if(aWire) { // Filter wires, return only faces.