1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-09 18:50:54 +03:00

0031734: Modeling Algorithms - Incorrect result of offset operation in mode "Complete" join type "Intersection"

BRepOffset_MakeOffset_1::IntersectFaces - Build intersection pairs for rebuilding process basing on the intersection results and removed faces.
This commit is contained in:
emv 2020-08-26 08:10:42 +03:00 committed by bugmaster
parent d99f0355e3
commit 6f04cbb1fb
7 changed files with 353 additions and 31 deletions

View File

@ -106,6 +106,16 @@ static
TopTools_DataMapOfShapeShape& theOrigins, TopTools_DataMapOfShapeShape& theOrigins,
TopTools_ListOfShape& theLFImages); TopTools_ListOfShape& theLFImages);
//! Auxiliary structure to contain intersection information
struct BRepOffset_MakeOffset_InterResults
{
TopTools_DataMapOfShapeListOfShape SSInterfs; //!< Intersection information, used to add pair for intersection
NCollection_DataMap <TopoDS_Shape,
BRepOffset_DataMapOfShapeMapOfShape,
TopTools_ShapeMapHasher> InterPairs; //!< All possible intersection pairs, used to avoid
//! some of the intersection
};
static static
void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF, void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
const TopTools_MapOfShape& theModifiedEdges, const TopTools_MapOfShape& theModifiedEdges,
@ -126,7 +136,7 @@ static
TopTools_IndexedDataMapOfShapeListOfShape& theFImages, TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopTools_DataMapOfShapeListOfShape& theDMFNewHoles, TopTools_DataMapOfShapeListOfShape& theDMFNewHoles,
TopoDS_Shape& theSolids, TopoDS_Shape& theSolids,
TopTools_DataMapOfShapeListOfShape& theSSInterfs); BRepOffset_MakeOffset_InterResults& theIntRes);
static static
void BuildSplitsOfInvFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild, void BuildSplitsOfInvFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild,
@ -263,7 +273,7 @@ static
const TopTools_IndexedMapOfShape& theMFToCheckInt, const TopTools_IndexedMapOfShape& theMFToCheckInt,
const TopTools_IndexedMapOfShape& theMFInvInHole, const TopTools_IndexedMapOfShape& theMFInvInHole,
const TopoDS_Shape& theFHoles, const TopoDS_Shape& theFHoles,
TopTools_DataMapOfShapeListOfShape& theSSInterfs, BRepOffset_MakeOffset_InterResults& theIntRes,
TopTools_IndexedMapOfShape& theMERemoved, TopTools_IndexedMapOfShape& theMERemoved,
TopTools_IndexedMapOfShape& theMEInside, TopTools_IndexedMapOfShape& theMEInside,
TopoDS_Shape& theSolids); TopoDS_Shape& theSolids);
@ -336,7 +346,7 @@ static
void RebuildFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild, void RebuildFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild,
const TopTools_MapOfShape& theFSelfRebAvoid, const TopTools_MapOfShape& theFSelfRebAvoid,
const TopoDS_Shape& theSolids, const TopoDS_Shape& theSolids,
const TopTools_DataMapOfShapeListOfShape& theSSInterfs, const BRepOffset_MakeOffset_InterResults& theIntRes,
const BRepOffset_Analyse* theAnalyse, const BRepOffset_Analyse* theAnalyse,
TopTools_IndexedDataMapOfShapeListOfShape& theFImages, TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopTools_DataMapOfShapeListOfShape& theDMFNewHoles, TopTools_DataMapOfShapeListOfShape& theDMFNewHoles,
@ -360,7 +370,7 @@ static
void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild, void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild,
const TopTools_MapOfShape& theFSelfRebAvoid, const TopTools_MapOfShape& theFSelfRebAvoid,
const TopoDS_Shape& theSolids, const TopoDS_Shape& theSolids,
const TopTools_DataMapOfShapeListOfShape& theSSInterfs, const BRepOffset_MakeOffset_InterResults& theIntRes,
TopTools_IndexedDataMapOfShapeListOfShape& theFImages, TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopTools_DataMapOfShapeListOfShape& theEdgesOrigins, TopTools_DataMapOfShapeListOfShape& theEdgesOrigins,
TopTools_DataMapOfShapeListOfShape& theOEImages, TopTools_DataMapOfShapeListOfShape& theOEImages,
@ -723,7 +733,7 @@ void BRepOffset_MakeOffset::BuildSplitsOfExtendedFaces(const TopTools_ListOfShap
// but may be filled on the following rebuilding steps // but may be filled on the following rebuilding steps
TopTools_DataMapOfShapeShape anArtInvFaces; TopTools_DataMapOfShapeShape anArtInvFaces;
// shapes connections for using in rebuilding // shapes connections for using in rebuilding
TopTools_DataMapOfShapeListOfShape aSSInterfs; BRepOffset_MakeOffset_InterResults aIntRes;
// edges to avoid on second steps // edges to avoid on second steps
TopTools_MapOfShape aLastInvEdges; TopTools_MapOfShape aLastInvEdges;
// keep information of already invalid faces to avoid // keep information of already invalid faces to avoid
@ -737,18 +747,18 @@ void BRepOffset_MakeOffset::BuildSplitsOfExtendedFaces(const TopTools_ListOfShap
BuildSplitsOfFaces(theLF, aNewEdges, theEdgesOrigins, &theAnalyse, theAsDes, theFacesOrigins, BuildSplitsOfFaces(theLF, aNewEdges, theEdgesOrigins, &theAnalyse, theAsDes, theFacesOrigins,
anOEImages, anOEOrigins, aLastInvEdges, anEdgesToAvoid, anInvEdges, aValidEdges, anOEImages, anOEOrigins, aLastInvEdges, anEdgesToAvoid, anInvEdges, aValidEdges,
anInvertedEdges, anAlreadyInvFaces, anInvFaces, anArtInvFaces, aFImages, anInvertedEdges, anAlreadyInvFaces, anInvFaces, anArtInvFaces, aFImages,
aDMFNewHoles, aSolids, aSSInterfs); aDMFNewHoles, aSolids, aIntRes);
// //
// Find faces to rebuild // Find faces to rebuild
if (anInvFaces.Extent()) { if (anInvFaces.Extent()) {
TopTools_IndexedDataMapOfShapeListOfShape aFToRebuild; TopTools_IndexedDataMapOfShapeListOfShape aFToRebuild;
TopTools_MapOfShape aFSelfRebAvoid; TopTools_MapOfShape aFSelfRebAvoid;
FindFacesToRebuild(aFImages, anInvEdges, anInvFaces, aSSInterfs, aFToRebuild, aFSelfRebAvoid); FindFacesToRebuild(aFImages, anInvEdges, anInvFaces, aIntRes.SSInterfs, aFToRebuild, aFSelfRebAvoid);
// //
if (aFToRebuild.Extent()) { if (aFToRebuild.Extent()) {
// vertices to avoid // vertices to avoid
TopTools_MapOfShape aVAEmpty; TopTools_MapOfShape aVAEmpty;
RebuildFaces(aFToRebuild, aFSelfRebAvoid, aSolids, aSSInterfs, &theAnalyse, aFImages, aDMFNewHoles, RebuildFaces(aFToRebuild, aFSelfRebAvoid, aSolids, aIntRes, &theAnalyse, aFImages, aDMFNewHoles,
theEdgesOrigins, theFacesOrigins, anOEImages, anOEOrigins, aLastInvEdges, theEdgesOrigins, theFacesOrigins, anOEImages, anOEOrigins, aLastInvEdges,
anEdgesToAvoid, anInvEdges, aValidEdges, anInvertedEdges, anAlreadyInvFaces, anEdgesToAvoid, anInvEdges, aValidEdges, anInvertedEdges, anAlreadyInvFaces,
anInvFaces, anArtInvFaces, aVAEmpty, theETrimEInf, theAsDes); anInvFaces, anArtInvFaces, aVAEmpty, theETrimEInf, theAsDes);
@ -805,22 +815,22 @@ void BuildSplitsOfInvFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theF
// inverted edges // inverted edges
TopTools_MapOfShape anInvertedEdges; TopTools_MapOfShape anInvertedEdges;
// shapes connection for using in rebuilding process // shapes connection for using in rebuilding process
TopTools_DataMapOfShapeListOfShape aSSInterfs; BRepOffset_MakeOffset_InterResults aIntRes;
// //
TopoDS_Shape aSolids; TopoDS_Shape aSolids;
// //
BuildSplitsOfFaces(aLF, theModifiedEdges, theEdgesOrigins, theAnalyse, theAsDes, theFacesOrigins, BuildSplitsOfFaces(aLF, theModifiedEdges, theEdgesOrigins, theAnalyse, theAsDes, theFacesOrigins,
theOEImages, theOEOrigins, theLastInvEdges, theEdgesToAvoid, anInvEdges, theValidEdges, theOEImages, theOEOrigins, theLastInvEdges, theEdgesToAvoid, anInvEdges, theValidEdges,
anInvertedEdges, theAlreadyInvFaces, anInvFaces, anArtInvFaces, theFImages, anInvertedEdges, theAlreadyInvFaces, anInvFaces, anArtInvFaces, theFImages,
theDMFNewHoles, aSolids, aSSInterfs); theDMFNewHoles, aSolids, aIntRes);
// //
if (anInvFaces.Extent()) { if (anInvFaces.Extent()) {
TopTools_IndexedDataMapOfShapeListOfShape aFToRebuild; TopTools_IndexedDataMapOfShapeListOfShape aFToRebuild;
TopTools_MapOfShape aFSelfRebAvoid; TopTools_MapOfShape aFSelfRebAvoid;
FindFacesToRebuild(theFImages, anInvEdges, anInvFaces, aSSInterfs, aFToRebuild, aFSelfRebAvoid); FindFacesToRebuild(theFImages, anInvEdges, anInvFaces, aIntRes.SSInterfs, aFToRebuild, aFSelfRebAvoid);
// //
if (aFToRebuild.Extent()) { if (aFToRebuild.Extent()) {
RebuildFaces(aFToRebuild, aFSelfRebAvoid, aSolids, aSSInterfs, theAnalyse, theFImages, theDMFNewHoles, RebuildFaces(aFToRebuild, aFSelfRebAvoid, aSolids, aIntRes, theAnalyse, theFImages, theDMFNewHoles,
theEdgesOrigins, theFacesOrigins, theOEImages, theOEOrigins, theLastInvEdges, theEdgesOrigins, theFacesOrigins, theOEImages, theOEOrigins, theLastInvEdges,
theEdgesToAvoid, anInvEdges, theValidEdges, anInvertedEdges, theAlreadyInvFaces, theEdgesToAvoid, anInvEdges, theValidEdges, anInvertedEdges, theAlreadyInvFaces,
anInvFaces, anArtInvFaces, theVertsToAvoid, theETrimEInf, theAsDes); anInvFaces, anArtInvFaces, theVertsToAvoid, theETrimEInf, theAsDes);
@ -852,7 +862,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
TopTools_IndexedDataMapOfShapeListOfShape& theFImages, TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopTools_DataMapOfShapeListOfShape& theDMFNewHoles, TopTools_DataMapOfShapeListOfShape& theDMFNewHoles,
TopoDS_Shape& theSolids, TopoDS_Shape& theSolids,
TopTools_DataMapOfShapeListOfShape& theSSInterfs) BRepOffset_MakeOffset_InterResults& theIntRes)
{ {
if (theLF.IsEmpty()) { if (theLF.IsEmpty()) {
return; return;
@ -1163,7 +1173,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
// remove inside faces // remove inside faces
TopTools_IndexedMapOfShape aMEInside; TopTools_IndexedMapOfShape aMEInside;
RemoveInsideFaces(theFImages, theInvFaces, theArtInvFaces, theInvEdges, theInvertedEdges, RemoveInsideFaces(theFImages, theInvFaces, theArtInvFaces, theInvEdges, theInvertedEdges,
anInvertedFaces, aMFToCheckInt, aMFInvInHole, aFHoles, theSSInterfs, anInvertedFaces, aMFToCheckInt, aMFInvInHole, aFHoles, theIntRes,
aMERemoved, aMEInside, theSolids); aMERemoved, aMEInside, theSolids);
// //
// make compound of valid splits // make compound of valid splits
@ -3244,6 +3254,186 @@ void RemoveInvalidSplitsFromValid(const TopTools_IndexedDataMapOfShapeListOfShap
} }
} }
namespace
{
//=======================================================================
//function : buildPairs
//purpose : builds pairs of shapes
//=======================================================================
static void buildPairs (const TopTools_IndexedMapOfShape& theSMap,
BRepOffset_DataMapOfShapeMapOfShape& theIntPairs)
{
const Standard_Integer aNbS = theSMap.Extent();
if (aNbS < 2)
return;
for (Standard_Integer it1 = 1; it1 <= aNbS; ++it1)
{
const TopoDS_Shape& aS = theSMap (it1);
if (!theIntPairs.IsBound (aS))
theIntPairs.Bind (aS, TopTools_MapOfShape());
}
for (Standard_Integer it1 = 1; it1 <= aNbS; ++it1)
{
const TopoDS_Shape& aS1 = theSMap (it1);
TopTools_MapOfShape& aMap1 = theIntPairs (aS1);
for (Standard_Integer it2 = it1 + 1; it2 <= aNbS; ++it2)
{
const TopoDS_Shape& aS2 = theSMap (it2);
aMap1.Add (aS2);
theIntPairs (aS2).Add (aS1);
}
}
}
//=======================================================================
//function : buildIntersectionPairs
//purpose : builds intersection pairs
//=======================================================================
static void buildIntersectionPairs (const TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
const TopTools_IndexedDataMapOfShapeListOfShape& theInvFaces,
const BOPAlgo_Builder& theBuilder,
const TopTools_MapOfShape& theMFRemoved,
const TopTools_DataMapOfShapeShape& theFOrigins,
NCollection_DataMap<TopoDS_Shape,
BRepOffset_DataMapOfShapeMapOfShape,
TopTools_ShapeMapHasher>& theIntPairs)
{
TopAbs_ShapeEnum aCType = TopAbs_VERTEX;
// Build connection map from vertices to faces
TopTools_IndexedDataMapOfShapeListOfShape aDMVF;
TopExp::MapShapesAndAncestors (theBuilder.Shape(), aCType, TopAbs_FACE, aDMVF);
const TopTools_DataMapOfShapeListOfShape& anImages = theBuilder.Images();
const TopTools_DataMapOfShapeListOfShape& anOrigins = theBuilder.Origins();
// Find all faces connected to the not removed faces and build intersection pairs among them.
// For removed faces intersect only those connected to each other.
for (Standard_Integer iF = 1; iF <= theInvFaces.Extent(); ++iF)
{
const TopoDS_Shape& aFInv = theInvFaces.FindKey (iF);
TopoDS_Compound aCF, aCFRem;
BRep_Builder().MakeCompound (aCF);
BRep_Builder().MakeCompound (aCFRem);
for (Standard_Integer iC = 0; iC < 2; ++iC)
{
const TopTools_ListOfShape& aLF = !iC ? theInvFaces (iF) : theFImages.FindFromKey (aFInv);
for (TopTools_ListOfShape::Iterator it (aLF); it.More(); it.Next())
{
TopTools_ListOfShape aLFIm;
TakeModified (it.Value(), anImages, aLFIm);
for (TopTools_ListOfShape::Iterator itIm (aLFIm); itIm.More(); itIm.Next())
{
const TopoDS_Shape& aFIm = itIm.Value();
if (theMFRemoved.Contains (aFIm))
BRep_Builder().Add (aCFRem, aFIm);
else
BRep_Builder().Add (aCF, aFIm);
}
}
}
TopTools_ListOfShape aLCB;
BOPTools_AlgoTools::MakeConnexityBlocks (aCF, TopAbs_EDGE, TopAbs_FACE, aLCB);
if (aLCB.IsEmpty())
continue;
BRepOffset_DataMapOfShapeMapOfShape* pFInterMap =
theIntPairs.Bound (aFInv, BRepOffset_DataMapOfShapeMapOfShape());
// build pairs for not removed faces
for (TopTools_ListOfShape::Iterator itCB (aLCB); itCB.More(); itCB.Next())
{
const TopoDS_Shape& aCB = itCB.Value();
TopTools_IndexedMapOfShape aMFInter;
for (TopExp_Explorer exp (aCB, aCType); exp.More(); exp.Next())
{
const TopoDS_Shape& aCS = exp.Current();
const TopTools_ListOfShape* pLFV = aDMVF.Seek (aCS);
if (!pLFV)
continue;
for (TopTools_ListOfShape::Iterator itFV (*pLFV); itFV.More(); itFV.Next())
{
const TopoDS_Shape& aFConnected = itFV.Value();
TopTools_ListOfShape aLFOr;
TakeModified (aFConnected, anOrigins, aLFOr);
for (TopTools_ListOfShape::Iterator itOr (aLFOr); itOr.More(); itOr.Next())
{
const TopoDS_Shape* pFOr = theFOrigins.Seek (itOr.Value());
if (pFOr)
aMFInter.Add (*pFOr);
}
}
}
// build intersection pairs
buildPairs (aMFInter, *pFInterMap);
}
aLCB.Clear();
BOPTools_AlgoTools::MakeConnexityBlocks (aCFRem, TopAbs_EDGE, TopAbs_FACE, aLCB);
if (aLCB.IsEmpty())
continue;
for (TopTools_ListOfShape::Iterator itCB (aLCB); itCB.More(); itCB.Next())
{
const TopoDS_Shape& aCB = itCB.Value();
TopTools_IndexedDataMapOfShapeListOfShape aDMEF;
for (TopExp_Explorer exp (aCB, aCType); exp.More(); exp.Next())
{
const TopoDS_Shape& aCS = exp.Current();
const TopTools_ListOfShape* pLFV = aDMVF.Seek (aCS);
if (!pLFV)
continue;
for (TopTools_ListOfShape::Iterator itFV (*pLFV); itFV.More(); itFV.Next())
{
const TopoDS_Shape& aFConnected = itFV.Value();
TopExp::MapShapesAndAncestors (aFConnected, TopAbs_EDGE, TopAbs_FACE, aDMEF);
}
}
for (Standard_Integer iE = 1; iE <= aDMEF.Extent(); ++iE)
{
const TopTools_ListOfShape& aLFConnected = aDMEF (iE);
if (aLFConnected.Extent() < 2)
continue;
TopTools_IndexedMapOfShape aMFInter;
for (TopTools_ListOfShape::Iterator itLF (aLFConnected); itLF.More(); itLF.Next())
{
const TopoDS_Shape& aFConnected = itLF.Value();
TopTools_ListOfShape aLFOr;
TakeModified (aFConnected, anOrigins, aLFOr);
for (TopTools_ListOfShape::Iterator itOr (aLFOr); itOr.More(); itOr.Next())
{
const TopoDS_Shape* pFOr = theFOrigins.Seek (itOr.Value());
if (pFOr)
aMFInter.Add (*pFOr);
}
}
buildPairs (aMFInter, *pFInterMap);
}
}
}
}
}
//======================================================================= //=======================================================================
//function : RemoveInsideFaces //function : RemoveInsideFaces
//purpose : Looking for the inside faces that can be safely removed //purpose : Looking for the inside faces that can be safely removed
@ -3257,7 +3447,7 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
const TopTools_IndexedMapOfShape& theMFToCheckInt, const TopTools_IndexedMapOfShape& theMFToCheckInt,
const TopTools_IndexedMapOfShape& theMFInvInHole, const TopTools_IndexedMapOfShape& theMFInvInHole,
const TopoDS_Shape& theFHoles, const TopoDS_Shape& theFHoles,
TopTools_DataMapOfShapeListOfShape& theSSInterfs, BRepOffset_MakeOffset_InterResults& theIntRes,
TopTools_IndexedMapOfShape& theMERemoved, TopTools_IndexedMapOfShape& theMERemoved,
TopTools_IndexedMapOfShape& theMEInside, TopTools_IndexedMapOfShape& theMEInside,
TopoDS_Shape& theSolids) TopoDS_Shape& theSolids)
@ -3319,7 +3509,7 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
// //
// get shapes connection for using in the rebuilding process // get shapes connection for using in the rebuilding process
// for the cases in which some of the intersection left undetected // for the cases in which some of the intersection left undetected
ShapesConnections(theInvFaces, theInvEdges, aDMFImF, aMV, theSSInterfs); ShapesConnections(theInvFaces, theInvEdges, aDMFImF, aMV, theIntRes.SSInterfs);
// //
// find faces to remove // find faces to remove
const TopoDS_Shape& aSols = aMV.Shape(); const TopoDS_Shape& aSols = aMV.Shape();
@ -3520,6 +3710,11 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
theMEInside.Add(aE); theMEInside.Add(aE);
} }
} }
// build all possible intersection pairs basing on the intersection results
// taking into account removed faces.
if (aMFToRem.Extent())
buildIntersectionPairs (theFImages, theInvFaces, aMV, aMFToRem, aDMFImF, theIntRes.InterPairs);
} }
//======================================================================= //=======================================================================
@ -4465,7 +4660,7 @@ void FindFacesToRebuild(const TopTools_IndexedDataMapOfShapeListOfShape& theLFI
void RebuildFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild, void RebuildFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild,
const TopTools_MapOfShape& theFSelfRebAvoid, const TopTools_MapOfShape& theFSelfRebAvoid,
const TopoDS_Shape& theSolids, const TopoDS_Shape& theSolids,
const TopTools_DataMapOfShapeListOfShape& theSSInterfs, const BRepOffset_MakeOffset_InterResults& theIntRes,
const BRepOffset_Analyse* theAnalyse, const BRepOffset_Analyse* theAnalyse,
TopTools_IndexedDataMapOfShapeListOfShape& theFImages, TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopTools_DataMapOfShapeListOfShape& theDMFNewHoles, TopTools_DataMapOfShapeListOfShape& theDMFNewHoles,
@ -4488,7 +4683,7 @@ void RebuildFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild
TopTools_MapOfShape aModifiedEdges; TopTools_MapOfShape aModifiedEdges;
// //
// 1. Intersect faces // 1. Intersect faces
IntersectFaces(theFToRebuild, theFSelfRebAvoid, theSolids, theSSInterfs, theFImages, theEdgesOrigins, theOEImages, IntersectFaces(theFToRebuild, theFSelfRebAvoid, theSolids, theIntRes, theFImages, theEdgesOrigins, theOEImages,
theOEOrigins, theInvEdges, theValidEdges, theInvertedEdges, theEdgesToAvoid, theOEOrigins, theInvEdges, theValidEdges, theInvertedEdges, theEdgesToAvoid,
theInvFaces, theArtInvFaces, theVertsToAvoid, theETrimEInf, aModifiedEdges, theAsDes); theInvFaces, theArtInvFaces, theVertsToAvoid, theETrimEInf, aModifiedEdges, theAsDes);
// //
@ -4507,7 +4702,7 @@ void RebuildFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild
void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild, void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebuild,
const TopTools_MapOfShape& theFSelfRebAvoid, const TopTools_MapOfShape& theFSelfRebAvoid,
const TopoDS_Shape& theSolids, const TopoDS_Shape& theSolids,
const TopTools_DataMapOfShapeListOfShape& theSSInterfs, const BRepOffset_MakeOffset_InterResults& theIntRes,
TopTools_IndexedDataMapOfShapeListOfShape& theFImages, TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopTools_DataMapOfShapeListOfShape& theEdgesOrigins, TopTools_DataMapOfShapeListOfShape& theEdgesOrigins,
TopTools_DataMapOfShapeListOfShape& theOEImages, TopTools_DataMapOfShapeListOfShape& theOEImages,
@ -4818,12 +5013,13 @@ void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebui
TopTools_IndexedMapOfShape aMFAvoid; TopTools_IndexedMapOfShape aMFAvoid;
// //
FindFacesForIntersection(aFInv, aME, theFImages, aDMSF, aMVInvAll, FindFacesForIntersection(aFInv, aME, theFImages, aDMSF, aMVInvAll,
theArtInvFaces, bArtificial, theSSInterfs, aMFAvoid, aMFInt, aMFIntExt, aLFInt); theArtInvFaces, bArtificial, theIntRes.SSInterfs, aMFAvoid, aMFInt, aMFIntExt, aLFInt);
if (aMFInt.Extent() < 3) { if (aMFInt.Extent() < 3) {
// nothing to intersect // nothing to intersect
continue; continue;
} }
// //
const BRepOffset_DataMapOfShapeMapOfShape* pMFInter = theIntRes.InterPairs.Seek (aFInv);
// intersect the faces, but do not intersect the invalid ones // intersect the faces, but do not intersect the invalid ones
// among each other (except for the artificially invalid faces) // among each other (except for the artificially invalid faces)
TopTools_IndexedMapOfShape aMEToInt; TopTools_IndexedMapOfShape aMEToInt;
@ -4840,12 +5036,19 @@ void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebui
// //
TopTools_ListOfShape& aLFDone = aMDone.ChangeFind(aFi); TopTools_ListOfShape& aLFDone = aMDone.ChangeFind(aFi);
// //
const TopTools_MapOfShape* pInterFi = !pMFInter ? 0 : pMFInter->Seek (aFi);
if (pMFInter && !pInterFi)
continue;
for (j = i + 1; j <= aNb; ++j) { for (j = i + 1; j <= aNb; ++j) {
const TopoDS_Face& aFj = TopoDS::Face(aMFInt(j)); const TopoDS_Face& aFj = TopoDS::Face(aMFInt(j));
if (bSelfRebAvoid && aFj.IsSame(aFInv)) { if (bSelfRebAvoid && aFj.IsSame(aFInv)) {
continue; continue;
} }
// //
if (pInterFi && !pInterFi->Contains (aFj))
continue;
const TopTools_ListOfShape& aLFImj = theFImages.FindFromKey(aFj); const TopTools_ListOfShape& aLFImj = theFImages.FindFromKey(aFj);
// //
TopTools_ListOfShape& aLFEj = aFLE.ChangeFromKey(aFj); TopTools_ListOfShape& aLFEj = aFLE.ChangeFromKey(aFj);

View File

@ -5,8 +5,11 @@ prism b2 f 6 0 0
bcut s b1 b2 bcut s b1 b2
donly s donly s
OFFSETSHAPE 2.5 {} $calcul $type offsetparameter 1e-7 c i r
offsetload s 2.5
offsetperform result
checkprops result -v 2460 checkprops result -s 1140 -v 2460
checknbshapes result -shell 1 unifysamedom result_unif result
checknbshapes result_unif -face 10 -shell 1

View File

@ -1,8 +1,10 @@
restore [locate_data_file bug26917_rm084_dom8810.input.brep] s restore [locate_data_file bug26917_rm084_dom8810.input.brep] s
OFFSETSHAPE 15.6 {} $calcul $type offsetparameter 1e-7 c i r
offsetload s 15.6
offsetperform result
checkprops result -v 9.96466e+008 checkprops result -s 7.69294e+006 -v 9.96466e+008
checkprops result -s 7.69294e+006
checknbshapes result -shell 1 unifysamedom result_unif result
checknbshapes result_unif -face 28 -shell 1

View File

@ -1,8 +1,10 @@
restore [locate_data_file bug26917_rm084_dom8810.input_trim1.brep] s restore [locate_data_file bug26917_rm084_dom8810.input_trim1.brep] s
OFFSETSHAPE 15.6 {} $calcul $type offsetparameter 1e-7 c i r
offsetload s 15.6
offsetperform result
checkprops result -v 2.72597e+007 checkprops result -s 742046 -v 2.72597e+007
checkprops result -s 742046
checknbshapes result -shell 1 unifysamedom result_unif result
checknbshapes result_unif -face 14 -shell 1

View File

@ -0,0 +1,24 @@
puts "========"
puts "0031734: Modeling Algorithms - Incorrect result of offset operation in mode 'Complete' join type 'Intersection'"
puts "========"
puts ""
restore [locate_data_file bug31734_input.brep] s
offsetparameter 1e-7 c i r
offsetload s 37.97685142672564
# nullify top faces
foreach f [explode s f] {
mksurface surf $f
regexp {Axis :([-0-9.+eE]*), ([-0-9.+eE]*), ([-0-9.+eE]*)} [dump surf] full x y z
if {abs(abs($z) - 1) < 1.e-7} {
offsetonface $f 0
}
}
offsetperform result
checkprops result -s 1.0898e+07 -v 8.65375e+08
unifysamedom result_unif result
checknbshapes result_unif -wire 80 -face 80 -shell 1 -solid 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@ -0,0 +1,24 @@
puts "========"
puts "0031734: Modeling Algorithms - Incorrect result of offset operation in mode 'Complete' join type 'Intersection'"
puts "========"
puts ""
restore [locate_data_file bug31734_input_trim.brep] s
offsetparameter 1e-7 c i r
offsetload s 37.97685142672564
# nullify top faces
foreach f [explode s f] {
mksurface surf $f
regexp {Axis :([-0-9.+eE]*), ([-0-9.+eE]*), ([-0-9.+eE]*)} [dump surf] full x y z
if {abs(abs($z) - 1) < 1.e-7} {
offsetonface $f 0
}
}
offsetperform result
checkprops result -s 3.40766e+06 -v 2.58585e+08
unifysamedom result_unif result
checknbshapes result_unif -wire 31 -face 31 -shell 1 -solid 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@ -0,0 +1,64 @@
puts "========"
puts "0031734: Modeling Algorithms - Incorrect result of offset operation in mode 'Complete' join type 'Intersection'"
puts "========"
puts ""
restore [locate_data_file bug31734_input.brep] s
set ref_values { { 1.20705e+07 7.15256e+08 140 139 } \
{ 1.21319e+07 7.27357e+08 140 139 } \
{ 1.21934e+07 7.3952e+08 140 139 } \
{ 1.22549e+07 7.51744e+08 140 139 } \
{ 1.23165e+07 7.6403e+08 140 139 } \
{ 1.23781e+07 7.76377e+08 140 139 } \
{ 1.24398e+07 7.88786e+08 140 139 } \
{ 1.25015e+07 8.01256e+08 140 139 } \
{ 1.25633e+07 8.13789e+08 140 139 } \
{ 1.26251e+07 8.26383e+08 140 139 } \
{ 1.2687e+07 8.39039e+08 140 139 } \
{ 1.27489e+07 8.51757e+08 140 139 } \
{ 1.28109e+07 8.64537e+08 140 139 } \
{ 1.27589e+07 8.77358e+08 139 138 } \
{ 1.2511e+07 8.89993e+08 139 138 } \
{ 1.22597e+07 9.02379e+08 139 138 } \
{ 1.20049e+07 9.14511e+08 139 138 } \
{ 1.17468e+07 9.26387e+08 139 138 } \
{ 1.14852e+07 9.38004e+08 139 138 } \
{ 1.12201e+07 9.49357e+08 139 138 } \
{ 1.10857e+07 9.60471e+08 118 117 } \
{ 1.11297e+07 9.71579e+08 118 117 } \
{ 1.11738e+07 9.82731e+08 118 117 } \
{ 1.1218e+07 9.93927e+08 118 117 } \
{ 1.12622e+07 1.00517e+09 118 117 } \
{ 1.12282e+07 1.01644e+09 109 108 } \
{ 1.11011e+07 1.02757e+09 80 80 } \
{ 1.11451e+07 1.03869e+09 80 80 } \
{ 1.11891e+07 1.04986e+09 80 80 } \
{ 1.12332e+07 1.06107e+09 80 80 } \
{ 1.12774e+07 1.07232e+09 80 80 } \
{ 1.13216e+07 1.08362e+09 80 80 } \
{ 1.13658e+07 1.09497e+09 80 80 } \
{ 1.14101e+07 1.10635e+09 80 80 } \
{ 1.14545e+07 1.11779e+09 80 80 } \
{ 1.14988e+07 1.12926e+09 80 80 } \
{ 1.15433e+07 1.14078e+09 80 80 } \
{ 1.15878e+07 1.15235e+09 80 80 } \
{ 1.16323e+07 1.16396e+09 80 80 } \
{ 1.16769e+07 1.17562e+09 80 80 } \
{ 1.17215e+07 1.18731e+09 80 80 } \
{ 1.17662e+07 1.19906e+09 80 80 } \
{ 1.18109e+07 1.21085e+09 80 80 } \
{ 1.18556e+07 1.22268e+09 80 80 } \
{ 1.19005e+07 1.23456e+09 80 80 } \
{ 1.19453e+07 1.24648e+09 80 80 } \
{ 1.19902e+07 1.25845e+09 80 80 } \
{ 1.20352e+07 1.27046e+09 80 80 } \
{ 1.20802e+07 1.28252e+09 80 80 } \
{ 1.21253e+07 1.29462e+09 80 80 } }
perform_offset_increasing s 1 50 1 $ref_values
copy r50 result
copy r50_unif result_unif
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png