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

0029312: Using OBB to speed up Boolean Operations

1. Implementation of the user-defined option for usage of Oriented Bounding Boxes (OBB) in Boolean Operations for additional filtering (rejection) of selected for intersection pairs of sub-shapes.

By default the usage of OBB is turned off.
To enable/disable its usage the method SetUseOBB(flag) should be used. This method is available for all operations in Boolean Component.
To enable/disable it in draw the command "buseobb 0/1" should be used. Note, that this will affect all subsequent operations.

The OBB for the shapes are built by first necessity and stored into operation context (IntTools_Context).

2. Usage of the OBB in some test cases.
This commit is contained in:
emv
2017-11-01 11:30:30 +03:00
committed by bugmaster
parent 1a0339b464
commit 944768d277
34 changed files with 432 additions and 330 deletions

View File

@@ -373,6 +373,7 @@ void BOPAlgo_BOP::Perform()
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
pPF->SetUseOBB(myUseOBB);
//
pPF->Perform();
//

View File

@@ -195,6 +195,7 @@ void BOPAlgo_Builder::Perform()
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
pPF->SetUseOBB(myUseOBB);
//
pPF->Perform();
//
@@ -212,6 +213,7 @@ void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller)
myNonDestructive = theFiller.NonDestructive();
myFuzzyValue = theFiller.FuzzyValue();
myGlue = theFiller.Glue();
myUseOBB = theFiller.UseOBB();
PerformInternal(theFiller);
}
//=======================================================================

View File

@@ -159,16 +159,16 @@ void BOPAlgo_CheckerSI::Init()
myDS->SetArguments(myArguments);
myDS->Init(myFuzzyValue);
//
// 2.myIterator
// 2 myContext
myContext=new IntTools_Context;
//
// 3.myIterator
BOPDS_PIteratorSI theIterSI=new BOPDS_IteratorSI(myAllocator);
theIterSI->SetDS(myDS);
theIterSI->Prepare();
theIterSI->Prepare(myContext, myUseOBB, myFuzzyValue);
theIterSI->UpdateByLevelOfCheck(myLevelOfCheck);
//
myIterator=theIterSI;
//
// 3 myContext
myContext=new IntTools_Context;
}
//=======================================================================
//function : Perform

View File

@@ -90,6 +90,7 @@ void BOPAlgo_MakerVolume::Perform()
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
pPF->SetUseOBB(myUseOBB);
pPF->Perform();
//
myEntryPoint = 1;

View File

@@ -50,7 +50,8 @@ BOPAlgo_Options::BOPAlgo_Options()
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myReport(new Message_Report),
myRunParallel(myGlobalRunParallel),
myFuzzyValue(Precision::Confusion())
myFuzzyValue(Precision::Confusion()),
myUseOBB(Standard_False)
{
BOPAlgo_LoadMessages();
}
@@ -65,7 +66,8 @@ BOPAlgo_Options::BOPAlgo_Options
myAllocator(theAllocator),
myReport(new Message_Report),
myRunParallel(myGlobalRunParallel),
myFuzzyValue(Precision::Confusion())
myFuzzyValue(Precision::Confusion()),
myUseOBB(Standard_False)
{
BOPAlgo_LoadMessages();
}

View File

@@ -32,6 +32,8 @@ class Message_ProgressIndicator;
//! touching or coinciding cases;
//! - *Progress indicator* - provides interface to track the progress of
//! operation and stop the operation by user's break.
//! - *Using the Oriented Bounding Boxes* - Allows using the Oriented Bounding Boxes of the shapes
//! for filtering the intersections.
//!
class BOPAlgo_Options
{
@@ -156,6 +158,21 @@ public:
//! Set the Progress Indicator object.
Standard_EXPORT void SetProgressIndicator(const Handle(Message_ProgressIndicator)& theObj);
public:
//!@name Usage of Oriented Bounding boxes
//! Enables/Disables the usage of OBB
void SetUseOBB(const Standard_Boolean theUseOBB)
{
myUseOBB = theUseOBB;
}
//! Returns the flag defining usage of OBB
Standard_Boolean UseOBB() const
{
return myUseOBB;
}
protected:
//! Breaks the execution if the break signal
@@ -169,6 +186,7 @@ protected:
Standard_Boolean myRunParallel;
Standard_Real myFuzzyValue;
Handle(Message_ProgressIndicator) myProgressIndicator;
Standard_Boolean myUseOBB;
};

View File

@@ -211,14 +211,14 @@ void BOPAlgo_PaveFiller::Init()
myDS->SetArguments(myArguments);
myDS->Init(myFuzzyValue);
//
// 2.myIterator
// 2 myContext
myContext=new IntTools_Context;
//
// 3.myIterator
myIterator=new BOPDS_Iterator(myAllocator);
myIterator->SetRunParallel(myRunParallel);
myIterator->SetDS(myDS);
myIterator->Prepare();
//
// 3 myContext
myContext=new IntTools_Context;
myIterator->Prepare(myContext, myUseOBB, myFuzzyValue);
//
// 4 NonDestructive flag
SetNonDestructive();

View File

@@ -91,6 +91,7 @@ void BOPAlgo_Splitter::Perform()
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
pPF->SetUseOBB(myUseOBB);
//
pPF->Perform();
//