X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Vertex.cpp;h=5025a6aaa75846722e73d765f7f7d2f8f6ea9f6c;hb=922c5eceb93e68e87e6e4d22583de0d1f25ff483;hp=683413c63e9a2aa92cdc35af97daa64a06464f29;hpb=97917d3698f5a2f7fc9596e7c755ff8f6751e373;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Vertex.cpp b/src/GeomAPI/GeomAPI_Vertex.cpp index 683413c63..5025a6aaa 100644 --- a/src/GeomAPI/GeomAPI_Vertex.cpp +++ b/src/GeomAPI/GeomAPI_Vertex.cpp @@ -75,3 +75,23 @@ bool GeomAPI_Vertex::isEqual(const std::shared_ptr theVert) const return aPoint1.IsEqual(aPoint2, Precision::Confusion()) == Standard_True; } + + + +bool GeomAPI_Vertex::GeometricComparator::operator()(const GeomVertexPtr& theVertex1, + const GeomVertexPtr& theVertex2) const +{ + const TopoDS_Vertex& aVertex1 = theVertex1->impl(); + const TopoDS_Vertex& aVertex2 = theVertex2->impl(); + + gp_Pnt aPnt1 = BRep_Tool::Pnt(aVertex1); + gp_Pnt aPnt2 = BRep_Tool::Pnt(aVertex2); + + bool isLess = aPnt1.X() + myTolerance < aPnt2.X(); + if (!isLess && aPnt1.X() <= aPnt2.X() + myTolerance) { + isLess = aPnt1.Y() + myTolerance < aPnt2.Y(); + if (!isLess && aPnt1.Y() <= aPnt2.Y() + myTolerance) + isLess = aPnt1.Z() + myTolerance < aPnt2.Z(); + } + return isLess; +}