X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMImpl%2FGEOMImpl_IMeasureOperations.cxx;h=61237649dd99e215c48670bbd212643a859f1fc2;hb=466b88c4094ff915584fa3f4b7eabe7d2559ae10;hp=d772458387e1e2c5d1f9a07b09452c558b428978;hpb=392885c1a8d50369708bbe5e6b44033ed8b8ba51;p=modules%2Fgeom.git diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx index d77245838..61237649d 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx @@ -89,21 +89,22 @@ #include #include -#include -#include #include #include +#include +#include #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC +#include +#include #include +#include #include #include -#include -#include -#include #include +#include //============================================================================= @@ -1644,6 +1645,34 @@ Standard_Real GEOMImpl_IMeasureOperations::GetMinDistance OCC_CATCH_SIGNALS; #endif + // Issue 0020231: A min distance bug with torus and vertex. + // Make GetMinDistance() return zero if a sole VERTEX is inside any of SOLIDs + + // which of shapes consists of only one vertex? + TopExp_Explorer exp1(aShape1,TopAbs_VERTEX), exp2(aShape2,TopAbs_VERTEX); + TopoDS_Shape V1 = exp1.More() ? exp1.Current() : TopoDS_Shape(); + TopoDS_Shape V2 = exp2.More() ? exp2.Current() : TopoDS_Shape(); + exp1.Next(); exp2.Next(); + if ( exp1.More() ) V1.Nullify(); + if ( exp2.More() ) V2.Nullify(); + // vertex and container of solids + TopoDS_Shape V = V1.IsNull() ? V2 : V1; + TopoDS_Shape S = V1.IsNull() ? aShape1 : aShape2; + if ( !V.IsNull() ) { + // classify vertex against solids + gp_Pnt p = BRep_Tool::Pnt( TopoDS::Vertex( V ) ); + for ( exp1.Init( S, TopAbs_SOLID ); exp1.More(); exp1.Next() ) { + BRepClass3d_SolidClassifier classifier( exp1.Current(), p, 1e-6); + if ( classifier.State() == TopAbs_IN ) { + p.Coord(X1, Y1, Z1); + p.Coord(X2, Y2, Z2); + SetErrorCode(OK); + return 0.0; + } + } + } + // End Issue 0020231 + // skl 30.06.2008 // additional workaround for bugs 19899, 19908 and 19910 from Mantis gp_Pnt Ptmp1, Ptmp2;