1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0025583: Wrong solid is considered as valid by checkshape

Limitation tolerance value for checking if wire is closed in 2D-space of its face.

Some test cases were updated according to their new behavior.
This commit is contained in:
nbv
2014-12-11 15:28:08 +03:00
parent 4cf9a9f0ea
commit 1dc7891a20
3 changed files with 84 additions and 57 deletions

View File

@@ -394,31 +394,31 @@ Standard_Boolean IsDistanceIn3DTolerance (const gp_Pnt& thePnt_f,
} }
//======================================================================= //=======================================================================
//function : IsDistanceIn3DTolerance //function : IsDistanceIn2DTolerance
//purpose : //purpose :
//======================================================================= //=======================================================================
static static
Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurface, Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurface,
const gp_Pnt2d& thePnt, const gp_Pnt2d& thePnt,
const gp_Pnt2d& thePntRef, const gp_Pnt2d& thePntRef,
const Standard_Real aTol3d, const Standard_Real aTol3d)
#ifdef OCCT_DEBUG
const Standard_Boolean PrintWarnings = Standard_True)
#else
const Standard_Boolean = Standard_True)
#endif
{ {
Standard_Real dumax = 0.01 * (aFaceSurface.LastUParameter() - aFaceSurface.FirstUParameter()); const Standard_Real aFactor = 0.01;
Standard_Real dvmax = 0.01 * (aFaceSurface.LastVParameter() - aFaceSurface.FirstVParameter()); Standard_Real dumax = (aFaceSurface.LastUParameter() - aFaceSurface.FirstUParameter());
Standard_Real dvmax = (aFaceSurface.LastVParameter() - aFaceSurface.FirstVParameter());
Standard_Real dumin = Abs(thePnt.X() - thePntRef.X()); Standard_Real dumin = Abs(thePnt.X() - thePntRef.X());
Standard_Real dvmin = Abs(thePnt.Y() - thePntRef.Y()); Standard_Real dvmin = Abs(thePnt.Y() - thePntRef.Y());
if((dumin < dumax) && (dvmin < dvmax)) if((dumin < (aFactor*dumax)) && (dvmin < (aFactor*dvmax)))
return Standard_True; return Standard_True;
dumin = dumax;
dvmin = dvmax;
dumax = dvmax = aTol3d;
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if(PrintWarnings)
{
cout << endl; cout << endl;
cout << "--------Function IsDistanceIn2DTolerance(...)----------" << endl; cout << "--------Function IsDistanceIn2DTolerance(...)----------" << endl;
cout << "--- BRepCheck Wire: Not closed in 2D" << endl; cout << "--- BRepCheck Wire: Not closed in 2D" << endl;
@@ -432,27 +432,42 @@ Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurfac
cout << "; ULast = " << aFaceSurface.LastUParameter() << endl; cout << "; ULast = " << aFaceSurface.LastUParameter() << endl;
cout << "VFirst = " << aFaceSurface.FirstVParameter(); cout << "VFirst = " << aFaceSurface.FirstVParameter();
cout << "; VLast = " << aFaceSurface.LastVParameter() << endl; cout << "; VLast = " << aFaceSurface.LastVParameter() << endl;
dumax = aFaceSurface.UResolution(dumax);
dvmax = aFaceSurface.VResolution(dvmax);
if(dumax >= dumin)
{//Singular case
dumax = 0.0;
} }
dumax = aFaceSurface.UResolution(aTol3d); if(dvmax >= dvmin)
dvmax = aFaceSurface.VResolution(aTol3d); {//Singular case
dvmax = 0.0;
}
if(PrintWarnings)
{
cout << "aTol3d = " << aTol3d <<"; URes = " << dumax << "; VRes = " << dvmax << endl; cout << "aTol3d = " << aTol3d <<"; URes = " << dumax << "; VRes = " << dvmax << endl;
cout << "thePnt(" << thePnt.X() << "; " << thePnt.Y() << ")" << endl; cout << "thePnt(" << thePnt.X() << "; " << thePnt.Y() << ")" << endl;
cout << "thePntRef(" << thePntRef.X() << "; " << thePntRef.Y() << ")" << endl; cout << "thePntRef(" << thePntRef.X() << "; " << thePntRef.Y() << ")" << endl;
#else
dumax = aFaceSurface.UResolution(dumax);
dvmax = aFaceSurface.VResolution(dvmax);
if(dumax >= dumin)
{//Singular case
dumax = 0.0;
} }
#else if(dvmax >= dvmin)
dumax = aFaceSurface.UResolution(aTol3d); {//Singular case
dvmax = aFaceSurface.VResolution(aTol3d); dvmax = 0.0;
}
#endif #endif
Standard_Real aTol2d = 2*Max( dumax, dvmax); Standard_Real aTol2d = 2*Max(dumax, dvmax);
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if((aTol2d <= 0.0) && (PrintWarnings)) if(aTol2d <= 0.0)
{ {
cout<<"BRepCheck_Wire : UResolution and VResolution = 0.0 (Face too small ?)"<<endl; cout<<"BRepCheck_Wire : UResolution and VResolution = 0.0 (Face too small ?)"<<endl;
cout.flush(); cout.flush();
@@ -466,8 +481,6 @@ Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurfac
return Standard_True; return Standard_True;
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if(PrintWarnings)
{
cout << endl; cout << endl;
cout << "--------Function IsDistanceIn2DTolerance(...)----------" << endl; cout << "--------Function IsDistanceIn2DTolerance(...)----------" << endl;
cout << "--- BRepCheck Wire: Not closed in 2d" << endl; cout << "--- BRepCheck Wire: Not closed in 2d" << endl;
@@ -477,7 +490,6 @@ Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurfac
cout << "aTol3d = " << aTol3d <<"; URes = " << dumax << "; VRes = " << dvmax << endl; cout << "aTol3d = " << aTol3d <<"; URes = " << dumax << "; VRes = " << dvmax << endl;
cout << "thePnt(" << thePnt.X() << "; " << thePnt.Y() << ")" << endl; cout << "thePnt(" << thePnt.X() << "; " << thePnt.Y() << ")" << endl;
cout << "thePntRef(" << thePntRef.X() << "; " << thePntRef.Y() << ")" << endl; cout << "thePntRef(" << thePntRef.X() << "; " << thePntRef.Y() << ")" << endl;
}
#endif #endif
return Standard_False; return Standard_False;
@@ -606,7 +618,22 @@ BRepCheck_Status BRepCheck_Wire::Closed2d(const TopoDS_Face& theFace,
// aUResol = 2*aFaceSurface.UResolution(aTol); // aUResol = 2*aFaceSurface.UResolution(aTol);
// aVResol = 2*aFaceSurface.VResolution(aTol); // aVResol = 2*aFaceSurface.VResolution(aTol);
Standard_Real aTol3d = Max(BRep_Tool::Tolerance(aFirstVertex),BRep_Tool::Tolerance(aWireExp.CurrentVertex()));
// get first point // get first point
if(aNbFoundEdges == 1)
{
BRep_Tool::UVPoints(aFirstEdge, theFace, aP_first, aP_last);
if(!IsDistanceIn2DTolerance(aFaceSurface, aP_first, aP_last, aTol3d))
{
aClosedStat = BRepCheck_NotClosed;
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
}
if (aFirstEdge.Orientation() == TopAbs_REVERSED) if (aFirstEdge.Orientation() == TopAbs_REVERSED)
BRep_Tool::UVPoints(aFirstEdge, theFace, aP_temp, aP_first); BRep_Tool::UVPoints(aFirstEdge, theFace, aP_temp, aP_first);
else else
@@ -630,8 +657,6 @@ BRepCheck_Status BRepCheck_Wire::Closed2d(const TopoDS_Face& theFace,
// if (dfUDist > aUResol || dfVDist > aVResol) // if (dfUDist > aUResol || dfVDist > aVResol)
// { // {
Standard_Real aTol3d = Max(BRep_Tool::Tolerance(aFirstVertex),BRep_Tool::Tolerance(aWireExp.CurrentVertex()));
gp_Pnt aPntRef = BRep_Tool::Pnt(aFirstVertex); gp_Pnt aPntRef = BRep_Tool::Pnt(aFirstVertex);
gp_Pnt aPnt = BRep_Tool::Pnt(aWireExp.CurrentVertex()); gp_Pnt aPnt = BRep_Tool::Pnt(aWireExp.CurrentVertex());
@@ -1653,7 +1678,7 @@ void ChoixUV(const TopoDS_Vertex& theVertex,
aParam =(aVOrientation != anE.Orientation()) ? aFirstParam : aLastParam; aParam =(aVOrientation != anE.Orientation()) ? aFirstParam : aLastParam;
aPnt = C2d->Value(aParam); aPnt = C2d->Value(aParam);
if(!IsDistanceIn2DTolerance(aFaceSurface, aPnt, aPntRef, aTol3d, Standard_False)) if(!IsDistanceIn2DTolerance(aFaceSurface, aPnt, aPntRef, aTol3d))
continue; continue;
CurveDirForParameter(C2d, aParam, aPnt, aDer); CurveDirForParameter(C2d, aParam, aPnt, aDer);

View File

@@ -1,5 +1,7 @@
# !!!! This file is generated automatically, do not edit manually! See end script # !!!! This file is generated automatically, do not edit manually! See end script
puts "TODO CR23096 ALL: STATSHAPE : Faulty" puts "TODO CR23096 ALL: STATSHAPE : Faulty"
puts "TODO CR12345 ALL: CHECKSHAPE : Faulty"
set LinuxDiff 2 set LinuxDiff 2
set LinuxFaulties {STATSHAPE} set LinuxFaulties {STATSHAPE}
@@ -8,7 +10,7 @@ set filename bm1_pe_t4.stp
set ref_data { set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 ) DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
TPSTAT : Faulties = 0 ( 2 ) Warnings = 19 ( 27 ) Summary = 19 ( 29 ) TPSTAT : Faulties = 0 ( 2 ) Warnings = 19 ( 27 ) Summary = 19 ( 29 )
CHECKSHAPE : Wires = 2 ( 3 ) Faces = 2 ( 3 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) CHECKSHAPE : Wires = 4 ( 3 ) Faces = 4 ( 3 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 13 ( 12 ) Face = 16 ( 15 ) Summary = 154 ( 151 ) NBSHAPES : Solid = 0 ( 0 ) Shell = 13 ( 12 ) Face = 16 ( 15 ) Summary = 154 ( 151 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 13 ( 12 ) Face = 16 ( 15 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 59 ( 60 ) STATSHAPE : Solid = 0 ( 0 ) Shell = 13 ( 12 ) Face = 16 ( 15 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 59 ( 60 )
TOLERANCE : MaxTol = 1562.051497 ( 1562.051497 ) AvgTol = 192.5735494 ( 206.7634854 ) TOLERANCE : MaxTol = 1562.051497 ( 1562.051497 ) AvgTol = 192.5735494 ( 206.7634854 )

View File

@@ -4,7 +4,7 @@ set filename bm1_pe_fuel.stp
set ref_data { set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 ) DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
TPSTAT : Faulties = 0 ( 0 ) Warnings = 8 ( 8 ) Summary = 8 ( 8 ) TPSTAT : Faulties = 0 ( 0 ) Warnings = 8 ( 8 ) Summary = 8 ( 8 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) CHECKSHAPE : Wires = 4 ( 4 ) Faces = 4 ( 4 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 6 ( 6 ) Face = 10 ( 10 ) Summary = 89 ( 89 ) NBSHAPES : Solid = 0 ( 0 ) Shell = 6 ( 6 ) Face = 10 ( 10 ) Summary = 89 ( 89 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 6 ( 6 ) Face = 10 ( 10 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 34 ( 34 ) STATSHAPE : Solid = 0 ( 0 ) Shell = 6 ( 6 ) Face = 10 ( 10 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 34 ( 34 )
TOLERANCE : MaxTol = 112.7632273 ( 112.7632273 ) AvgTol = 20.07582429 ( 20.07582429 ) TOLERANCE : MaxTol = 112.7632273 ( 112.7632273 ) AvgTol = 20.07582429 ( 20.07582429 )