1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +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

@@ -376,6 +376,7 @@ void BOPAlgo_BOP::Perform()
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
//
pPF->Perform();
//

View File

@@ -51,7 +51,8 @@ BOPAlgo_Builder::BOPAlgo_Builder()
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
myOrigins(100, myAllocator),
myNonDestructive(Standard_False)
myNonDestructive(Standard_False),
myGlue(BOPAlgo_GlueOff)
{
}
//=======================================================================
@@ -71,7 +72,8 @@ BOPAlgo_Builder::BOPAlgo_Builder
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
myOrigins(100, myAllocator),
myNonDestructive(Standard_False)
myNonDestructive(Standard_False),
myGlue(BOPAlgo_GlueOff)
{
}
//=======================================================================
@@ -200,6 +202,22 @@ Standard_Boolean BOPAlgo_Builder::NonDestructive() const
return myNonDestructive;
}
//=======================================================================
//function : SetGlue
//purpose :
//=======================================================================
void BOPAlgo_Builder::SetGlue(const BOPAlgo_GlueEnum theGlue)
{
myGlue=theGlue;
}
//=======================================================================
//function : Glue
//purpose :
//=======================================================================
BOPAlgo_GlueEnum BOPAlgo_Builder::Glue() const
{
return myGlue;
}
//=======================================================================
// function: CheckData
// purpose:
//=======================================================================
@@ -268,6 +286,7 @@ void BOPAlgo_Builder::Perform()
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
//
pPF->Perform();
//
@@ -283,6 +302,7 @@ void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller)
myEntryPoint=0;
myNonDestructive = theFiller.NonDestructive();
myFuzzyValue = theFiller.FuzzyValue();
myGlue = theFiller.Glue();
PerformInternal(theFiller);
}
//=======================================================================

View File

@@ -25,6 +25,7 @@
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPAlgo_PPaveFiller.hxx>
#include <BOPAlgo_GlueEnum.hxx>
#include <BOPDS_PDS.hxx>
#include <Standard_Integer.hxx>
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
@@ -107,6 +108,11 @@ Standard_EXPORT virtual ~BOPAlgo_Builder();
//! a copy of a sub-shape is created in the result if it is needed to be updated.
Standard_EXPORT Standard_Boolean NonDestructive() const;
//! Sets the glue option for the algorithm
Standard_EXPORT void SetGlue(const BOPAlgo_GlueEnum theGlue);
//! Returns the glue option of the algorithm
Standard_EXPORT BOPAlgo_GlueEnum Glue() const;
protected:
@@ -167,6 +173,7 @@ protected:
BOPCol_DataMapOfShapeListOfShape mySplits;
BOPCol_DataMapOfShapeShape myOrigins;
Standard_Boolean myNonDestructive;
BOPAlgo_GlueEnum myGlue;
private:

View File

@@ -0,0 +1,64 @@
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BOPAlgo_GlueEnum_HeaderFile
#define _BOPAlgo_GlueEnum_HeaderFile
//! The Enumeration describes 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.
//!
//! There are two possibilities of overlapping shapes:
//! 1. The shapes can be partially coinciding - the faces do not have
//! intersection curves, but overlapping. The faces of such arguments will
//! be split during the operation;
//! 2. The shapes can be fully coinciding - there should be no partial
//! overlapping of the faces, thus no intersection of type EDGE/FACE at all.
//! In such cases the faces will not be split during the operation.
//!
//! Even though there are no real intersections on such cases without Gluing options the algorithm
//! will still intersect the sub-shapes of the arguments with interfering bounding boxes.
//!
//! The performance improvement in gluing mode is achieved by excluding
//! the most time consuming computations according to the given Gluing parameter:
//! 1. Computation of FACE/FACE intersections for partial coincidence;
//! 2. And computation of VERTEX/FACE, EDGE/FACE and FACE/FACE intersections for full coincidence.
//!
//! By setting the Gluing option for the operation user should guarantee
//! that the arguments are really coinciding. The algorithms do not check this itself.
//! Setting inappropriate option for the operation is likely to lead to incorrect result.
//!
//! There are following items in the enumeration:
//! 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.
//!
enum BOPAlgo_GlueEnum
{
BOPAlgo_GlueOff,
BOPAlgo_GlueShift,
BOPAlgo_GlueFull
};
#endif // _BOPAlgo_GlueEnum_HeaderFile

View File

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

View File

@@ -43,6 +43,7 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
myIterator=NULL;
myNonDestructive=Standard_False;
myIsPrimary=Standard_True;
myGlue=BOPAlgo_GlueOff;
}
//=======================================================================
//function :
@@ -57,6 +58,7 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
myIterator=NULL;
myNonDestructive=Standard_False;
myIsPrimary=Standard_True;
myGlue=BOPAlgo_GlueOff;
}
//=======================================================================
//function : ~
@@ -83,6 +85,22 @@ Standard_Boolean BOPAlgo_PaveFiller::NonDestructive()const
return myNonDestructive;
}
//=======================================================================
//function : SetGlue
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetGlue(const BOPAlgo_GlueEnum theGlue)
{
myGlue=theGlue;
}
//=======================================================================
//function : Glue
//purpose :
//=======================================================================
BOPAlgo_GlueEnum BOPAlgo_PaveFiller::Glue() const
{
return myGlue;
}
//=======================================================================
//function : SetIsPrimary
//purpose :
//=======================================================================
@@ -294,6 +312,10 @@ void BOPAlgo_PaveFiller::PerformInternal()
if (myErrorStatus) {
return;
}
//
if (myGlue != BOPAlgo_GlueOff) {
return;
}
// 03
PerformVZ();
if (myErrorStatus) {

View File

@@ -48,6 +48,7 @@
#include <BOPDS_VectorOfCurve.hxx>
#include <BOPCol_IndexedDataMapOfShapeInteger.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPAlgo_GlueEnum.hxx>
class IntTools_Context;
class BOPDS_DS;
class BOPAlgo_SectionAttribute;
@@ -101,6 +102,14 @@ public:
//! Sets the glue option for the algorithm
Standard_EXPORT void SetGlue(const BOPAlgo_GlueEnum theGlue);
//! Returns the glue option of the algorithm
Standard_EXPORT BOPAlgo_GlueEnum Glue() const;
protected:
typedef NCollection_DataMap
@@ -395,6 +404,7 @@ protected:
BOPAlgo_SectionAttribute mySectionAttribute;
Standard_Boolean myNonDestructive;
Standard_Boolean myIsPrimary;
BOPAlgo_GlueEnum myGlue;
private:

View File

@@ -142,96 +142,109 @@ typedef BOPCol_ContextCnt
//=======================================================================
void BOPAlgo_PaveFiller::PerformVF()
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, aNbVF, k;
Standard_Real aT1, aT2;
BOPAlgo_VectorOfVertexFace aVVF;
//
myErrorStatus=0;
//
myIterator->Initialize(TopAbs_VERTEX, TopAbs_FACE);
iSize=myIterator->ExpectedLength();
if (iSize) {
//
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
aVFs.SetIncrement(iSize);
//
Standard_Integer iSize = myIterator->ExpectedLength();
//
Standard_Boolean bJustAdd;
Standard_Integer nV, nF;
//
if (myGlue == BOPAlgo_GlueFull) {
// there is no need to intersect vertices with faces in this mode
// just initialize FaceInfo for all faces
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nF, bJustAdd);
if(bJustAdd) {
continue;
}
//
if (myDS->IsSubShape(nV, nF)) {
continue;
}
//
if (myDS->HasInterfShapeSubShapes(nV, nF)) {
if (!bJustAdd && !myDS->IsSubShape(nV, nF)) {
myDS->ChangeFaceInfo(nF);
continue;
}
//
nVx=nV;
if (myDS->HasShapeSD(nV, nVSD)) {
nVx=nVSD;
}
//
myDS->ChangeFaceInfo(nF);// !
//
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
//
BOPAlgo_VertexFace& aVertexFace=aVVF.Append1();
//
aVertexFace.SetIndices(nV, nF);
aVertexFace.SetVertex(aV);
aVertexFace.SetFace(aF);
aVertexFace.SetFuzzyValue(myFuzzyValue);
aVertexFace.SetProgressIndicator(myProgressIndicator);
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbVF=aVVF.Extent();
//================================================================
BOPAlgo_VertexFaceCnt::Perform(myRunParallel, aVVF, myContext);
//================================================================
//
for (k=0; k < aNbVF; ++k) {
const BOPAlgo_VertexFace& aVertexFace=aVVF(k);
//
iFlag=aVertexFace.Flag();
if (iFlag) {
continue;
}
//
aVertexFace.Indices(nV, nF);
aVertexFace.Parameters(aT1, aT2);
// 1
BOPDS_InterfVF& aVF=aVFs.Append1();
aVF.SetIndices(nV, nF);
aVF.SetUV(aT1, aT2);
// 2
myDS->AddInterf(nV, nF);
//
// 3 update vertex V/F if necessary
Standard_Real aTolVNew = aVertexFace.VertexNewTolerance();
nVx=UpdateVertex(nV, aTolVNew);
//
// 4
if (myDS->IsNewShape(nVx)) {
aVF.SetIndexNew(nVx);
}
// 5 update FaceInfo
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nVx);
}//for (k=0; k < aNbVF; ++k) {
}// if (iSize) {
else {
iSize=10;
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
aVFs.SetIncrement(iSize);
}
return;
}
//
BOPDS_VectorOfInterfVF& aVFs = myDS->InterfVF();
if (!iSize) {
iSize = 10;
aVFs.SetIncrement(iSize);
//
TreatVerticesEE();
return;
}
//
Standard_Integer nVSD, iFlag, nVx, aNbVF, k;
Standard_Real aT1, aT2;
BOPAlgo_VectorOfVertexFace aVVF;
//
aVFs.SetIncrement(iSize);
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nF, bJustAdd);
if(bJustAdd) {
continue;
}
//
if (myDS->IsSubShape(nV, nF)) {
continue;
}
//
myDS->ChangeFaceInfo(nF);
if (myDS->HasInterfShapeSubShapes(nV, nF)) {
continue;
}
//
nVx=nV;
if (myDS->HasShapeSD(nV, nVSD)) {
nVx=nVSD;
}
//
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
//
BOPAlgo_VertexFace& aVertexFace=aVVF.Append1();
//
aVertexFace.SetIndices(nV, nF);
aVertexFace.SetVertex(aV);
aVertexFace.SetFace(aF);
aVertexFace.SetFuzzyValue(myFuzzyValue);
aVertexFace.SetProgressIndicator(myProgressIndicator);
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbVF=aVVF.Extent();
//================================================================
BOPAlgo_VertexFaceCnt::Perform(myRunParallel, aVVF, myContext);
//================================================================
//
for (k=0; k < aNbVF; ++k) {
const BOPAlgo_VertexFace& aVertexFace=aVVF(k);
//
iFlag=aVertexFace.Flag();
if (iFlag) {
continue;
}
//
aVertexFace.Indices(nV, nF);
aVertexFace.Parameters(aT1, aT2);
// 1
BOPDS_InterfVF& aVF=aVFs.Append1();
aVF.SetIndices(nV, nF);
aVF.SetUV(aT1, aT2);
// 2
myDS->AddInterf(nV, nF);
//
// 3 update vertex V/F if necessary
Standard_Real aTolVNew = aVertexFace.VertexNewTolerance();
nVx=UpdateVertex(nV, aTolVNew);
//
// 4
if (myDS->IsNewShape(nVx)) {
aVF.SetIndexNew(nVx);
}
// 5 update FaceInfo
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nVx);
}//for (k=0; k < aNbVF; ++k) {
//
TreatVerticesEE();
}
//=======================================================================

View File

@@ -139,22 +139,35 @@ typedef BOPCol_ContextCnt
//=======================================================================
void BOPAlgo_PaveFiller::PerformEF()
{
Standard_Integer iSize;
//
myErrorStatus=0;
//
FillShrunkData(TopAbs_EDGE, TopAbs_FACE);
//
myIterator->Initialize(TopAbs_EDGE, TopAbs_FACE);
iSize=myIterator->ExpectedLength();
Standard_Integer iSize = myIterator->ExpectedLength();
if (!iSize) {
return;
}
//
Standard_Boolean bJustAdd, bV[2], bIsPBSplittable;
Standard_Boolean bJustAdd;
Standard_Integer nE, nF;
//
if (myGlue == BOPAlgo_GlueFull) {
// there is no need to intersect edges with faces in this mode
// just initialize FaceInfo for faces
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nE, nF, bJustAdd);
if (!bJustAdd && !myDS->ShapeInfo(nE).HasFlag()) {
myDS->ChangeFaceInfo(nF);
}
}
return;
}
//
Standard_Boolean bV[2], bIsPBSplittable;
Standard_Boolean bV1, bV2, bExpressCompute;
Standard_Integer nV1, nV2;
Standard_Integer nE, nF, aDiscretize, i, aNbCPrts, iX, nV[2];
Standard_Integer aDiscretize, i, aNbCPrts, iX, nV[2];
Standard_Integer aNbEdgeFace, k;
Standard_Real aTolE, aTolF, aTS1, aTS2, aT1, aT2, aDeflection;
Handle(NCollection_BaseAllocator) aAllocator;

View File

@@ -237,22 +237,34 @@ void BOPAlgo_PaveFiller::PerformFF()
//
ToleranceFF(aBAS1, aBAS2, aTolFF);
//
BOPAlgo_FaceFace& aFaceFace=aVFaceFace.Append1();
//
aFaceFace.SetIndices(nF1, nF2);
aFaceFace.SetFaces(aF1, aF2);
aFaceFace.SetTolFF(aTolFF);
//
IntSurf_ListOfPntOn2S aListOfPnts;
GetEFPnts(nF1, nF2, aListOfPnts);
aNbLP = aListOfPnts.Extent();
if (aNbLP) {
aFaceFace.SetList(aListOfPnts);
if (myGlue == BOPAlgo_GlueOff) {
BOPAlgo_FaceFace& aFaceFace=aVFaceFace.Append1();
//
aFaceFace.SetIndices(nF1, nF2);
aFaceFace.SetFaces(aF1, aF2);
aFaceFace.SetTolFF(aTolFF);
//
IntSurf_ListOfPntOn2S aListOfPnts;
GetEFPnts(nF1, nF2, aListOfPnts);
aNbLP = aListOfPnts.Extent();
if (aNbLP) {
aFaceFace.SetList(aListOfPnts);
}
//
aFaceFace.SetParameters(bApp, bCompC2D1, bCompC2D2, aApproxTol);
aFaceFace.SetFuzzyValue(myFuzzyValue);
aFaceFace.SetProgressIndicator(myProgressIndicator);
}
else {
// for the Glue mode just add all interferences of that type
BOPDS_InterfFF& aFF = aFFs.Append1();
aFF.SetIndices(nF1, nF2);
aFF.SetTolR3D(Precision::Confusion());
aFF.SetTolR2D(Precision::PConfusion());
aFF.SetTolReal(Precision::Confusion());
aFF.SetTangentFaces(Standard_False);
aFF.Init(0, 0);
}
//
aFaceFace.SetParameters(bApp, bCompC2D1, bCompC2D2, aApproxTol);
aFaceFace.SetFuzzyValue(myFuzzyValue);
aFaceFace.SetProgressIndicator(myProgressIndicator);
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbFaceFace=aVFaceFace.Extent();
@@ -359,6 +371,10 @@ void BOPAlgo_PaveFiller::PerformFF()
//=======================================================================
void BOPAlgo_PaveFiller::MakeBlocks()
{
if (myGlue != BOPAlgo_GlueOff) {
return;
}
//
Standard_Integer aNbFF;
//
myErrorStatus=0;

View File

@@ -65,3 +65,4 @@ BOPAlgo_WireSplitter.lxx
BOPAlgo_WireSplitter_1.cxx
BOPAlgo_CellsBuilder.cxx
BOPAlgo_CellsBuilder.hxx
BOPAlgo_GlueEnum.hxx