mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-18 14:27:39 +03:00
0026619: Tolerances of operands are modified using bop
0026796: The result of General Fuse operation is self-intersecting shape The fix forces creation of new sub-shapes (vertex, edge) when the tolerance of some sub-shape of an argument is to be increased. This new behavior is turned off by default. It can be turned on using two ways: 1) Setting 'locking' flag of the arguments. 2) Calling the method SetNonDestructive(Standard_True) of the API classes. Various bug fixes in the algorithm: - Compute correct tolerance values for intersections of type Line/Line, Line/Plane, Plane/Plane. - In case of Line/Plane intersection check if line's vertices lie on the plane. - Do not allow decreasing of the tolerance value of the Line/Line intersection vertex. - In IntTools_EdgeEdge, call the method FindParameters with proper 3D tolerance of the curve. - Force making copy of a degenerated edge if its vertex is touched but no 2D intersection with other curves is found. - Remove pave blocks both ends of which became referring to the same vertex after vertices substitution. - Avoid exception in IntTools_Context::IsVertexOnLine if Extrema is not done. - Reduce tolerance of vertex/edge using actual distances to interfered shapes if it was increased due to line/line, line/plane, or plane/plane small intersection angle. - Update tolerance of edges to reach all representations in a common block. - In V-E intersections, check if a vertex hits beyond shrunk range, in such case create V-V interference. - Do not put a section edge to the result if it becomes to be a micro edge after updating its vertex. - Correctly make vertices same-domain during the work of MakeBlocks. - Decrease shrunk range at least on a Precision::Confusion() in addition to vertex tolerance. - Add Confusion to bounding boxes of new shapes in DS - Add tolerance Precision::Confusion() to compare distances of touching cases to fix regressions. TODO marks have been removed from (or modified in) the following test cases (Improvements): boolean bsection M3 N2 R2 boolean gdml_private B6 C2 C6 G7 I6 F6 J1 J4 M7 N1 N8 N9 O3 O4 O6 O8 O9 P1 P2 P5 Q1 Q3 Q5 S9 T2 U4 U5 U9 ZB5 ZB6 ZC1 ZC5 ZD3 ZD6 ZD7 ZH2 ZH5 ZI2 ZI5 ZI7 ZI9 ZJ3 ZJ4 ZJ7 F8 I6 G1 boolean volumemaker A5 A6 B3 B4 B7 B9 D3 D4 D7 F1 boolean bopcut_2d D5 bugs modalg_5 bug25043 bugs modalg_2 bug472_1 bug472_2 bug472_3 Test cases updated because they are still bad but can be accepted as non-regression: boolean volumemaker C4 A3 A7 E6 bugs modalg_1 bug10232 boolean bsection N2 Put new TODO in the scripts: bugs modalg_5 bug25232_9 bugs modalg_6 bug26619 bugs modalg_1 buc60462_2 bugs modalg_4 bug772 For the following tests the result in fix became better, so take fix result as the reference: bugs modalg_5 bug24628 bugs modalg_6 bug26954_3 boolean volumemaker A4 B5 B6 C3 C8 D2 D5 F2 bugs modalg_2 bug472_2 bugs modalg_1 buc60776_1 - Add the method SetNonDestructive to API classes of user level
This commit is contained in:
@@ -66,7 +66,7 @@ Standard_Integer bapibop(Draw_Interpretor& di,
|
||||
}
|
||||
//
|
||||
char buf[128];
|
||||
Standard_Boolean bRunParallel;
|
||||
Standard_Boolean bRunParallel, bNonDestructive;
|
||||
Standard_Integer iErr, iOp;
|
||||
Standard_Real aFuzzyValue;
|
||||
BRepAlgoAPI_Common aCommon;
|
||||
@@ -115,6 +115,7 @@ Standard_Integer bapibop(Draw_Interpretor& di,
|
||||
//
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
aFuzzyValue=BOPTest_Objects::FuzzyValue();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
//
|
||||
if (aOp!=BOPAlgo_CUT21) {
|
||||
pBuilder->SetArguments(aLS);
|
||||
@@ -127,6 +128,7 @@ Standard_Integer bapibop(Draw_Interpretor& di,
|
||||
//
|
||||
pBuilder->SetRunParallel(bRunParallel);
|
||||
pBuilder->SetFuzzyValue(aFuzzyValue);
|
||||
pBuilder->SetNonDestructive(bNonDestructive);
|
||||
//
|
||||
pBuilder->Build();
|
||||
iErr=pBuilder->ErrorStatus();
|
||||
@@ -159,7 +161,7 @@ Standard_Integer bapibuild(Draw_Interpretor& di,
|
||||
}
|
||||
//
|
||||
char buf[128];
|
||||
Standard_Boolean bRunParallel;
|
||||
Standard_Boolean bRunParallel, bNonDestructive;
|
||||
Standard_Integer iErr;
|
||||
Standard_Real aFuzzyValue;
|
||||
BRepAlgoAPI_BuilderAlgo aBuilder;
|
||||
@@ -173,10 +175,12 @@ Standard_Integer bapibuild(Draw_Interpretor& di,
|
||||
//
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
aFuzzyValue=BOPTest_Objects::FuzzyValue();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
//
|
||||
aBuilder.SetArguments(aLS);
|
||||
aBuilder.SetRunParallel(bRunParallel);
|
||||
aBuilder.SetFuzzyValue(aFuzzyValue);
|
||||
aBuilder.SetNonDestructive(bNonDestructive);
|
||||
//
|
||||
aBuilder.Build();
|
||||
iErr=aBuilder.ErrorStatus();
|
||||
|
@@ -119,7 +119,7 @@ Standard_Integer bop(Draw_Interpretor& di,
|
||||
const char** a)
|
||||
{
|
||||
char buf[32];
|
||||
Standard_Boolean bRunParallel;
|
||||
Standard_Boolean bRunParallel, bNonDestructive;
|
||||
Standard_Integer iErr;
|
||||
Standard_Real aTol;
|
||||
TopoDS_Shape aS1, aS2;
|
||||
@@ -140,6 +140,7 @@ Standard_Integer bop(Draw_Interpretor& di,
|
||||
//
|
||||
aTol=BOPTest_Objects::FuzzyValue();
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
//
|
||||
aLC.Append(aS1);
|
||||
aLC.Append(aS2);
|
||||
@@ -155,6 +156,7 @@ Standard_Integer bop(Draw_Interpretor& di,
|
||||
pPF->SetArguments(aLC);
|
||||
pPF->SetFuzzyValue(aTol);
|
||||
pPF->SetRunParallel(bRunParallel);
|
||||
pPF->SetNonDestructive(bNonDestructive);
|
||||
//
|
||||
pPF->Perform();
|
||||
iErr=pPF->ErrorStatus();
|
||||
@@ -395,7 +397,7 @@ Standard_Integer bsection(Draw_Interpretor& di,
|
||||
}
|
||||
//
|
||||
char buf[80];
|
||||
Standard_Boolean bRunParallel, bApp, bPC1, bPC2;
|
||||
Standard_Boolean bRunParallel, bNonDestructive, bApp, bPC1, bPC2;
|
||||
Standard_Integer i, iErr;
|
||||
Standard_Real aTol;
|
||||
//
|
||||
@@ -404,6 +406,7 @@ Standard_Integer bsection(Draw_Interpretor& di,
|
||||
bPC2 = Standard_True;
|
||||
aTol = BOPTest_Objects::FuzzyValue();
|
||||
bRunParallel = BOPTest_Objects::RunParallel();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
//
|
||||
for (i = 4; i < n; ++i) {
|
||||
if (!strcmp(a[i], "-n2d")) {
|
||||
@@ -429,6 +432,7 @@ Standard_Integer bsection(Draw_Interpretor& di,
|
||||
//
|
||||
aSec.SetFuzzyValue(aTol);
|
||||
aSec.SetRunParallel(bRunParallel);
|
||||
aSec.SetNonDestructive(bNonDestructive);
|
||||
//
|
||||
aSec.Build();
|
||||
iErr=aSec.ErrorStatus();
|
||||
@@ -456,7 +460,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
|
||||
const BOPAlgo_Operation aOp)
|
||||
{
|
||||
char buf[32];
|
||||
Standard_Boolean bRunParallel;
|
||||
Standard_Boolean bRunParallel, bNonDestructive;
|
||||
Standard_Integer iErr;
|
||||
TopoDS_Shape aS1, aS2;
|
||||
BOPCol_ListOfShape aLC;
|
||||
@@ -479,6 +483,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
|
||||
//
|
||||
aTol=BOPTest_Objects::FuzzyValue();
|
||||
bRunParallel = BOPTest_Objects::RunParallel();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
//
|
||||
Handle(NCollection_BaseAllocator)aAL=
|
||||
NCollection_BaseAllocator::CommonBaseAllocator();
|
||||
@@ -489,6 +494,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
|
||||
aPF.SetArguments(aLC);
|
||||
aPF.SetFuzzyValue(aTol);
|
||||
aPF.SetRunParallel(bRunParallel);
|
||||
aPF.SetNonDestructive(bNonDestructive);
|
||||
//
|
||||
aPF.Perform();
|
||||
iErr=aPF.ErrorStatus();
|
||||
@@ -724,7 +730,7 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
|
||||
//
|
||||
const char* usage = "Type mkvolume without arguments for the usage of the command.\n";
|
||||
//
|
||||
Standard_Boolean bToIntersect, bRunParallel, bCompounds;
|
||||
Standard_Boolean bToIntersect, bRunParallel, bNonDestructive, bCompounds;
|
||||
Standard_Integer i;
|
||||
Standard_Real aTol;
|
||||
TopoDS_Shape aS;
|
||||
@@ -732,6 +738,7 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
|
||||
//
|
||||
aTol = BOPTest_Objects::FuzzyValue();
|
||||
bRunParallel = BOPTest_Objects::RunParallel();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
//
|
||||
bToIntersect = Standard_True;
|
||||
bCompounds = Standard_False;
|
||||
@@ -781,6 +788,7 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
|
||||
aMV.SetIntersect(bToIntersect);
|
||||
aMV.SetRunParallel(bRunParallel);
|
||||
aMV.SetFuzzyValue(aTol);
|
||||
aMV.SetNonDestructive(bNonDestructive);
|
||||
//
|
||||
aMV.Perform();
|
||||
if (aMV.ErrorStatus()) {
|
||||
|
@@ -50,7 +50,8 @@ class BOPTest_Session {
|
||||
//
|
||||
myBuilder=myBuilderDefault;
|
||||
myRunParallel=Standard_False;
|
||||
myFuzzyValue=0.;
|
||||
myNonDestructive = Standard_False;
|
||||
myFuzzyValue = 0.;
|
||||
};
|
||||
//
|
||||
// Clear
|
||||
@@ -114,6 +115,14 @@ class BOPTest_Session {
|
||||
return myFuzzyValue;
|
||||
};
|
||||
//
|
||||
void SetNonDestructive(const Standard_Boolean theFlag) {
|
||||
myNonDestructive = theFlag;
|
||||
};
|
||||
//
|
||||
Standard_Boolean NonDestructive()const {
|
||||
return myNonDestructive;
|
||||
};
|
||||
//
|
||||
protected:
|
||||
//
|
||||
BOPTest_Session(const BOPTest_Session&);
|
||||
@@ -128,6 +137,7 @@ protected:
|
||||
BOPCol_ListOfShape myShapes;
|
||||
BOPCol_ListOfShape myTools;
|
||||
Standard_Boolean myRunParallel;
|
||||
Standard_Boolean myNonDestructive;
|
||||
Standard_Real myFuzzyValue;
|
||||
};
|
||||
//
|
||||
@@ -282,6 +292,22 @@ Standard_Real BOPTest_Objects::FuzzyValue()
|
||||
return GetSession().FuzzyValue();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetNonDestructive
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPTest_Objects::SetNonDestructive(const Standard_Boolean theFlag)
|
||||
{
|
||||
GetSession().SetNonDestructive(theFlag);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : NonDestructive
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BOPTest_Objects::NonDestructive()
|
||||
{
|
||||
return GetSession().NonDestructive();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Allocator1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
@@ -71,6 +71,10 @@ public:
|
||||
|
||||
Standard_EXPORT static Standard_Real FuzzyValue();
|
||||
|
||||
Standard_EXPORT static void SetNonDestructive(const Standard_Boolean theFlag);
|
||||
|
||||
Standard_EXPORT static Standard_Boolean NonDestructive();
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -22,8 +22,8 @@
|
||||
#include <string.h>
|
||||
static Standard_Integer boptions (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer brunparallel (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer bfuzzyvalue (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer bparallelmode(Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer bnondestructive(Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer bfuzzyvalue(Draw_Interpretor&, Standard_Integer, const char**);
|
||||
|
||||
//=======================================================================
|
||||
//function : OptionCommands
|
||||
@@ -37,13 +37,10 @@ void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
|
||||
// Chapter's name
|
||||
const char* g = "BOPTest commands";
|
||||
// Commands
|
||||
theCommands.Add("boptions", "use boptions" , __FILE__, boptions, g);
|
||||
theCommands.Add("boptions", "use boptions, shows current value of BOP options" , __FILE__, boptions, g);
|
||||
theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
|
||||
theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value" , __FILE__, bfuzzyvalue, g);
|
||||
theCommands.Add("bparallelmode",
|
||||
"bparallelmode [1/0] : show / set parallel mode for boolean operations",
|
||||
__FILE__, bparallelmode, g);
|
||||
|
||||
theCommands.Add("bnondestructive", "use bnondestructive [0/1]", __FILE__, bnondestructive, g);
|
||||
theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value", __FILE__, bfuzzyvalue, g);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : boptions
|
||||
@@ -59,14 +56,17 @@ Standard_Integer boptions(Draw_Interpretor& di,
|
||||
}
|
||||
//
|
||||
char buf[128];
|
||||
Standard_Boolean bRunParallel;
|
||||
Standard_Boolean bRunParallel, bNonDestructive;
|
||||
Standard_Real aFuzzyValue;
|
||||
//
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
aFuzzyValue=BOPTest_Objects::FuzzyValue();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
aFuzzyValue = BOPTest_Objects::FuzzyValue();
|
||||
|
||||
Sprintf(buf, " RunParallel: %d\n", bRunParallel);
|
||||
di << buf;
|
||||
Sprintf(buf, " NonDestructive: %d\n", bNonDestructive);
|
||||
di << buf;
|
||||
Sprintf(buf, " FuzzyValue : %lf\n", aFuzzyValue);
|
||||
di << buf;
|
||||
//
|
||||
@@ -125,29 +125,29 @@ Standard_Integer brunparallel(Draw_Interpretor& di,
|
||||
return 0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : bparallelmode
|
||||
//function : bnondestructive
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer bparallelmode(Draw_Interpretor& di,
|
||||
Standard_Integer n,
|
||||
const char** a)
|
||||
Standard_Integer bnondestructive(Draw_Interpretor& di,
|
||||
Standard_Integer n,
|
||||
const char** a)
|
||||
{
|
||||
Standard_Boolean bRunParallel;
|
||||
if (n != 2) {
|
||||
di << " use bnondestructive [0/1]\n";
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
if (n == 2) {
|
||||
bRunParallel=(Standard_Boolean)Draw::Atoi(a[1]);
|
||||
BOPTest_Objects::SetRunParallel(bRunParallel);
|
||||
if (bRunParallel) {
|
||||
di << "Parallel mode for boolean operations has been enabled";
|
||||
}
|
||||
else {
|
||||
di << "Parallel mode for boolean operations has been disabled";
|
||||
}
|
||||
}
|
||||
else {
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
di << "Parallel mode state for boolean operations: "
|
||||
<< (bRunParallel? "enabled" : "disabled");
|
||||
Standard_Integer iX;
|
||||
Standard_Boolean bNonDestructive;
|
||||
//
|
||||
iX = Draw::Atoi(a[1]);
|
||||
if (iX<0 || iX>1) {
|
||||
di << " Wrong value.\n";
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
bNonDestructive = (Standard_Boolean)(iX);
|
||||
BOPTest_Objects::SetNonDestructive(bNonDestructive);
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
|
@@ -66,7 +66,7 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
||||
}
|
||||
//
|
||||
char buf[32];
|
||||
Standard_Boolean bRunParallel, bShowTime;
|
||||
Standard_Boolean bRunParallel, bNonDestructive, bShowTime;
|
||||
Standard_Integer i, aNbS, iErr;
|
||||
Standard_Real aTol;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
@@ -81,7 +81,8 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
||||
bShowTime = Standard_False;
|
||||
//
|
||||
bRunParallel=BOPTest_Objects::RunParallel();
|
||||
aTol=BOPTest_Objects::FuzzyValue();
|
||||
bNonDestructive = BOPTest_Objects::NonDestructive();
|
||||
aTol = BOPTest_Objects::FuzzyValue();
|
||||
//
|
||||
for (i=1; i<n; ++i) {
|
||||
if (!strcmp(a[i], "-t")) {
|
||||
@@ -107,6 +108,7 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
||||
//
|
||||
aPF.SetArguments(aLC);
|
||||
aPF.SetRunParallel(bRunParallel);
|
||||
aPF.SetNonDestructive(bNonDestructive);
|
||||
aPF.SetFuzzyValue(aTol);
|
||||
//
|
||||
OSD_Timer aTimer;
|
||||
|
Reference in New Issue
Block a user