mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-29 10:50:35 +05:00
0020231: A min distance bug with torus and vertex
Make GetMinDistance() return 0.0 for a vertex inside a solid
This commit is contained in:
parent
6cd2571678
commit
4876a76c00
@ -89,21 +89,22 @@
|
||||
#include <gp_Lin.hxx>
|
||||
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
#include <ShapeAnalysis.hxx>
|
||||
#include <ShapeAnalysis_Surface.hxx>
|
||||
#include <GeomLProp_CLProps.hxx>
|
||||
#include <GeomLProp_SLProps.hxx>
|
||||
#include <ShapeAnalysis.hxx>
|
||||
#include <ShapeAnalysis_Surface.hxx>
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
|
||||
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <GeomAPI_IntSS.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <ShapeFix_Shape.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
|
||||
|
||||
//=============================================================================
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user