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

0029234: BRepOffsetAPI_NormalProjection produces INTERNAL edges and vertices

Make the algorithm BRepOffsetAPI_NormalProjection use section operation instead of common to get the edge-result of projection to be in face restrictions.

Correct Boolean operation algorithm to produce correctly oriented result in the case of common between face and edge.

The algorithm ShapeUpgrade_UnifySameDomain has been patched to correctly gather same domain faces in a compound.

The TCL script snowflake.tcl has been corrected to get rid of dependence on the order of edges in the result of Boolean operation.
This commit is contained in:
msv
2017-10-20 18:59:01 +03:00
parent 2c26e60bf9
commit 977ad98334
10 changed files with 115 additions and 123 deletions

View File

@@ -16,6 +16,7 @@
#include <BOPAlgo_BOP.hxx>
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
@@ -777,9 +778,11 @@ void BOPAlgo_BOP::BuildShape()
}
// make containers
BOPCol_ListOfShape aLCRes;
BOPCol_MapOfShape aMInpFence;
aItLS.Initialize(aLSC);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSC = aItLS.Value();
aMInpFence.Add(aSC);
//
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
//
@@ -861,19 +864,44 @@ void BOPAlgo_BOP::BuildShape()
for (; aItLS.More(); aItLS.Next()) {
aBB.Add(aResult, aItLS.Value());
}
//
// add the rest of the shapes into result
// create map of containers
BOPCol_MapOfShape aMSResult;
BOPTools::MapShapes(aResult, aMSResult);
//
aIt.Initialize(myRC);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
if (aMSResult.Add(aS)) {
aBB.Add(aResult, aS);
// get input non-container shapes
BOPCol_ListOfShape aLSNonCont;
for (i = 0; i < 2; ++i)
{
const BOPCol_ListOfShape& aLS = !i ? myArguments : myTools;
aItLS.Initialize(aLS);
for (; aItLS.More(); aItLS.Next())
{
const TopoDS_Shape& aS = aItLS.Value();
BOPAlgo_Tools::TreatCompound(aS, aMInpFence, aLSNonCont);
}
}
//
// put non-container shapes in the result
aItLS.Initialize(aLSNonCont);
for (; aItLS.More(); aItLS.Next())
{
const TopoDS_Shape& aS = aItLS.Value();
if (myImages.IsBound(aS))
{
const BOPCol_ListOfShape& aLSIm = myImages.Find(aS);
aItLSIm.Initialize(aLSIm);
for (; aItLSIm.More(); aItLSIm.Next())
{
const TopoDS_Shape& aSIm = aItLSIm.Value();
if (aMSRC.Contains(aSIm) && aMSResult.Add(aSIm))
aBB.Add(aResult, aSIm);
}
}
else if (aMSRC.Contains(aS) && aMSResult.Add(aS))
aBB.Add(aResult, aS);
}
myShape = aResult;
}
//=======================================================================

View File

@@ -64,6 +64,7 @@
#include <BOPTools_Set.hxx>
//
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_Tools.hxx>
#include <NCollection_Array1.hxx>
#include <NCollection_IncAllocator.hxx>
@@ -74,11 +75,6 @@ static
void OwnInternalShapes(const TopoDS_Shape& ,
BOPCol_IndexedMapOfShape& );
static
void TreatCompound(const TopoDS_Shape& theS,
BOPCol_MapOfShape& aMFence,
BOPCol_ListOfShape& theLS);
//=======================================================================
// BOPAlgo_BuilderSolid
//
@@ -941,7 +937,7 @@ void BOPAlgo_Builder::FillInternalShapes()
aIt.Initialize(aArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
TreatCompound(aS, aMFence, aLSC);
BOPAlgo_Tools::TreatCompound(aS, aMFence, aLSC);
}
aIt.Initialize(aLSC);
for (; aIt.More(); aIt.Next()) {
@@ -1146,29 +1142,3 @@ void OwnInternalShapes(const TopoDS_Shape& theS,
}
}
}
//=======================================================================
//function : TreatCompound
//purpose :
//=======================================================================
void TreatCompound(const TopoDS_Shape& theS,
BOPCol_MapOfShape& aMFence,
BOPCol_ListOfShape& theLS)
{
TopAbs_ShapeEnum aType;
//
aType = theS.ShapeType();
if (aType != TopAbs_COMPOUND) {
if (aMFence.Add(theS)) {
theLS.Append(theS);
}
return;
}
//
TopoDS_Iterator aIt;
//
aIt.Initialize(theS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
TreatCompound(aS, aMFence, theLS);
}
}

View File

@@ -16,6 +16,7 @@
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_MakerVolume.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
@@ -29,10 +30,6 @@
static
void AddFace(const TopoDS_Shape& theF,
BOPCol_ListOfShape& theLF);
static
void TreatCompound(const TopoDS_Shape& theS,
BOPCol_MapOfShape& aMFence,
BOPCol_ListOfShape& theLS);
//=======================================================================
//function : CheckData
@@ -352,7 +349,7 @@ void BOPAlgo_MakerVolume::FillInternalShapes(const BOPCol_ListOfShape& theLSR)
aIt.Initialize(anArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
TreatCompound(aS, aMFence, aLSC);
BOPAlgo_Tools::TreatCompound(aS, aMFence, aLSC);
}
//
aIt.Initialize(aLSC);
@@ -440,26 +437,3 @@ void AddFace(const TopoDS_Shape& theF,
aFF.Orientation(TopAbs_REVERSED);
theLF.Append(aFF);
}
//=======================================================================
//function : TreatCompound
//purpose :
//=======================================================================
void TreatCompound(const TopoDS_Shape& theS,
BOPCol_MapOfShape& aMFence,
BOPCol_ListOfShape& theLS)
{
TopAbs_ShapeEnum aType = theS.ShapeType();
if (aType != TopAbs_COMPOUND) {
if (aMFence.Add(theS)) {
theLS.Append(theS);
}
return;
}
//
TopoDS_Iterator aIt(theS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
TreatCompound(aS, aMFence, theLS);
}
}

View File

@@ -1089,3 +1089,26 @@ void BOPAlgo_Tools::IntersectVertices(const BOPCol_IndexedDataMapOfShapeReal& th
}
}
}
//=======================================================================
//function : TreatCompound
//purpose :
//=======================================================================
void BOPAlgo_Tools::TreatCompound(const TopoDS_Shape& theS,
BOPCol_MapOfShape& aMFence,
BOPCol_ListOfShape& theLS)
{
TopAbs_ShapeEnum aType = theS.ShapeType();
if (aType != TopAbs_COMPOUND)
{
if (aMFence.Add(theS))
theLS.Append(theS);
return;
}
TopoDS_Iterator aIt(theS);
for (; aIt.More(); aIt.Next())
{
const TopoDS_Shape& aS = aIt.Value();
TreatCompound(aS, aMFence, theLS);
}
}

View File

@@ -23,6 +23,8 @@
#include <BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx>
#include <BOPCol_IndexedDataMapOfShapeReal.hxx>
#include <BOPCol_ListOfListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock.hxx>
#include <BOPDS_PDS.hxx>
#include <Standard_Integer.hxx>
@@ -155,6 +157,12 @@ public:
const Standard_Real theFuzzyValue,
BOPCol_ListOfListOfShape& theChains);
//! Collect in the output list recursively all non-compound subshapes of the first level
//! of the given shape theS. If a shape presents in the map theMFence it is skipped.
//! All shapes put in the output are also added into theMFence.
Standard_EXPORT static void TreatCompound(const TopoDS_Shape& theS,
BOPCol_MapOfShape& theMFence,
BOPCol_ListOfShape& theLS);
};
#endif // _BOPAlgo_Tools_HeaderFile