X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FModuleBase%2FModuleBase_ViewerFilters.cpp;h=f92e3895e9ab363cdb63cb29d0a6b0b6f0f13fb9;hb=9aeb69897970e21212d6f8926ec33d2eb696f18d;hp=8ee95af0c03c8527e8b0081bc25bb9111ec29659;hpb=cbde248859fb0072f6012907391ea90cfc254574;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.cpp b/src/ModuleBase/ModuleBase_ViewerFilters.cpp index 8ee95af0c..f92e3895e 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.cpp +++ b/src/ModuleBase/ModuleBase_ViewerFilters.cpp @@ -13,6 +13,8 @@ #include #include +#include + #include #include #include @@ -89,20 +91,13 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk(const Handle(SelectMgr_Enti case TopAbs_VERTEX: { gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); - return aPlane.Distance(aPnt) < Precision::Confusion(); + return aPlane.SquareDistance(aPnt) < Precision::SquareConfusion(); } case TopAbs_EDGE: { - TopoDS_Edge aEdge = TopoDS::Edge(aShape); - Standard_Real aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aEdge, aFirst, aLast); - gp_Pnt aFirstPnt = aCurve->Value(aFirst); - gp_Pnt aMidPnt = aCurve->Value((aFirst + aLast) / 2.); - gp_Pnt aLastPnt = aCurve->Value(aLast); - bool aD1 = aPlane.Distance(aFirstPnt) < Precision::Confusion(); - bool aD2 = aPlane.Distance(aMidPnt) < Precision::Confusion(); - bool aD3 = aPlane.Distance(aLastPnt) < Precision::Confusion(); - return aD1 && aD2 && aD3; + std::shared_ptr anEdge(new GeomAPI_Edge); + anEdge->setImpl(new TopoDS_Shape(aShape)); + return anEdge->isInPlane(myPlane); } default: // The object can be selected in Object browser and contain, for example, compound.