1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

0027878: Development of the Gluing operations based on the new Boolean component

The Gluing operation is an additional option for the algorithms in the Boolean Component
such as General Fuse, Boolean operations, Section operation, Maker Volume and Cells Builder algorithms.

The Gluing options have been designed to speed up the computation of the interference among arguments of the operations on special cases,
in which the arguments may be overlapping but do not have real intersections between their sub-shapes.

This option cannot be used on the shapes having real intersections, like intersection vertex between edges,
or intersection vertex between edge and a face or intersection line between faces.

The Gluing option is an enumeration implemented in BOPAlgo_GlueEnum.hxx. There are following items in the enum:
* BOPAlgo_GlueOff - default value for the algorithms, Gluing is switched off;
* BOPAlgo_GlueShift - Glue option for shapes with partial coincidence;
* BOPAlgo_GlueFull - Glue option for shapes with full coincidence.

For setting the Gluing options for the algorithm it is just necessary to call the SetGlue(BOPAlgo_GlueEnum) method with appropriate Glue value.

For using this option in DRAW the command bglue has been implemented:
* 0 - default value, Gluing is off;
* 1 - for partial coincidence;
* 2 - for full coincidence

Elimination of the warnings.
This commit is contained in:
emv
2016-12-08 16:49:29 +03:00
committed by apn
parent b4327ba8df
commit 483ce1bd89
33 changed files with 628 additions and 115 deletions

View File

@@ -116,6 +116,7 @@ Standard_Integer bapibop(Draw_Interpretor& di,
bRunParallel=BOPTest_Objects::RunParallel();
aFuzzyValue=BOPTest_Objects::FuzzyValue();
bNonDestructive = BOPTest_Objects::NonDestructive();
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
//
if (aOp!=BOPAlgo_CUT21) {
pBuilder->SetArguments(aLS);
@@ -129,6 +130,7 @@ Standard_Integer bapibop(Draw_Interpretor& di,
pBuilder->SetRunParallel(bRunParallel);
pBuilder->SetFuzzyValue(aFuzzyValue);
pBuilder->SetNonDestructive(bNonDestructive);
pBuilder->SetGlue(aGlue);
//
pBuilder->Build();
iErr=pBuilder->ErrorStatus();
@@ -176,11 +178,13 @@ Standard_Integer bapibuild(Draw_Interpretor& di,
bRunParallel=BOPTest_Objects::RunParallel();
aFuzzyValue=BOPTest_Objects::FuzzyValue();
bNonDestructive = BOPTest_Objects::NonDestructive();
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
//
aBuilder.SetArguments(aLS);
aBuilder.SetRunParallel(bRunParallel);
aBuilder.SetFuzzyValue(aFuzzyValue);
aBuilder.SetNonDestructive(bNonDestructive);
aBuilder.SetGlue(aGlue);
//
aBuilder.Build();
iErr=aBuilder.ErrorStatus();

View File

@@ -141,6 +141,7 @@ Standard_Integer bop(Draw_Interpretor& di,
aTol=BOPTest_Objects::FuzzyValue();
bRunParallel=BOPTest_Objects::RunParallel();
bNonDestructive = BOPTest_Objects::NonDestructive();
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
//
aLC.Append(aS1);
aLC.Append(aS2);
@@ -157,6 +158,7 @@ Standard_Integer bop(Draw_Interpretor& di,
pPF->SetFuzzyValue(aTol);
pPF->SetRunParallel(bRunParallel);
pPF->SetNonDestructive(bNonDestructive);
pPF->SetGlue(aGlue);
//
pPF->Perform();
iErr=pPF->ErrorStatus();
@@ -407,6 +409,7 @@ Standard_Integer bsection(Draw_Interpretor& di,
aTol = BOPTest_Objects::FuzzyValue();
bRunParallel = BOPTest_Objects::RunParallel();
bNonDestructive = BOPTest_Objects::NonDestructive();
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
//
for (i = 4; i < n; ++i) {
if (!strcmp(a[i], "-n2d")) {
@@ -433,6 +436,7 @@ Standard_Integer bsection(Draw_Interpretor& di,
aSec.SetFuzzyValue(aTol);
aSec.SetRunParallel(bRunParallel);
aSec.SetNonDestructive(bNonDestructive);
aSec.SetGlue(aGlue);
//
aSec.Build();
iErr=aSec.ErrorStatus();
@@ -484,6 +488,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
aTol=BOPTest_Objects::FuzzyValue();
bRunParallel = BOPTest_Objects::RunParallel();
bNonDestructive = BOPTest_Objects::NonDestructive();
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
//
Handle(NCollection_BaseAllocator)aAL=
NCollection_BaseAllocator::CommonBaseAllocator();
@@ -495,6 +500,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
aPF.SetFuzzyValue(aTol);
aPF.SetRunParallel(bRunParallel);
aPF.SetNonDestructive(bNonDestructive);
aPF.SetGlue(aGlue);
//
aPF.Perform();
iErr=aPF.ErrorStatus();
@@ -739,6 +745,7 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
aTol = BOPTest_Objects::FuzzyValue();
bRunParallel = BOPTest_Objects::RunParallel();
bNonDestructive = BOPTest_Objects::NonDestructive();
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
//
bToIntersect = Standard_True;
bCompounds = Standard_False;
@@ -789,6 +796,7 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
aMV.SetRunParallel(bRunParallel);
aMV.SetFuzzyValue(aTol);
aMV.SetNonDestructive(bNonDestructive);
aMV.SetGlue(aGlue);
//
aMV.Perform();
if (aMV.ErrorStatus()) {

View File

@@ -80,7 +80,6 @@ Standard_Integer bcbuild(Draw_Interpretor& di,
return 1;
}
//
Standard_Boolean bRunParallel;
Standard_Integer iErr;
BOPCol_ListIteratorOfListOfShape aIt;
//
@@ -103,8 +102,16 @@ Standard_Integer bcbuild(Draw_Interpretor& di,
aCBuilder.AddArgument(aS);
}
//
bRunParallel = BOPTest_Objects::RunParallel();
// set the options to the algorithm
Standard_Boolean bRunParallel = BOPTest_Objects::RunParallel();
Standard_Real aTol = BOPTest_Objects::FuzzyValue();
Standard_Boolean bNonDestructive = BOPTest_Objects::NonDestructive();
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
//
aCBuilder.SetRunParallel(bRunParallel);
aCBuilder.SetFuzzyValue(aTol);
aCBuilder.SetNonDestructive(bNonDestructive);
aCBuilder.SetGlue(aGlue);
//
aCBuilder.PerformWithFiller(aPF);
iErr = aCBuilder.ErrorStatus();

View File

@@ -52,6 +52,7 @@ class BOPTest_Session {
myRunParallel=Standard_False;
myNonDestructive = Standard_False;
myFuzzyValue = 0.;
myGlue = BOPAlgo_GlueOff;
};
//
// Clear
@@ -123,6 +124,14 @@ class BOPTest_Session {
return myNonDestructive;
};
//
void SetGlue(const BOPAlgo_GlueEnum theGlue) {
myGlue = theGlue;
};
//
BOPAlgo_GlueEnum Glue() const {
return myGlue;
};
//
protected:
//
BOPTest_Session(const BOPTest_Session&);
@@ -139,6 +148,7 @@ protected:
Standard_Boolean myRunParallel;
Standard_Boolean myNonDestructive;
Standard_Real myFuzzyValue;
BOPAlgo_GlueEnum myGlue;
};
//
//=======================================================================
@@ -308,6 +318,22 @@ Standard_Boolean BOPTest_Objects::NonDestructive()
return GetSession().NonDestructive();
}
//=======================================================================
//function : SetGlue
//purpose :
//=======================================================================
void BOPTest_Objects::SetGlue(const BOPAlgo_GlueEnum theGlue)
{
GetSession().SetGlue(theGlue);
}
//=======================================================================
//function : Glue
//purpose :
//=======================================================================
BOPAlgo_GlueEnum BOPTest_Objects::Glue()
{
return GetSession().Glue();
}
//=======================================================================
//function : Allocator1
//purpose :
//=======================================================================

View File

@@ -25,6 +25,8 @@
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
#include <BOPAlgo_CellsBuilder.hxx>
#include <BOPAlgo_GlueEnum.hxx>
//
class BOPAlgo_PaveFiller;
class BOPAlgo_Builder;
class BOPAlgo_BOP;
@@ -75,7 +77,9 @@ public:
Standard_EXPORT static Standard_Boolean NonDestructive();
Standard_EXPORT static void SetGlue(const BOPAlgo_GlueEnum aGlue);
Standard_EXPORT static BOPAlgo_GlueEnum Glue();
protected:

View File

@@ -17,6 +17,7 @@
#include <BOPTest_Objects.hxx>
#include <DBRep.hxx>
#include <Draw.hxx>
#include <BOPAlgo_GlueEnum.hxx>
#include <stdio.h>
#include <string.h>
@@ -24,6 +25,7 @@ static Standard_Integer boptions (Draw_Interpretor&, Standard_Integer, const cha
static Standard_Integer brunparallel (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**);
static Standard_Integer bGlue(Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : OptionCommands
@@ -41,6 +43,7 @@ void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
theCommands.Add("bnondestructive", "use bnondestructive [0/1]", __FILE__, bnondestructive, g);
theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value", __FILE__, bfuzzyvalue, g);
theCommands.Add("bglue", "use bglue [0 (off) / 1 (shift) / 2 (full)]", __FILE__, bGlue, g);
}
//=======================================================================
//function : boptions
@@ -58,16 +61,21 @@ Standard_Integer boptions(Draw_Interpretor& di,
char buf[128];
Standard_Boolean bRunParallel, bNonDestructive;
Standard_Real aFuzzyValue;
BOPAlgo_GlueEnum aGlue;
//
bRunParallel=BOPTest_Objects::RunParallel();
bNonDestructive = BOPTest_Objects::NonDestructive();
aFuzzyValue = BOPTest_Objects::FuzzyValue();
aGlue = BOPTest_Objects::Glue();
//
Sprintf(buf, " RunParallel: %d\n", bRunParallel);
di << buf;
Sprintf(buf, " NonDestructive: %d\n", bNonDestructive);
di << buf;
Sprintf(buf, " FuzzyValue : %lf\n", aFuzzyValue);
Sprintf(buf, " FuzzyValue: %lf\n", aFuzzyValue);
di << buf;
Sprintf(buf, " GlueOption: %s\n", ((aGlue == BOPAlgo_GlueOff) ? "Off" :
((aGlue == BOPAlgo_GlueFull) ? "Full" : "Shift")));
di << buf;
//
return 0;
@@ -151,3 +159,28 @@ Standard_Integer bnondestructive(Draw_Interpretor& di,
//
return 0;
}
//=======================================================================
//function : bglue
//purpose :
//=======================================================================
Standard_Integer bGlue(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n != 2) {
di << " use bglue [0 (off) / 1 (shift) / 2 (full)]\n";
return 1;
}
//
Standard_Integer iGlue = Draw::Atoi(a[1]);
if (iGlue < 0 || iGlue > 2) {
di << " Wrong value. Use bglue [0 (off) / 1 (shift) / 2 (full)]\n";
return 1;
}
//
BOPAlgo_GlueEnum aGlue = BOPAlgo_GlueEnum(iGlue);
BOPTest_Objects::SetGlue(aGlue);
//
return 0;
}

View File

@@ -83,12 +83,13 @@ Standard_Integer bfillds(Draw_Interpretor& di,
bRunParallel=BOPTest_Objects::RunParallel();
bNonDestructive = BOPTest_Objects::NonDestructive();
aTol = BOPTest_Objects::FuzzyValue();
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
//
for (i=1; i<n; ++i) {
if (!strcmp(a[i], "-t")) {
bShowTime=Standard_True;
}
}
}
//
BOPCol_ListOfShape& aLT=BOPTest_Objects::Tools();
//
@@ -110,6 +111,7 @@ Standard_Integer bfillds(Draw_Interpretor& di,
aPF.SetRunParallel(bRunParallel);
aPF.SetNonDestructive(bNonDestructive);
aPF.SetFuzzyValue(aTol);
aPF.SetGlue(aGlue);
//
OSD_Timer aTimer;
aTimer.Start();