1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Temporary patch to produce empty result in case of any invalidity (spikes, self-intersections, faces inversion).

This commit is contained in:
emv
2015-10-08 12:11:06 +03:00
parent ca4a7fa91d
commit fe25cda7b7

View File

@@ -1299,9 +1299,11 @@ void BRepOffset_MakeOffset::BuildSplitsOfFaces
// //
// split the face by the edges // split the face by the edges
if (!iCountE) { if (!iCountE) {
if (bLimited) {
aLFImages.Append(aF); aLFImages.Append(aF);
theImage.Bind(aF, aLFImages); theImage.Bind(aF, aLFImages);
aBB.Add(aFaces, aF); aBB.Add(aFaces, aF);
}
continue; continue;
} }
// //
@@ -1404,7 +1406,7 @@ void BRepOffset_MakeOffset::BuildSplitsOfFaces
// //
UpdateOrigins(theOrigins, aGF); UpdateOrigins(theOrigins, aGF);
// //
if (aLFImages.Extent() > 1) { if (aLFImages.Extent() >= 1) {
TopTools_ListOfShape aLFKeep; TopTools_ListOfShape aLFKeep;
// //
// check offset faces on the coincidence of the // check offset faces on the coincidence of the
@@ -2954,12 +2956,34 @@ void BRepOffset_MakeOffset::MakeShells()
aMV1.Perform(); aMV1.Perform();
bDone = (aMV1.ErrorStatus() == 0); bDone = (aMV1.ErrorStatus() == 0);
if (bDone) { if (bDone) {
//
TopoDS_Shape aResult = aMV1.Shape();
//
TopTools_IndexedMapOfShape aMFResult;
TopExp::MapShapes(aResult, TopAbs_FACE, aMFResult);
//
// check the result
Standard_Boolean bGood = Standard_True;
BOPCol_ListIteratorOfListOfShape aItLSF(aLSF);
for (; aItLSF.More(); aItLSF.Next()) {
const TopoDS_Shape& aFx = aItLSF.Value();
if (!aMFResult.Contains(aFx)) {
const TopTools_ListOfShape& aLFMx = aMV1.Modified(aFx);
if (aLFMx.IsEmpty()) {
bGood = Standard_False;
break;
}
}
}
//
TopoDS_Compound aShells; TopoDS_Compound aShells;
// //
aBB.MakeCompound(aShells); aBB.MakeCompound(aShells);
// //
TopoDS_Shape aResult = aMV1.Shape(); if (!bGood) {
// myOffsetShape = aShells;
}
else {
// collect images of the faces // collect images of the faces
TopTools_MapOfShape aMFaces; TopTools_MapOfShape aMFaces;
aNb = myFaces.Extent(); aNb = myFaces.Extent();
@@ -3075,6 +3099,7 @@ void BRepOffset_MakeOffset::MakeShells()
} }
} }
} }
}
// //
if (!bDone) { if (!bDone) {
BRepTools_Quilt Glue; BRepTools_Quilt Glue;
@@ -4126,17 +4151,16 @@ Standard_Boolean CheckBiNormals
const TopTools_IndexedDataMapOfShapeListOfShape& theOrigins, const TopTools_IndexedDataMapOfShapeListOfShape& theOrigins,
const TopTools_MapOfShape& theMFence, const TopTools_MapOfShape& theMFence,
Standard_Boolean& bKeep, Standard_Boolean& bKeep,
Standard_Boolean& bRem) Standard_Boolean& bRemove)
{ {
Standard_Boolean bChecked; Standard_Boolean bChecked;
Standard_Integer aNbEdgesChecked;
Standard_Real anAngle; Standard_Real anAngle;
TopTools_ListOfShape aLEInv;
// //
bKeep = Standard_False; aNbEdgesChecked = 0;
bRem = Standard_True;
bChecked = Standard_False;
// //
const TopoDS_Wire& aWIm = BRepTools::OuterWire(aFIm); const TopoDS_Wire& aWIm = BRepTools::OuterWire(aFIm);
//
TopExp_Explorer aExp(aWIm, TopAbs_EDGE); TopExp_Explorer aExp(aWIm, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) { for (; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aEIm = *(TopoDS_Edge*)&aExp.Current(); const TopoDS_Edge& aEIm = *(TopoDS_Edge*)&aExp.Current();
@@ -4152,7 +4176,6 @@ Standard_Boolean CheckBiNormals
const TopTools_ListOfShape& aLEOr = theOrigins.FindFromKey(aEIm); const TopTools_ListOfShape& aLEOr = theOrigins.FindFromKey(aEIm);
const TopoDS_Shape& aSOr = aLEOr.First(); const TopoDS_Shape& aSOr = aLEOr.First();
if (aSOr.ShapeType() != TopAbs_EDGE) { if (aSOr.ShapeType() != TopAbs_EDGE) {
bRem = Standard_False;
continue; continue;
} }
// //
@@ -4180,13 +4203,6 @@ Standard_Boolean CheckBiNormals
} }
} }
// //
if (theMFence.Contains(aEIm)) {
bChecked = Standard_True;
bKeep = Standard_True;
bRem = Standard_False;
break;
}
//
const TopoDS_Edge& aEOr = *(TopoDS_Edge*)&aLEOr.First(); const TopoDS_Edge& aEOr = *(TopoDS_Edge*)&aLEOr.First();
// //
TopoDS_Edge aEOrF; TopoDS_Edge aEOrF;
@@ -4206,19 +4222,44 @@ Standard_Boolean CheckBiNormals
continue; continue;
} }
// //
bChecked = Standard_True; ++aNbEdgesChecked;
// check coincidence of bi-normals //
anAngle = aDB1.Angle(aDB2); anAngle = aDB1.Angle(aDB2);
if (Abs(anAngle - M_PI) < Precision::Confusion()) { if (Abs(anAngle - M_PI) < Precision::Confusion()) {
bRem = bRem && Standard_True; aLEInv.Append(aEIm);
} }
else { }
bRem = Standard_False; //
bChecked = (aNbEdgesChecked > 0);
if (!bChecked) {
return bChecked;
}
//
// decide whether to remove the split face or not
bKeep = Standard_True; bKeep = Standard_True;
bRemove = Standard_False;
//
if (aLEInv.IsEmpty()) {
return bChecked;
}
//
TopTools_ListIteratorOfListOfShape aItLS(aLEInv);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aE = aItLS.Value();
if (theMFence.Contains(aE)) {
bKeep = Standard_False;
bRemove = Standard_True;
break; break;
} }
} }
// //
if (!bRemove) {
if (aNbEdgesChecked == aLEInv.Extent()) {
bKeep = Standard_False;
bRemove = Standard_True;
}
}
//
return bChecked; return bChecked;
} }