1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0026619: Tolerances of operands are modified using bop

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 class BOPAlgo_PaveFiller.
This commit is contained in:
pkv
2015-09-25 07:12:10 +03:00
committed by msv
parent 3b5f0ca372
commit fb42c34bd2
32 changed files with 1109 additions and 352 deletions

View File

@@ -23,9 +23,15 @@
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPDS_ShapeInfo.hxx>
#include <BOPDS_DS.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
//=======================================================================
//function :
//purpose :
@@ -421,17 +427,30 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
PostTreat();
}
//
// myErrorStatus
//
// 0 - Ok
//
//=======================================================================
//function : PostTreat
//purpose :
//=======================================================================
void BOPAlgo_Builder::PostTreat()
{
BOPTools_AlgoTools::CorrectTolerances(myShape, 0.05, myRunParallel);
BOPTools_AlgoTools::CorrectShapeTolerances(myShape, myRunParallel);
Standard_Integer i, aNbS;
TopAbs_ShapeEnum aType;
BOPCol_IndexedMapOfShape aMA;
if (myPaveFiller->NonDestructive()) {
// MapToAvoid
aNbS=myDS->NbSourceShapes();
for (i=0; i<aNbS; ++i) {
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
aType=aSI.ShapeType();
if (aType==TopAbs_VERTEX ||
aType==TopAbs_EDGE||
aType==TopAbs_FACE) {
const TopoDS_Shape& aS=aSI.Shape();
aMA.Add(aS);
}
}
}
//
BOPTools_AlgoTools::CorrectTolerances(myShape, aMA, 0.05, myRunParallel);
BOPTools_AlgoTools::CorrectShapeTolerances(myShape, aMA, myRunParallel);
}

View File

@@ -403,8 +403,10 @@ void BOPAlgo_Builder::BuildSplitFaces()
aLE.Append(aSp);
}
//
BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane (aLE, aFF);
//
if (!myPaveFiller->NonDestructive()) {
// speed up for planar faces
BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane (aLE, aFF);
}
// 3 Build split faces
BOPAlgo_BuilderFace& aBF=aVBF.Append1();
aBF.SetFace(aF);

View File

@@ -48,20 +48,6 @@ is
-- 4 - V/V, V/E, E/E, V/F and E/F;
-- 5 - all interferences, default value.
SetNonDestructive(me:out;
theFlag: Boolean from Standard);
---Purpose: Sets the flag <theFlag> that defines
-- the mode of the treatment:
-- the copy of the argument when theFlag is true
-- the argument itself when theFlag is false
NonDestructive(me)
returns Boolean from Standard;
---Purpose: Returns the flag that defines the
-- mode of the treatment:
-- true when the copy of the argument is used
-- false when the argument itself is used
PostTreat (me:out)
is protected;
---Purpose: Provides post-treatment actions
@@ -76,7 +62,6 @@ is
fields
myLevelOfCheck: Integer from Standard is protected;
myNonDestructive: Boolean from Standard is protected;
myNewOldMap : DataMapOfShapeShape from BOPCol is protected;
end CheckerSI;

View File

@@ -76,22 +76,6 @@ void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel)
}
}
//=======================================================================
//function : SetNonDestructive
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::SetNonDestructive(const Standard_Boolean theFlag)
{
myNonDestructive=theFlag;
}
//=======================================================================
//function : NonDestructive
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_CheckerSI::NonDestructive() const
{
return myNonDestructive;
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================

View File

@@ -49,6 +49,7 @@ uses
Iterator from BOPDS,
PIterator from BOPDS,
PaveBlock from BOPDS,
CommonBlock from BOPDS,
Curve from BOPDS,
IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS,
MapOfPaveBlock from BOPDS,
@@ -483,6 +484,69 @@ is
returns Real from Standard;
---Purpose: Returns the additional tolerance
UpdateVertex(me:out;
nV : Integer from Standard;
aTolNew: Real from Standard)
returns Integer from Standard
is protected;
---Purpose:
-- Updates tolerance vertex nV due to V/E interference;
-- It always creates new vertex if nV is from arguments
-- Returns: DS index of updated vertex.
ComputeTolerance(me:out;
theCB:CommonBlock from BOPDS)
returns Real from Standard
is protected;
UpdatePaveBlocksWithSDVertices(me:out)
is protected;
UpdateCommonBlocksWithSDVertices (me:out)
is protected;
UpdateBlocksWithSharedVertices (me:out)
is protected;
EstimatePaveOnCurve (me:out;
nV : Integer from Standard;
theNC : out Curve from BOPDS;
theTolR3D : Real from Standard)
returns Boolean from Standard
is protected;
UpdateEdgeTolerance(me:out;
nE : Integer from Standard;
aTolNew: Real from Standard)
is protected;
SetNonDestructive(me:out;
theFlag:Boolean from Standard);
---Purpose: Sets the flag <theFlag> that defines
-- the mode of treatment: in non-destructive mode
-- the argument shapes are not modified: the copy of sub-shape
-- is created in the result if it is needed to be updated.
SetNonDestructive(me:out)
is protected;
---Purpose: Sets non-destructive mode automatically if the argument
-- contains a locked shape (see TopoDS_Shape::Locked()).
NonDestructive(me)
returns Boolean from Standard;
---Purpose: Returns the flag that defines
-- the mode of treatment: in non-destructive mode
-- the argument shapes are not modified: the copy of sub-shape
-- is created in the result if it is needed to be updated.
SetIsPrimary(me:out;
theFlag:Boolean from Standard)
is protected;
IsPrimary(me)
returns Boolean from Standard
is protected;
fields
myArguments : ListOfShape from BOPCol is protected;
myDS : PDS from BOPDS is protected;
@@ -490,4 +554,6 @@ fields
myContext : Context from IntTools is protected;
mySectionAttribute : SectionAttribute from BOPAlgo is protected;
myFuzzyValue : Real from Standard is protected;
myNonDestructive : Boolean from Standard is protected;
myIsPrimary : Boolean from Standard is protected;
end PaveFiller;

View File

@@ -39,6 +39,8 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
{
myDS=NULL;
myIterator=NULL;
myNonDestructive=Standard_False;
myIsPrimary=Standard_True;
}
//=======================================================================
//function :
@@ -52,6 +54,8 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
{
myDS=NULL;
myIterator=NULL;
myNonDestructive=Standard_False;
myIsPrimary=Standard_True;
}
//=======================================================================
//function : ~
@@ -62,6 +66,38 @@ BOPAlgo_PaveFiller::~BOPAlgo_PaveFiller()
Clear();
}
//=======================================================================
//function : SetNonDestructive
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetNonDestructive(const Standard_Boolean bFlag)
{
myNonDestructive=bFlag;
}
//=======================================================================
//function : NonDestructive
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_PaveFiller::NonDestructive()const
{
return myNonDestructive;
}
//=======================================================================
//function : SetIsPrimary
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetIsPrimary(const Standard_Boolean bFlag)
{
myIsPrimary=bFlag;
}
//=======================================================================
//function : IsPrimary
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_PaveFiller::IsPrimary()const
{
return myIsPrimary;
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
@@ -171,6 +207,7 @@ void BOPAlgo_PaveFiller::Init()
//
// 0 Clear
Clear();
//
// 1.myDS
myDS=new BOPDS_DS(myAllocator);
@@ -187,6 +224,9 @@ void BOPAlgo_PaveFiller::Init()
// 3 myContext
myContext=new IntTools_Context;
//
// 4 NonDestructive flag
SetNonDestructive();
//
myErrorStatus=0;
}
//=======================================================================
@@ -236,27 +276,26 @@ void BOPAlgo_PaveFiller::PerformInternal()
return;
}
//
UpdatePaveBlocksWithSDVertices();
myDS->UpdatePaveBlocks();
// 11
PerformEE();
if (myErrorStatus) {
return;
}
UpdatePaveBlocksWithSDVertices();
// 02
PerformVF();
if (myErrorStatus) {
return;
}
UpdatePaveBlocksWithSDVertices();
// 12
PerformEF();
if (myErrorStatus) {
return;
}
//
MakeSplitEdges();
if (myErrorStatus) {
return;
}
UpdatePaveBlocksWithSDVertices();
//
// 22
PerformFF();
@@ -264,6 +303,15 @@ void BOPAlgo_PaveFiller::PerformInternal()
return;
}
//
UpdateBlocksWithSharedVertices();
//
MakeSplitEdges();
if (myErrorStatus) {
return;
}
//
UpdatePaveBlocksWithSDVertices();
//
MakeBlocks();
if (myErrorStatus) {
return;
@@ -280,7 +328,6 @@ void BOPAlgo_PaveFiller::PerformInternal()
if (myErrorStatus) {
return;
}
//
// 03
PerformVZ();
if (myErrorStatus) {

View File

@@ -24,17 +24,19 @@
#include <TopoDS_Vertex.hxx>
#include <BRepBndLib.hxx>
#include <BOPCol_DataMapOfIntegerInteger.hxx>
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPDS_VectorOfInterfVV.hxx>
#include <BOPDS_ShapeInfo.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPAlgo_Tools.hxx>
//=======================================================================
// function: PerformVV
@@ -100,7 +102,7 @@
//
BOPTools_AlgoTools::MakeVertex(aLV, aVn);
//
// Appennd new vertex to the DS
// Append new vertex to the DS
aSIn.SetShape(aVn);
n=myDS->Append(aSIn);
//
@@ -129,6 +131,15 @@
}
}
//
BOPCol_DataMapIteratorOfDataMapOfIntegerInteger aItDMII;
//
BOPCol_DataMapOfIntegerInteger& aDMII=myDS->ShapesSD();
aItDMII.Initialize(aDMII);
for (; aItDMII.More(); aItDMII.Next()) {
n1=aItDMII.Key();
myDS->InitPaveBlocksForVertex(n1);
}
//
//-----------------------------------------------------scope t
aLV.Clear();
aMBlocks.Clear();

View File

@@ -0,0 +1,230 @@
// Created by: Peter KURNEV
// Copyright (c) 2010-2014 OPEN CASCADE SAS
// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// 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 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.
#include <BOPAlgo_PaveFiller.ixx>
#include <Precision.hxx>
#include <gp_Pnt.hxx>
#include <Bnd_Box.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepBndLib.hxx>
#include <BOPDS_ShapeInfo.hxx>
#include <BOPDS_VectorOfListOfPaveBlock.hxx>
#include <BOPDS_MapOfCommonBlock.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPDS_CommonBlock.hxx>
#include <BOPDS_DS.hxx>
//=======================================================================
//function : SetNonDestructive
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetNonDestructive()
{
if (!myIsPrimary) {
return;
}
//
Standard_Boolean bFlag;
BOPCol_ListIteratorOfListOfShape aItLS;
//
bFlag=Standard_False;
aItLS.Initialize(myArguments);
for(; aItLS.More() && (!bFlag); aItLS.Next()) {
const TopoDS_Shape& aS=aItLS.Value();
bFlag=aS.Locked();
}
myNonDestructive=bFlag;
}
//=======================================================================
//function : UpdateEdgeTolerance
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
const Standard_Real aTol)
{
Standard_Boolean bIsNewShape, bHasShapeSD;
Standard_Integer nV, nVx;
Standard_Real aTolV;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfInteger aIt;
//
BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE);
const BOPCol_ListOfInteger& aLI=aSIE.SubShapes();
//
if (myNonDestructive) {
bIsNewShape=myDS->IsNewShape(nE);
if (!bIsNewShape) {
return;
}
//
aIt.Initialize(aLI);
for (; aIt.More(); aIt.Next()) {
nV = aIt.Value();
bHasShapeSD=myDS->HasShapeSD(nV, nVx);
if (bHasShapeSD) {
continue;
}
bIsNewShape=myDS->IsNewShape(nV);
if (!bIsNewShape) {
return;
}
}
}
//
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
aBB.UpdateEdge(aE, aTol);
Bnd_Box& aBoxE=aSIE.ChangeBox();
BRepBndLib::Add(aE, aBoxE);
//
aIt.Initialize(aLI);
for (; aIt.More(); aIt.Next()) {
nV = aIt.Value();
bHasShapeSD=myDS->HasShapeSD(nV, nVx);
if (bHasShapeSD) {
nV=nVx;
}
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
aTolV = BRep_Tool::Tolerance(aV);
if (aTolV < aTol) {
aBB.UpdateVertex(aV, aTol);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::Add(aV, aBoxV);
}
}
}
//=======================================================================
//function : UpdateVertex
//purpose :
//=======================================================================
Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
(const Standard_Integer nV,
const Standard_Real aTolNew)
{
Standard_Integer nVNew;
Standard_Real aTolV;
BRep_Builder aBB;
nVNew = nV;
if (myDS->IsNewShape(nVNew) ||
myDS->HasShapeSD(nV, nVNew) ||
!myNonDestructive) {
// nV is a new vertex, it has SD or non-destructive mode is not in force
const TopoDS_Vertex& aVSD = *(TopoDS_Vertex*)&myDS->Shape(nVNew);
aTolV = BRep_Tool::Tolerance(aVSD);
if (aTolV < aTolNew) {
aBB.UpdateVertex(aVSD, aTolNew);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVNew);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::Add(aVSD, aBoxV);
}
return nVNew;
}
//
// nV is old vertex
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
aTolV = BRep_Tool::Tolerance(aV);
//
// create new vertex
TopoDS_Vertex aVNew;
gp_Pnt aPV = BRep_Tool::Pnt(aV);
aBB.MakeVertex(aVNew, aPV, Max(aTolV, aTolNew));
//
// append new vertex to DS
BOPDS_ShapeInfo aSIV;
aSIV.SetShapeType(TopAbs_VERTEX);
aSIV.SetShape(aVNew);
nVNew = myDS->Append(aSIV);
//
// bounding box for the new vertex
BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nVNew);
Bnd_Box& aBoxDS = aSIDS.ChangeBox();
BRepBndLib::Add(aVNew, aBoxDS);
//
// add vertex to SD map
myDS->AddShapeSD(nV, nVNew);
//
myDS->InitPaveBlocksForVertex(nV);
//
return nVNew;
}
//=======================================================================
//function : UpdatePaveBlocksWithSDVertices
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdatePaveBlocksWithSDVertices()
{
if (!myNonDestructive) {
return;
}
myDS->UpdatePaveBlocksWithSDVertices();
}
//=======================================================================
//function : UpdateCommonBlocksWithSDVertices
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
{
if (!myNonDestructive) {
return;
}
Standard_Integer aNbPBP;
//
BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
aNbPBP=aPBP.Extent();
if(!aNbPBP) {
return;
}
//
Standard_Integer i, nV1, nV2;
Standard_Real aTolV;
BOPDS_MapOfCommonBlock aMCB;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
Handle(BOPDS_PaveBlock) aPB;
//
aTolV = Precision::Confusion();
//
for (i=0; i<aNbPBP; ++i) {
BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
aPB=aItPB.Value();
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
if (aCB.IsNull()) {
continue;
}
//
if (aMCB.Add(aCB)) {
myDS->SortPaveBlocks(aCB);
aPB->Indices(nV1, nV2);
UpdateVertex(nV1, aTolV);
UpdateVertex(nV2, aTolV);
myDS->UpdateCommonBlockWithSDVertices(aCB);
}
}
}
UpdatePaveBlocksWithSDVertices();
}

View File

@@ -45,7 +45,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
BOPAlgo_VertexEdge() :
BOPAlgo_Algo(),
myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.) {
myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.), myTolVNew(-1.) {
};
//
virtual ~BOPAlgo_VertexEdge(){
@@ -71,18 +71,10 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
myV=aV;
}
//
const TopoDS_Vertex& Vertex()const {
return myV;
}
//
void SetEdge(const TopoDS_Edge& aE) {
myE=aE;
}
//
const TopoDS_Edge& Edge()const {
return myE;
}
//
Standard_Integer Flag()const {
return myFlag;
}
@@ -91,6 +83,10 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
return myT;
}
//
Standard_Real VertexNewTolerance()const {
return myTolVNew;
}
//
void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
@@ -101,7 +97,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
myFlag=myContext->ComputeVE (myV, myE, myT);
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew);
};
//
protected:
@@ -110,6 +106,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
Standard_Integer myIVx;
Standard_Integer myFlag;
Standard_Real myT;
Standard_Real myTolVNew;
TopoDS_Vertex myV;
TopoDS_Edge myE;
Handle(IntTools_Context) myContext;
@@ -137,11 +134,10 @@ void BOPAlgo_PaveFiller::PerformVE()
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, k, aNbVE;
Standard_Real aT, aTolE, aTolV;
Standard_Real aT;
BOPDS_Pave aPave;
BOPDS_PassKey aPK;
BOPDS_MapOfPassKey aMPK;
BRep_Builder aBB;
BOPAlgo_VectorOfVertexEdge aVVE;
//
myErrorStatus=0;
@@ -208,29 +204,28 @@ void BOPAlgo_PaveFiller::PerformVE()
if (!iFlag) {
aVESolver.Indices(nV, nE, nVx);
aT=aVESolver.Parameter();
const TopoDS_Vertex& aV=aVESolver.Vertex();
const TopoDS_Edge& aE=aVESolver.Edge();
// 1
BOPDS_InterfVE& aVE=aVEs.Append1();
aVE.SetIndices(nV, nE);
aVE.SetParameter(aT);
// 2
myDS->AddInterf(nV, nE);
// 3
//
//
BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE);
Handle(BOPDS_PaveBlock)& aPB=*((Handle(BOPDS_PaveBlock)*)&aLPB.First());
//
// 3 update vertex V/E if necessary
Standard_Real aTolVNew = aVESolver.VertexNewTolerance();
nVx=UpdateVertex(nV, aTolVNew);
//4
if (myDS->IsNewShape(nVx)) {
aVE.SetIndexNew(nVx);
}
//5 append ext pave to pave block
aPave.SetIndex(nVx);
aPave.SetParameter(aT);
aPB->AppendExtPave(aPave);
aTolV = BRep_Tool::Tolerance(aV);
aTolE = BRep_Tool::Tolerance(aE);
if ( aTolV < aTolE) {
aBB.UpdateVertex(aV, aTolE);
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVx);
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
BRepBndLib::Add(aV, aBoxDS);
}
}
}//for (k=0; k < aNbVE; ++k) {
}

View File

@@ -569,7 +569,7 @@ void BOPAlgo_PaveFiller::PerformEE()
aMPBToUpdate.Clear();
}
//=======================================================================
//function : PerformVertices
//function : PerformVerticesEE
//purpose :
//=======================================================================
Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
@@ -890,8 +890,8 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
Handle(BOPDS_PaveBlock)& aPB,
BOPDS_MapOfPaveBlock& aMPBToUpdate)
{
Standard_Integer aNbPnt, nE;
gp_Pnt aP;
Standard_Integer nE, nVx, nVSD, iFlag;
Standard_Real aT, aTolVNew;
//
nE = aPB->OriginalEdge();
//
@@ -908,60 +908,44 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
return;
}
//
if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) {
if (aPB->Pave1().Index() == nV ||
aPB->Pave2().Index() == nV) {
return;
}
//
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
nVx = nV;
if (myDS->HasShapeSD(nV, nVSD)) {
nVx = nVSD;
}
//
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nVx);
const TopoDS_Edge& aE = *(TopoDS_Edge*) &myDS->Shape(nE);
aP=BRep_Tool::Pnt(aV);
//
GeomAPI_ProjectPointOnCurve& aProjector=myContext->ProjPC(aE);
aProjector.Perform(aP);
//
aNbPnt = aProjector.NbPoints();
if (aNbPnt) {
Standard_Real aT, aDist;
//Standard_Integer i;
BRep_Builder aBB;
iFlag = myContext->ComputeVE(aV, aE, aT, aTolVNew);
if (iFlag == 0 || iFlag == -4) {
BOPDS_Pave aPave;
//
aDist=aProjector.LowerDistance();
aT=aProjector.LowerDistanceParameter();
//
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
aVEs.SetIncrement(10);
// 1
BOPDS_InterfVE& aVE=aVEs.Append1();
aVE.SetIndices(nV, nE);
aVE.SetParameter(aT);
//
// 2
myDS->AddInterf(nV, nE);
//
aBB.UpdateVertex(aV, aDist);
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
Bnd_Box& aBox=aSIDS.ChangeBox();
BRepBndLib::Add(aV, aBox);
//
aPave.SetIndex(nV);
// 3 update vertex V/E if necessary
nVx=UpdateVertex(nV, aTolVNew);
// 4
if (myDS->IsNewShape(nVx)) {
aVE.SetIndexNew(nVx);
}
// 5 append ext pave to pave block
aPave.SetIndex(nVx);
aPave.SetParameter(aT);
aPB->AppendExtPave(aPave);
//
aMPBToUpdate.Add(aPB);
}
}
/*
// DEBf
{
TopoDS_Compound aCx;
BRep_Builder aBBx;
aBBx.MakeCompound(aCx);
aItMVCPB.Initialize(theMVCPB);
for (; aItMVCPB.More(); aItMVCPB.Next()) {
const TopoDS_Shape& aS=aItMVCPB.Key();
aBBx.Add(aCx, aS);
}
BRepTools::Write(aCx, "cx");
}
// DEBt
*/

View File

@@ -20,8 +20,6 @@
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepBndLib.hxx>
//
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
@@ -47,7 +45,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
BOPAlgo_VertexFace() :
BOPAlgo_Algo(),
myIV(-1), myIF(-1), myIVx(-1),
myFlag(-1), myT1(-1.), myT2(-1.) {
myFlag(-1), myT1(-1.), myT2(-1.), myTolVNew(-1.) {
}
//
virtual ~BOPAlgo_VertexFace(){
@@ -95,6 +93,10 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
aT2=myT2;
}
//
Standard_Real VertexNewTolerance()const {
return myTolVNew;
}
//
void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
@@ -105,7 +107,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2);
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew);
}
//
protected:
@@ -115,6 +117,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
Standard_Integer myFlag;
Standard_Real myT1;
Standard_Real myT2;
Standard_Real myTolVNew;
TopoDS_Vertex myV;
TopoDS_Face myF;
Handle(IntTools_Context) myContext;
@@ -142,8 +145,7 @@ void BOPAlgo_PaveFiller::PerformVF()
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, aNbVF, k;
Standard_Real aT1, aT2, aTolF, aTolV;
BRep_Builder aBB;
Standard_Real aT1, aT2;
BOPAlgo_VectorOfVertexFace aVVF;
//
myErrorStatus=0;
@@ -207,27 +209,25 @@ void BOPAlgo_PaveFiller::PerformVF()
//
aVertexFace.Indices(nV, nF, nVx);
aVertexFace.Parameters(aT1, aT2);
const TopoDS_Vertex& aV=aVertexFace.Vertex();
const TopoDS_Face& aF=aVertexFace.Face();
// 1
BOPDS_InterfVF& aVF=aVFs.Append1();
aVF.SetIndices(nVx, nF);
aVF.SetUV(aT1, aT2);
// 2
myDS->AddInterf(nVx, nF);
// 3
//
// 3 update vertex V/F if necessary
Standard_Real aTolVNew = aVertexFace.VertexNewTolerance();
nVx=UpdateVertex(nVx, 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);
// 4
aTolV = BRep_Tool::Tolerance(aV);
aTolF = BRep_Tool::Tolerance(aF);
if (aTolV < aTolF) {
aBB.UpdateVertex(aV, aTolF);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVx);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::Add(aV, aBoxV);
}
}//for (k=0; k < aNbVF; ++k) {
}// if (iSize) {
else {

View File

@@ -19,6 +19,8 @@
#include <GeomAPI_ProjectPointOnSurf.hxx>
//
#include <Precision.hxx>
#include <Bnd_Box.hxx>
//
#include <TopoDS_Vertex.hxx>
@@ -311,12 +313,25 @@ void BOPAlgo_PaveFiller::PerformEF()
if (bIsOnPave[j]) {
bV[j]=CheckFacePaves(nV[j], aMIFOn, aMIFIn);
if (bV[j]) {
const TopoDS_Vertex& aV=
const TopoDS_Vertex& aV =
(*(TopoDS_Vertex *)(&myDS->Shape(nV[j])));
BOPTools_AlgoTools::UpdateVertex(aE, aT, aV);
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV[j]);
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
BRepBndLib::Add(aV, aBoxDS);
//
Standard_Real f, l, aTolVnew, aDistPP, aTolPC, aTolV;
//
const Handle(Geom_Curve)& aCur = BRep_Tool::Curve(aE, f, l);
//
gp_Pnt aP1 = BRep_Tool::Pnt(aV);
gp_Pnt aP2 = aCur->Value(aT);
//
aDistPP=aP1.Distance(aP2);
aTolPC=Precision::PConfusion();
aTolV=BRep_Tool::Tolerance(aV);
if (aDistPP > (aTolV+aTolPC)) {
aTolVnew=Max(aTolE, aDistPP);
UpdateVertex(nV[j], aTolVnew);
}
}
else {
bIsOnPave[j] = ForceInterfVF(nV[j], nF);
@@ -370,11 +385,6 @@ void BOPAlgo_PaveFiller::PerformEF()
myDS->AddInterf(nE, nF);
break;
}
//update tolerance of edge if needed
if (aTolE < aTolF) {
myDS->UpdateEdgeTolerance(nE, aTolF);
aTolE = aTolF;
}
aEF.SetCommonPart(aCPart);
// 2
myDS->AddInterf(nE, nF);
@@ -451,6 +461,8 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
}
//
// 2 Fuse vertices
aPF.SetIsPrimary(Standard_False);
aPF.SetNonDestructive(myNonDestructive);
aPF.SetArguments(aLS);
aPF.Perform();
iErr=aPF.ErrorStatus();
@@ -530,7 +542,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
}
}
}
// 6 Split PaveBlocksa
// 6 Split PaveBlocks
for (i=1; i<=aNbPBLI; ++i) {
Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
nE=aPB->OriginalEdge();
@@ -615,46 +627,37 @@ Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF
const Standard_Integer nF)
{
Standard_Boolean bRet;
Standard_Integer iFlag, nVx;
Standard_Real U, V, aTolVNew;
//
bRet = Standard_False;
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
const TopoDS_Face& aF = *(TopoDS_Face*) &myDS->Shape(nF);
//
GeomAPI_ProjectPointOnSurf& aProj = myContext->ProjPS(aF);
const gp_Pnt& aP = BRep_Tool::Pnt(aV);
aProj.Perform(aP);
if (!aProj.IsDone()) {
return bRet;
}
Standard_Real aDist, U, V;
//
aDist=aProj.LowerDistance();
aProj.LowerDistanceParameters(U, V);
//
gp_Pnt2d aP2d(U, V);
bRet = myContext->IsPointInFace (aF, aP2d);
if (bRet) {
//Standard_Integer i;
BRep_Builder aBB;
iFlag = myContext->ComputeVF(aV, aF, U, V, aTolVNew);
if (iFlag == 0 || iFlag == -2) {
bRet=!bRet;
//
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
aVFs.SetIncrement(10);
// 1
BOPDS_InterfVF& aVF=aVFs.Append1();
//
aVF.SetIndices(nV, nF);
aVF.SetUV(U, V);
//
// 2
myDS->AddInterf(nV, nF);
//
aBB.UpdateVertex(aV, aDist);
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
BRepBndLib::Add(aV, aBoxDS);
// 3 update vertex V/F if necessary
nVx=UpdateVertex(nV, aTolVNew);
// 4
if (myDS->IsNewShape(nVx)) {
aVF.SetIndexNew(nVx);
}
//
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nV);
aMVIn.Add(nVx);
}
//
return bRet;
}

View File

@@ -217,22 +217,21 @@ void BOPAlgo_PaveFiller::PerformFF()
const TopoDS_Face& aF1=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
const TopoDS_Face& aF2=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
//
if (aMI.Add(nF1)) {
myDS->UpdateFaceInfoOn(nF1);
myDS->UpdateFaceInfoIn(nF1);
}
if (aMI.Add(nF2)) {
myDS->UpdateFaceInfoOn(nF2);
myDS->UpdateFaceInfoIn(nF2);
}
//
aBAS1.Initialize(aF1, Standard_False);
aBAS2.Initialize(aF2, Standard_False);
//
if (aBAS1.GetType() == GeomAbs_Plane &&
aBAS2.GetType() == GeomAbs_Plane) {
Standard_Boolean bToIntersect;
//
if (aMI.Add(nF1)) {
myDS->UpdateFaceInfoOn(nF1);
myDS->UpdateFaceInfoIn(nF1);
}
if (aMI.Add(nF2)) {
myDS->UpdateFaceInfoOn(nF2);
myDS->UpdateFaceInfoIn(nF2);
}
//
bToIntersect = CheckPlanes(nF1, nF2);
if (!bToIntersect) {
myDS->AddInterf(nF1, nF2);
@@ -526,10 +525,11 @@ void BOPAlgo_PaveFiller::MakeBlocks()
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
aTolE = BRep_Tool::Tolerance(aE);
if (aTolR3D > aTolE) {
myDS->UpdateEdgeTolerance(nE, aTolR3D);
UpdateEdgeTolerance(nE, aTolR3D);
}
bInBothFaces = Standard_False;
} else {
}
else {
bInBothFaces = (aFI1.PaveBlocksOn().Contains(aPBOut) ||
aFI1.PaveBlocksIn().Contains(aPBOut))&&
(aFI2.PaveBlocksOn().Contains(aPBOut) ||
@@ -644,6 +644,8 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
//
BOPCol_ListOfShape aLS(theAllocator);
BOPAlgo_PaveFiller aPF(theAllocator);
aPF.SetIsPrimary(Standard_False);
aPF.SetNonDestructive(myNonDestructive);
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
//
@@ -1036,10 +1038,10 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
//function : IsExistingVertex
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex
(const gp_Pnt& aP,
const Standard_Real theTolR3D,
const BOPCol_MapOfInteger& aMVOnIn)const
Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex
(const gp_Pnt& aP,
const Standard_Real theTolR3D,
const BOPCol_MapOfInteger& aMVOnIn)const
{
Standard_Boolean bRet;
Standard_Integer nV, iFlag;
@@ -1077,11 +1079,11 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
//function : IsExistingPaveBlock
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
(const Handle(BOPDS_PaveBlock)& thePB,
const BOPDS_Curve& theNC,
const Standard_Real theTolR3D,
const BOPCol_ListOfInteger& theLSE)
Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
(const Handle(BOPDS_PaveBlock)& thePB,
const BOPDS_Curve& theNC,
const Standard_Real theTolR3D,
const BOPCol_ListOfInteger& theLSE)
{
Standard_Boolean bRet=Standard_True;
//
@@ -1104,6 +1106,8 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
aItLI.Initialize(theLSE);
for (; aItLI.More(); aItLI.Next()) {
nE=aItLI.Value();
if (nE < 0)
continue;
const BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE);
const Bnd_Box& aBoxE=aSIE.Box();
if (!aBoxE.IsOut(aBoxPm)) {
@@ -1160,6 +1164,8 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
const Handle(BOPDS_PaveBlock)& aPB = theMPBOnIn(i);
aPB->Indices(nV21, nV22);
nSp=aPB->Edge();
if (nSp < 0)
continue;
const BOPDS_ShapeInfo& aSISp=myDS->ChangeShapeInfo(nSp);
const TopoDS_Edge& aSp=(*(TopoDS_Edge *)(&aSISp.Shape()));
const Bnd_Box& aBoxSp=aSISp.Box();
@@ -1419,9 +1425,10 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance
//function : GetEFPnts
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::GetEFPnts(const Standard_Integer nF1,
const Standard_Integer nF2,
IntSurf_ListOfPntOn2S& aListOfPnts)
void BOPAlgo_PaveFiller::GetEFPnts
(const Standard_Integer nF1,
const Standard_Integer nF2,
IntSurf_ListOfPntOn2S& aListOfPnts)
{
Standard_Integer nE, nF, nFOpposite, aNbEFs, i;
Standard_Real U1, U2, V1, V2, f, l;
@@ -1626,11 +1633,11 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance
//function : GetStickVertices
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1,
const Standard_Integer nF2,
BOPCol_MapOfInteger& aMVStick,
BOPCol_MapOfInteger& aMVEF,
BOPCol_MapOfInteger& aMI)
void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1,
const Standard_Integer nF2,
BOPCol_MapOfInteger& aMVStick,
BOPCol_MapOfInteger& aMVEF,
BOPCol_MapOfInteger& aMI)
{
Standard_Integer nS1, nS2, nVNew, aTypeInt, i;
//
@@ -1808,7 +1815,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
//function : ProcessOldPaveBlocks
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
(const Standard_Integer theInt,
const BOPDS_IndexedMapOfPaveBlock& aMPBOnIn,
const BOPCol_DataMapOfIntegerListOfInteger& aDMBV,
@@ -1882,11 +1889,11 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
//function : UpdateExistingPaveBlocks
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
(const Handle(BOPDS_PaveBlock)& aPBf,
BOPDS_ListOfPaveBlock& aLPB,
const Standard_Integer nF1,
const Standard_Integer nF2)
void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
(const Handle(BOPDS_PaveBlock)& aPBf,
BOPDS_ListOfPaveBlock& aLPB,
const Standard_Integer nF1,
const Standard_Integer nF2)
{
Standard_Integer nE;
Standard_Boolean bCB;
@@ -2044,7 +2051,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
// function: PutClosingPaveOnCurve
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
{
Standard_Boolean bIsClosed, bHasBounds, bAdded;
Standard_Integer nVC, j;
@@ -2099,7 +2106,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
//function : PreparePostTreatFF
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::PreparePostTreatFF
void BOPAlgo_PaveFiller::PreparePostTreatFF
(const Standard_Integer aInt,
const Standard_Integer aCur,
const Handle(BOPDS_PaveBlock)& aPB,
@@ -2265,3 +2272,120 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
aTolFF = Max(aTolFF, 5.e-6);
}
}
//=======================================================================
//function : UpdateBlocksWithSharedVertices
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdateBlocksWithSharedVertices()
{
if (!myNonDestructive) {
return;
}
//
myErrorStatus=0;
//
Standard_Integer aNbFF;
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aNbFF=aFFs.Extent();
if (!aNbFF) {
return;
}
//
Standard_Boolean bOnCurve, bHasShapeSD;
Standard_Integer i, nF1, nF2, aNbC, j, nV, nVSD;
Standard_Real aTolR3D, aTolV;
BOPCol_MapOfInteger aMF;
//
for (i=0; i<aNbFF; ++i) {
BOPDS_InterfFF& aFF=aFFs(i);
//
BOPDS_VectorOfCurve& aVC=aFF.ChangeCurves();
aNbC=aVC.Extent();
if (!aNbC) {
continue;
}
//
aFF.Indices(nF1, nF2);
aTolR3D=aFF.TolR3D();
//
if (aMF.Add(nF1)) {
myDS->UpdateFaceInfoOn(nF1);
}
if (aMF.Add(nF2)) {
myDS->UpdateFaceInfoOn(nF2);
}
//
// Collect old vertices that are shared for nF1, nF2 ->aMI;
BOPCol_MapOfInteger aMI;
BOPCol_MapIteratorOfMapOfInteger aItMI;
//
BOPDS_FaceInfo& aFI1=myDS->ChangeFaceInfo(nF1);
BOPDS_FaceInfo& aFI2=myDS->ChangeFaceInfo(nF2);
//
const BOPCol_MapOfInteger& aMVOn1=aFI1.VerticesOn();
const BOPCol_MapOfInteger& aMVIn1=aFI1.VerticesIn();
const BOPCol_MapOfInteger& aMVOn2=aFI2.VerticesOn();
const BOPCol_MapOfInteger& aMVIn2=aFI2.VerticesIn();
//
for (j=0; j<2; ++j) {
const BOPCol_MapOfInteger& aMV1=(!j) ? aMVOn1 : aMVIn1;
aItMI.Initialize(aMV1);
for (; aItMI.More(); aItMI.Next()) {
nV=aItMI.Value();
if (myDS->IsNewShape(nV)) {
continue;
}
if (aMVOn2.Contains(nV) || aMVIn2.Contains(nV)) {
aMI.Add(nV);
}
}
}
//
// Try to put vertices aMI on curves
for (j=0; j<aNbC; ++j) {
BOPDS_Curve& aNC=aVC.ChangeValue(j);
//const IntTools_Curve& aIC=aNC.Curve();
//
aItMI.Initialize(aMI);
for (; aItMI.More(); aItMI.Next()) {
nV=aItMI.Value();
//
bHasShapeSD=myDS->HasShapeSD(nV, nVSD);
if (bHasShapeSD) {
continue;
}
//
bOnCurve=EstimatePaveOnCurve(nV, aNC, aTolR3D);
if (!bOnCurve) {
continue;
}
//
const TopoDS_Vertex& aV=*((TopoDS_Vertex *)&myDS->Shape(nV));
aTolV=BRep_Tool::Tolerance(aV);
//
UpdateVertex(nV, aTolV);
}
}//for (j=0; j<aNbC; ++j) {
}//for (i=0; i<aNbFF; ++i) {
//
UpdateCommonBlocksWithSDVertices();
}
//=======================================================================
//function : EstimatePaveOnCurve
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_PaveFiller::EstimatePaveOnCurve
(const Standard_Integer nV,
BOPDS_Curve& aNC,
const Standard_Real aTolR3D)
{
Standard_Boolean bIsVertexOnLine;
Standard_Real aT;
//
const TopoDS_Vertex& aV=*((TopoDS_Vertex *)&myDS->Shape(nV));
const IntTools_Curve& aIC=aNC.Curve();
//
bIsVertexOnLine=myContext->IsVertexOnLine(aV, aIC, aTolR3D, aT);
return bIsVertexOnLine;
}

View File

@@ -57,6 +57,8 @@
#include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_Curve.hxx>
#include <BOPDS_Iterator.hxx>
#include <Precision.hxx>
#include <BOPDS_MapOfCommonBlock.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
@@ -359,13 +361,17 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
Standard_Boolean bCB, bV1, bV2;
Standard_Integer i, nE, nV1, nV2, nSp, aNbPB, aNbVBSE, k;
Standard_Real aT1, aT2;
BOPDS_ListIteratorOfListOfPaveBlock aItPB, aItPBCB;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
Handle(BOPDS_PaveBlock) aPB;
BOPDS_MapOfPaveBlock aMPB(100);
TopoDS_Vertex aV1, aV2;
TopoDS_Edge aE;
BOPAlgo_VectorOfSplitEdge aVBSE;
//
UpdateCommonBlocksWithSDVertices();
//
aNbPBP=aPBP.Extent();
//
for (i=0; i<aNbPBP; ++i) {
BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
@@ -376,17 +382,26 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
aPB->Indices(nV1, nV2);
bV1=myDS->IsNewShape(nV1);
bV2=myDS->IsNewShape(nV2);
bCB=myDS->IsCommonBlock(aPB);
//
if (!(bV1 || bV2)) {
nE=aPB->OriginalEdge();
aPB->SetEdge(nE);
continue;
if (!(bV1 || bV2)) { // no new vertices here
if (!myNonDestructive || (myNonDestructive && !bCB)) {
nE=aPB->OriginalEdge();
aPB->SetEdge(nE);
continue;
}
}
}
//
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
aPB=aItPB.Value();
nE=aPB->OriginalEdge();
const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
if (aSIE.HasFlag()){
continue;
}
//
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
bCB=!aCB.IsNull();
if (bCB) {
@@ -444,6 +459,8 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
nSp=myDS->Append(aSI);
//
if (!aCBk.IsNull()) {
Standard_Real aTolCB = ComputeTolerance(aCBk);
myDS->UpdateEdgeTolerance(nSp, aTolCB);
aCBk->SetEdge(nSp);
}
else {
@@ -452,6 +469,52 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
}
}
//=======================================================================
//function : ComputeTolerance
//purpose :
//=======================================================================
Standard_Real BOPAlgo_PaveFiller::ComputeTolerance
(const Handle(BOPDS_CommonBlock)& theCB)
{
Standard_Integer nE, nF;
Standard_Real aTol, aTolMax;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
BOPCol_ListIteratorOfListOfInteger aItLI;
//
const Handle(BOPDS_PaveBlock)& aPBR = theCB->PaveBlock1();
nE = aPBR->OriginalEdge();
const TopoDS_Edge& aEOr = *(TopoDS_Edge*)&myDS->Shape(nE);
aTolMax = BRep_Tool::Tolerance(aEOr);
//
const BOPDS_ListOfPaveBlock& aLPB = theCB->PaveBlocks();
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
if (aPB == aPBR) {
continue;
}
//
nE = aPB->OriginalEdge();
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
aTol = BRep_Tool::Tolerance(aE);
if (aTol > aTolMax) {
aTolMax=aTol;
}
}
//
const BOPCol_ListOfInteger& aLFI = theCB->Faces();
aItLI.Initialize(aLFI);
for (; aItLI.More(); aItLI.Next()) {
nF = aItLI.Value();
const TopoDS_Face& aF = *(TopoDS_Face*)&myDS->Shape(nF);
//
aTol=BRep_Tool::Tolerance(aF);
if (aTol > aTolMax) {
aTolMax=aTol;
}
}
return aTolMax;
}
//=======================================================================
// function: SplitEdge
// purpose:
//=======================================================================
@@ -732,6 +795,10 @@ void UpdateVertices(const TopoDS_Edge& aE,
//=======================================================================
void BOPAlgo_PaveFiller::Prepare()
{
if (myNonDestructive) {
// do not allow storing pcurves in original edges if non-destructive mode is on
return;
}
TopAbs_ShapeEnum aType[] = {
TopAbs_VERTEX,
TopAbs_EDGE,

View File

@@ -170,8 +170,6 @@ void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
const BOPCol_ListOfShape& myEdges=aCB.Shapes();
//
// 1.Filling mySmartMap
BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane(myEdges, myFace);
//
aIt.Initialize(myEdges);
for(; aIt.More(); aIt.Next()) {
const TopoDS_Edge& aE=(*(TopoDS_Edge *)&aIt.Value());

View File

@@ -14,5 +14,4 @@ BOPAlgo_Builder_3.cxx
BOPAlgo_Builder_4.cxx
BOPAlgo_WireSplitter_1.cxx
BOPAlgo_ListOfCheckResult.hxx
BOPAlgo_PaveFiller_11.cxx

View File

@@ -44,6 +44,7 @@ uses
ListOfInteger from BOPCol,
MapOfInteger from BOPCol,
BaseAllocator from BOPCol,
DataMapOfIntegerListOfInteger from BOPCol,
--
ShapeInfo from BOPDS,
IndexRange from BOPDS,
@@ -627,7 +628,17 @@ is
---Purpose:
--- Updates tolerance of the sub-shapes of the shape with index <theIndex>.
---
UpdatePaveBlocksWithSDVertices(me:out);
UpdatePaveBlockWithSDVertices(me:out;
thePB:PaveBlock from BOPDS);
UpdateCommonBlockWithSDVertices(me:out;
theCB:CommonBlock from BOPDS);
InitPaveBlocksForVertex(me:out;
theNV:Integer from Standard);
BuildBndBoxSolid (me:out;
theIndex:Integer from Standard;
theBox:out Box from Bnd)
@@ -666,6 +677,8 @@ fields
--same domain shapes
myShapesSD : DataMapOfIntegerInteger from BOPCol is protected;
--
myMapVE: DataMapOfIntegerListOfInteger from BOPCol is protected;
--
--interferences
myInterfTB : MapOfPassKey from BOPDS is protected;
myInterfVV : VectorOfInterfVV from BOPDS is protected;

View File

@@ -54,19 +54,17 @@
#include <IntTools_Tools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
#include <algorithm>
//
static
inline void ResetShape(const TopoDS_Shape& aS);
static
inline void ResetShapes(const TopoDS_Shape& aS);
static
void TotalShapes(const TopoDS_Shape& aS,
Standard_Integer& aNbS);
Standard_Integer& aNbS,
BOPCol_MapOfShape& aMS);
static
Standard_Real ComputeParameter(const TopoDS_Vertex& aV,
@@ -97,6 +95,7 @@ BOPDS_DS::BOPDS_DS()
myMapPBCB(100, myAllocator),
myFaceInfoPool(0, myAllocator),
myShapesSD(100, myAllocator),
myMapVE(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(0, myAllocator),
myInterfVE(0, myAllocator),
@@ -129,6 +128,7 @@ BOPDS_DS::BOPDS_DS(const Handle(NCollection_BaseAllocator)& theAllocator)
myMapPBCB(100, myAllocator),
myFaceInfoPool(0, myAllocator),
myShapesSD(100, myAllocator),
myMapVE(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(0, myAllocator),
myInterfVE(0, myAllocator),
@@ -171,6 +171,7 @@ void BOPDS_DS::Clear()
myPaveBlocksPool.Clear();
myFaceInfoPool.Clear();
myShapesSD.Clear();
myMapVE.Clear();
myMapPBCB.Clear();
myInterfTB.Clear();
myInterfVV.Clear();
@@ -338,7 +339,6 @@ Standard_Integer BOPDS_DS::Index(const TopoDS_Shape& theS)const
}
return iRet;
}
//=======================================================================
//function : Init
//purpose :
@@ -354,6 +354,7 @@ void BOPDS_DS::Init()
BOPCol_ListIteratorOfListOfShape aIt;
BOPDS_IndexRange aR;
Handle(NCollection_BaseAllocator) aAllocator;
BOPCol_MapOfShape aMS;
//
// 1 Append Source Shapes
aNb=myArguments.Extent();
@@ -363,21 +364,17 @@ void BOPDS_DS::Init()
//
myRanges.SetIncrement(aNb);
//
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
ResetShapes(aSx);
}
//
aNbS=0;
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
//
aNbSx=0;
TotalShapes(aSx, aNbSx);
TotalShapes(aSx, aNbSx, aMS);
//
aNbS=aNbS+aNbSx;
}
aMS.Clear();
//
myLines.SetIncrement(2*aNbS);
//-----------------------------------------------------scope_1 f
@@ -415,7 +412,6 @@ void BOPDS_DS::Init()
BOPDS_ShapeInfo& aSI=ChangeShapeInfo(j);
//
const TopoDS_Shape& aS=aSI.Shape();
ResetShape(aS);
//
aTS=aSI.ShapeType();
//
@@ -427,7 +423,7 @@ void BOPDS_DS::Init()
const Handle(BRep_TVertex)& TV =
*((Handle(BRep_TVertex)*)&aV.TShape());
aTol = TV->Tolerance();
//
// TODO: non-destructive
myToleranceMap.Bind(j, aTol);
aTol += aFuzz;
TV->Tolerance(aTol);
@@ -449,7 +445,7 @@ void BOPDS_DS::Init()
const Handle(BRep_TEdge)& TE =
*((Handle(BRep_TEdge)*)&aE.TShape());
aTol = TE->Tolerance();
//
// TODO: non-destructive
myToleranceMap.Bind(j, aTol);
aTol += aFuzz;
TE->Tolerance(aTol);
@@ -533,7 +529,7 @@ void BOPDS_DS::Init()
const Handle(BRep_TFace)& TF =
*((Handle(BRep_TFace)*)&aF.TShape());
aTol = TF->Tolerance();
//
// TODO: non-destructive
myToleranceMap.Bind(j, aTol);
aTol += aFuzz;
TF->Tolerance(aTol);
@@ -647,6 +643,54 @@ void BOPDS_DS::Init()
}//for (j=0; j<myNbSourceShapes; ++j) {
//
aMI.Clear();
//-----------------------------------------------------
//
for (nE=0; nE<myNbSourceShapes; ++nE) {
BOPDS_ShapeInfo& aSI=ChangeShapeInfo(nE);
if (aSI.ShapeType()!=TopAbs_EDGE) {
continue;
}
//
const BOPCol_ListOfInteger& aLV=aSI.SubShapes();
aIt1.Initialize(aLV);
for (; aIt1.More(); aIt1.Next()) {
nV=aIt1.Value();
if (myMapVE.IsBound(nV)) {
BOPCol_ListOfInteger& aLE=myMapVE.ChangeFind(nV);
aLE.Append(nE);
}
else {
BOPCol_ListOfInteger aLE(myAllocator);
//
aLE.Append(nE);
myMapVE.Bind(nV, aLE);
}
}
}
//
BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItDMILI;
aItDMILI.Initialize(myMapVE);
for(; aItDMILI.More(); aItDMILI.Next()) {
BOPCol_MapOfInteger aMFence;
BOPCol_ListOfInteger aLEx;
//
nV=aItDMILI.Key();
BOPCol_ListOfInteger& aLE=aItDMILI.ChangeValue();
aIt1.Initialize(aLE);
for (; aIt1.More(); aIt1.Next()) {
nE=aIt1.Value();
if(aMFence.Add(nE)) {
aLEx.Append(nE);
}
}
//
aLE.Clear();
aIt1.Initialize(aLEx);
for (; aIt1.More(); aIt1.Next()) {
nE=aIt1.Value();
aLE.Append(nE);
}
}
//-----------------------------------------------------scope_1 t
// 3 myPaveBlocksPool
// 4. myFaceInfoPool
@@ -822,6 +866,7 @@ const BOPDS_ListOfPaveBlock& BOPDS_DS::PaveBlocks
}
return sLPB;
}
//=======================================================================
//function : ChangePaveBlocks
//purpose :
@@ -1375,6 +1420,9 @@ void BOPDS_DS::FaceInfoIn(const Standard_Integer theF,
BOPDS_InterfVF& aVF=aVFs(i);
if(aVF.Contains(theF)) {
nV=aVF.OppositeIndex(theF);
if (HasShapeSD(nV, nVSD)) {
nV=nVSD;
}
theMI.Add(nV);
}
}
@@ -1533,9 +1581,9 @@ void BOPDS_DS::VerticesOnIn
//purpose :
//=======================================================================
void BOPDS_DS::SharedEdges(const Standard_Integer nF1,
const Standard_Integer nF2,
BOPCol_ListOfInteger& theLI,
const Handle(NCollection_BaseAllocator)& aAllocator)
const Standard_Integer nF2,
BOPCol_ListOfInteger& theLI,
const Handle(NCollection_BaseAllocator)& aAllocator)
{
Standard_Integer nE, nSp;
BOPCol_ListIteratorOfListOfInteger aItLI;
@@ -1808,7 +1856,6 @@ Standard_Boolean BOPDS_DS::IsSubShape
return bRet;
}
//=======================================================================
// function: Paves
// purpose:
@@ -1854,7 +1901,6 @@ void BOPDS_DS::Paves(const Standard_Integer theEdge,
theLP.Append(pPaves(i));
}
}
//=======================================================================
// function: UpdateTolerance
// purpose:
@@ -1887,55 +1933,25 @@ void BOPDS_DS::UpdateEdgeTolerance(const Standard_Integer nE,
}
}
}
//=======================================================================
//function : TotalShapes
//purpose :
//=======================================================================
void TotalShapes(const TopoDS_Shape& aS,
Standard_Integer& aNbS)
Standard_Integer& aNbS,
BOPCol_MapOfShape& aMS)
{
TopoDS_Shape *pS;
//
pS=(TopoDS_Shape *)&aS;
if (!pS->Checked()) {
if (aMS.Add(aS)) {
TopoDS_Iterator aIt;
//
pS->Checked(1);
++aNbS;
aIt.Initialize(aS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
TotalShapes(aSx, aNbS);
TotalShapes(aSx, aNbS, aMS);
}
}
}
//=======================================================================
//function : ResetShape
//purpose :
//=======================================================================
void ResetShape(const TopoDS_Shape& aS)
{
TopoDS_Shape *pS;
//
pS=(TopoDS_Shape *)&aS;
pS->Checked(0);
}
//=======================================================================
//function : ResetShape
//purpose :
//=======================================================================
void ResetShapes(const TopoDS_Shape& aS)
{
TopoDS_Iterator aIt;
//
ResetShape(aS);
aIt.Initialize(aS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
ResetShape(aSx);
}
}
//=======================================================================
//function : ComputeParameter
//purpose :
@@ -2283,3 +2299,84 @@ void CollectEdges(const BOPDS_DS& theDS,
}
}
}
//=======================================================================
//function : UpdatePaveBlocksWithSDVertices
//purpose :
//=======================================================================
void BOPDS_DS::UpdatePaveBlocksWithSDVertices()
{
Standard_Integer i, aNbPBP;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
//
BOPDS_VectorOfListOfPaveBlock& aPBP=myPaveBlocksPool;
//
aNbPBP=aPBP.Size();
for (i = 0; i < aNbPBP; ++i) {
BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
//
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
Handle(BOPDS_PaveBlock)& aPB = aItPB.ChangeValue();
UpdatePaveBlockWithSDVertices(aPB);
}// for (; aItPB.More(); aItPB.Next()) {
}// for (i = 0; i < aNbPBP; ++i) {
}
//=======================================================================
//function : UpdatePaveBlockWithSDVertices
//purpose :
//=======================================================================
void BOPDS_DS::UpdatePaveBlockWithSDVertices
(const Handle(BOPDS_PaveBlock)& thePB)
{
Standard_Integer nV1, nV2;
BOPDS_Pave aPave1, aPave2;
//
aPave1 = thePB->Pave1();
aPave2 = thePB->Pave2();
//
nV1 = aPave1.Index();
nV2 = aPave2.Index();
//
if (HasShapeSD(nV1, nV1)) {
aPave1.SetIndex(nV1);
thePB->SetPave1(aPave1);
}
//
if (HasShapeSD(nV2, nV2)) {
aPave2.SetIndex(nV2);
thePB->SetPave2(aPave2);
}
}
//=======================================================================
//function : UpdateCommonBlockWithSDVertices
//purpose :
//=======================================================================
void BOPDS_DS::UpdateCommonBlockWithSDVertices
(const Handle(BOPDS_CommonBlock)& theCB)
{
const BOPDS_ListOfPaveBlock& aLPB = theCB->PaveBlocks();
BOPDS_ListIteratorOfListOfPaveBlock aItPB(aLPB);
for (; aItPB.More(); aItPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
UpdatePaveBlockWithSDVertices(aPB);
}
}
//=======================================================================
//function : InitPaveBlocksForVertex
//purpose :
//=======================================================================
void BOPDS_DS::InitPaveBlocksForVertex(const Standard_Integer theNV)
{
Standard_Integer nE;
BOPCol_ListIteratorOfListOfInteger aItLE;
//
if (myMapVE.IsBound(theNV)) {
const BOPCol_ListOfInteger& aLE=myMapVE.Find(theNV);
aItLE.Initialize(aLE);
for (; aItLE.More(); aItLE.Next()) {
nE=aItLE.Value();
ChangePaveBlocks(nE);
}
}
}

View File

@@ -288,10 +288,10 @@ is
theS :out Shape from TopoDS);
CorrectTolerances (myclass;
theS: Shape from TopoDS;
theTolMax: Real from Standard =0.0001;
theRunParallel: Boolean from Standard=Standard_False);
theS: Shape from TopoDS;
theMapToAvoid:IndexedMapOfShape from BOPCol;
theTolMax: Real from Standard =0.0001;
theRunParallel: Boolean from Standard=Standard_False);
---Purpose:
-- Provides valid values of tolerances for the shape <theS>
-- <theTolMax> is max value of the tolerance that can be
@@ -300,21 +300,23 @@ is
-- perform.
CorrectCurveOnSurface (myclass;
theS: Shape from TopoDS;
theTolMax: Real from Standard =0.0001;
theRunParallel: Boolean from Standard=Standard_False);
theS: Shape from TopoDS;
theMapToAvoid:IndexedMapOfShape from BOPCol;
theTolMax: Real from Standard =0.0001;
theRunParallel: Boolean from Standard=Standard_False);
---Purpose:
-- Provides valid values of tolerances for the shape <theS>
-- in terms of BRepCheck_InvalidCurveOnSurface.
CorrectPointOnCurve (myclass;
theS: Shape from TopoDS;
theTolMax: Real from Standard =0.0001;
theRunParallel: Boolean from Standard=Standard_False);
theS: Shape from TopoDS;
theMapToAvoid:IndexedMapOfShape from BOPCol;
theTolMax: Real from Standard =0.0001;
theRunParallel: Boolean from Standard=Standard_False);
---Purpose:
-- Provides valid values of tolerances for the shape <theS>
-- in terms of BRepCheck_InvalidPointOnCurve.
MakeNewVertex (myclass;
aP1 : Pnt from gp;
aTol: Real from Standard;
@@ -440,6 +442,7 @@ is
CorrectShapeTolerances (myclass;
theS: Shape from TopoDS;
theMapToAvoid:IndexedMapOfShape from BOPCol;
theRunParallel: Boolean from Standard=Standard_False);
---Purpose:
-- Corrects tolerance values of the sub-shapes of the shape <theS> if needed.

View File

@@ -85,11 +85,13 @@
static
void CheckEdge (const TopoDS_Edge& E,
const Standard_Real aMaxTol);
const Standard_Real aMaxTol,
const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
const TopoDS_Face& S,
const Standard_Real aMaxTol);
const Standard_Real aMaxTol,
const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
const Adaptor3d_Curve& Other,
@@ -98,15 +100,23 @@ static
Standard_Real& aNewTolerance);
static
void CorrectVertexTolerance(const TopoDS_Edge& aE);
void CorrectVertexTolerance(const TopoDS_Edge& aE,
const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
void CorrectWires(const TopoDS_Face& aF);
void CorrectWires(const TopoDS_Face& aF,
const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
void UpdateEdges(const TopoDS_Face& aF);
void UpdateEdges(const TopoDS_Face& aF,
const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
void UpdateShape(const TopoDS_Shape& aS,
const Standard_Real aTol,
const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
Standard_Real IntersectCurves2d(const gp_Pnt& aPV,
@@ -124,7 +134,7 @@ static
class BOPTools_CPC {
public:
BOPTools_CPC()
: myMaxTol(1.e-7) {
: myMaxTol(1.e-7), mypMapToAvoid(0L) {
}
//
~BOPTools_CPC() {
@@ -146,13 +156,19 @@ class BOPTools_CPC {
return myMaxTol;
}
//
void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
mypMapToAvoid = &aMapToAvoid;
}
//
void Perform() {
CheckEdge(myEdge, myMaxTol);
Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
CheckEdge(myEdge, myMaxTol, *mypMapToAvoid);
}
protected:
Standard_Real myMaxTol;
TopoDS_Edge myEdge;
const BOPCol_IndexedMapOfShape* mypMapToAvoid;
};
//
//=======================================================================
@@ -172,7 +188,7 @@ typedef BOPCol_Cnt
//=======================================================================
class BOPTools_CWT {
public:
BOPTools_CWT() {
BOPTools_CWT() : mypMapToAvoid(0L) {
}
//
~BOPTools_CWT() {
@@ -182,12 +198,18 @@ class BOPTools_CWT {
myFace=aF;
}
//
void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
mypMapToAvoid = &aMapToAvoid;
}
//
void Perform() {
CorrectWires(myFace);
Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
CorrectWires(myFace, *mypMapToAvoid);
}
//
protected:
TopoDS_Face myFace;
const BOPCol_IndexedMapOfShape* mypMapToAvoid;
};
//=======================================================================
typedef BOPCol_NCVector<BOPTools_CWT> BOPTools_VectorOfCWT;
@@ -207,7 +229,7 @@ typedef BOPCol_Cnt
class BOPTools_CDT {
public:
BOPTools_CDT()
: myMaxTol(1.e-7) {
: myMaxTol(1.e-7), mypMapToAvoid(0L) {
}
//
~BOPTools_CDT() {
@@ -225,14 +247,20 @@ class BOPTools_CDT {
myMaxTol=aMaxTol;
}
//
void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
mypMapToAvoid = &aMapToAvoid;
}
//
void Perform() {
CorrectEdgeTolerance (myEdge, myFace, myMaxTol);
Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
CorrectEdgeTolerance (myEdge, myFace, myMaxTol, *mypMapToAvoid);
}
//
protected:
Standard_Real myMaxTol;
TopoDS_Edge myEdge;
TopoDS_Face myFace;
const BOPCol_IndexedMapOfShape* mypMapToAvoid;
};
//=======================================================================
typedef BOPCol_NCVector<BOPTools_CDT> BOPTools_VectorOfCDT;
@@ -251,7 +279,7 @@ typedef BOPCol_Cnt
//=======================================================================
class BOPTools_CVT {
public:
BOPTools_CVT() {
BOPTools_CVT() : mypMapToAvoid(0L) {
}
//
~BOPTools_CVT() {
@@ -261,12 +289,18 @@ class BOPTools_CVT {
myEdge=aE;
}
//
void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
mypMapToAvoid = &aMapToAvoid;
}
//
void Perform() {
CorrectVertexTolerance(myEdge);
Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
CorrectVertexTolerance(myEdge, *mypMapToAvoid);
}
//
protected:
TopoDS_Edge myEdge;
const BOPCol_IndexedMapOfShape* mypMapToAvoid;
};
//
//=======================================================================
@@ -286,7 +320,7 @@ typedef BOPCol_Cnt
//=======================================================================
class BOPTools_CET {
public:
BOPTools_CET() {
BOPTools_CET() : mypMapToAvoid(0L) {
}
//
~BOPTools_CET() {
@@ -296,12 +330,18 @@ class BOPTools_CET {
myFace=aF;
}
//
void SetMapToAvoid(const BOPCol_IndexedMapOfShape& aMapToAvoid) {
mypMapToAvoid = &aMapToAvoid;
}
//
void Perform() {
UpdateEdges(myFace);
Standard_ProgramError_Raise_if(!mypMapToAvoid, "mypMapToAvoid is null");
UpdateEdges(myFace, *mypMapToAvoid);
}
//
protected:
TopoDS_Face myFace;
const BOPCol_IndexedMapOfShape* mypMapToAvoid;
};
//=======================================================================
typedef BOPCol_NCVector<BOPTools_CET> BOPTools_VectorOfCET;
@@ -323,11 +363,12 @@ typedef BOPCol_Cnt
//=======================================================================
void BOPTools_AlgoTools::CorrectTolerances
(const TopoDS_Shape& aShape,
const BOPCol_IndexedMapOfShape& aMapToAvoid,
const Standard_Real aMaxTol,
const Standard_Boolean bRunParallel)
{
BOPTools_AlgoTools::CorrectPointOnCurve(aShape, aMaxTol, bRunParallel);
BOPTools_AlgoTools::CorrectCurveOnSurface(aShape, aMaxTol, bRunParallel);
BOPTools_AlgoTools::CorrectPointOnCurve(aShape, aMapToAvoid, aMaxTol, bRunParallel);
BOPTools_AlgoTools::CorrectCurveOnSurface(aShape, aMapToAvoid, aMaxTol, bRunParallel);
}
//
//=======================================================================
@@ -336,6 +377,7 @@ void BOPTools_AlgoTools::CorrectTolerances
//=======================================================================
void BOPTools_AlgoTools::CorrectPointOnCurve
(const TopoDS_Shape& aS,
const BOPCol_IndexedMapOfShape& aMapToAvoid,
const Standard_Real aMaxTol,
const Standard_Boolean bRunParallel)
{
@@ -348,6 +390,7 @@ void BOPTools_AlgoTools::CorrectPointOnCurve
BOPTools_CPC& aCPC=aVCPC.Append1();
aCPC.SetEdge(aE);
aCPC.SetMaxTol(aMaxTol);
aCPC.SetMapToAvoid(aMapToAvoid);
}
//
//======================================================
@@ -360,6 +403,7 @@ void BOPTools_AlgoTools::CorrectPointOnCurve
//=======================================================================
void BOPTools_AlgoTools::CorrectCurveOnSurface
(const TopoDS_Shape& aS,
const BOPCol_IndexedMapOfShape& aMapToAvoid,
const Standard_Real aMaxTol,
const Standard_Boolean bRunParallel)
{
@@ -373,6 +417,7 @@ void BOPTools_AlgoTools::CorrectCurveOnSurface
//
BOPTools_CWT& aCWT=aVCWT.Append1();
aCWT.SetFace(aF);
aCWT.SetMapToAvoid(aMapToAvoid);
//
aExpE.Init(aF, TopAbs_EDGE);
for (; aExpE.More(); aExpE.Next()) {
@@ -382,6 +427,7 @@ void BOPTools_AlgoTools::CorrectCurveOnSurface
aCDT.SetEdge(aE);
aCDT.SetFace(aF);
aCDT.SetMaxTol(aMaxTol);
aCDT.SetMapToAvoid(aMapToAvoid);
}
}
//
@@ -397,6 +443,7 @@ void BOPTools_AlgoTools::CorrectCurveOnSurface
//=======================================================================
void BOPTools_AlgoTools::CorrectShapeTolerances
(const TopoDS_Shape& aShape,
const BOPCol_IndexedMapOfShape& aMapToAvoid,
const Standard_Boolean bRunParallel)
{
TopExp_Explorer aExp;
@@ -408,6 +455,7 @@ void BOPTools_AlgoTools::CorrectShapeTolerances
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExp.Current();
BOPTools_CVT& aCVT=aVCVT.Append1();
aCVT.SetEdge(aE);
aCVT.SetMapToAvoid(aMapToAvoid);
}
//
//======================================================
@@ -419,6 +467,7 @@ void BOPTools_AlgoTools::CorrectShapeTolerances
const TopoDS_Face& aF = *(TopoDS_Face*)&aExp.Current();
BOPTools_CET& aCET=aVCET.Append1();
aCET.SetFace(aF);
aCET.SetMapToAvoid(aMapToAvoid);
}
//
//======================================================
@@ -431,7 +480,8 @@ void BOPTools_AlgoTools::CorrectShapeTolerances
// purpose : Correct tolerances for Vertices on Edge
//=======================================================================
void CheckEdge (const TopoDS_Edge& Ed,
const Standard_Real aMaxTol)
const Standard_Real aMaxTol,
const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Real aTolE, aTol, aD2, aNewTolerance, dd;
gp_Pnt aPC;
@@ -483,7 +533,7 @@ void CheckEdge (const TopoDS_Edge& Ed,
if (aD2 > aTol) {
aNewTolerance=sqrt(aD2)+dd;
if (aNewTolerance<aMaxTol)
TV->UpdateTolerance(aNewTolerance);
UpdateShape(aV, aNewTolerance, aMapToAvoid);
}
}
aItPR.Next();
@@ -505,7 +555,7 @@ void CheckEdge (const TopoDS_Edge& Ed,
if (aD2 > aTol) {
aNewTolerance=sqrt(aD2)+dd;
if (aNewTolerance<aMaxTol)
TV->UpdateTolerance(aNewTolerance);
UpdateShape(aV, aNewTolerance, aMapToAvoid);
}
}
}
@@ -518,7 +568,8 @@ void CheckEdge (const TopoDS_Edge& Ed,
// Function : CorrectWires
// purpose :
//=======================================================================
void CorrectWires(const TopoDS_Face& aFx)
void CorrectWires(const TopoDS_Face& aFx,
const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Boolean bIsPeriodic;
Standard_Integer i, aNbV;
@@ -593,10 +644,8 @@ void CorrectWires(const TopoDS_Face& aFx)
}// for (; aIt1.More(); aIt1.Next()) {
}// for (; aIt.More(); aIt.Next()) {
if (aD2max>aTol2) {
BRep_Builder aBB;
//
aTol=sqrt(aD2max);
aBB.UpdateVertex(aV, aTol);
UpdateShape(aV, aTol, aMapToAvoid);
}
}// for (i=1; i<=aNbV; ++i) {
}
@@ -666,7 +715,8 @@ Standard_Real IntersectCurves2d(const gp_Pnt& aPV,
//=======================================================================
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
const TopoDS_Face& S,
const Standard_Real aMaxTol)
const Standard_Real aMaxTol,
const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
//
// 1. Minimum of conditions to Perform
@@ -806,9 +856,8 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
Tol, SameParameter, aNewTol);
if (ok) {
if (aNewTol<aMaxTol) {
TE->UpdateTolerance(aNewTol+Delta);
//
CorrectVertexTolerance(myShape);
UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
CorrectVertexTolerance(myShape, aMapToAvoid);
}
}
@@ -820,8 +869,8 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
ok = Validate(myHCurve->Curve(),ACS,Tol,SameParameter, aNewTol);
if (ok) {
if (aNewTol<aMaxTol) {
TE->UpdateTolerance(aNewTol+Delta);
CorrectVertexTolerance(myShape);
UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
CorrectVertexTolerance(myShape, aMapToAvoid);
}
}
}
@@ -876,8 +925,8 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
Tol,Standard_True, aNewTol);
if (okx) {
if (aNewTol<aMaxTol) {
TE->UpdateTolerance(aNewTol+Delta);
CorrectVertexTolerance(myShape);
UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
CorrectVertexTolerance(myShape, aMapToAvoid);
}
}
}
@@ -888,7 +937,8 @@ void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
//function : CorrectVertexTolerance
//purpose :
//=======================================================================
void CorrectVertexTolerance(const TopoDS_Edge& aE)
void CorrectVertexTolerance(const TopoDS_Edge& aE,
const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Real aTolE, aTolV;
TopoDS_Iterator aIt;
@@ -899,8 +949,7 @@ void CorrectVertexTolerance(const TopoDS_Edge& aE)
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aIt.Value());
aTolV=BRep_Tool::Tolerance(aV);
if (aTolV<aTolE) {
Handle(BRep_TVertex)& aTV= *((Handle(BRep_TVertex)*)&aV.TShape());
aTV->UpdateTolerance(aTolE);
UpdateShape(aV, aTolE, aMapToAvoid);
}
}
}
@@ -1022,11 +1071,11 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
// Function : UpdateEdges
// purpose :
//=======================================================================
void UpdateEdges(const TopoDS_Face& aF)
void UpdateEdges(const TopoDS_Face& aF,
const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Real aTolF, aTolE, aTolV;
TopoDS_Iterator aItF, aItW, aItE;
BRep_Builder aBB;
//
aTolE=aTolF= BRep_Tool::Tolerance(aF);
aItF.Initialize(aF);
@@ -1038,22 +1087,46 @@ void UpdateEdges(const TopoDS_Face& aF)
const TopoDS_Edge& aE=*((TopoDS_Edge*)&aItW.Value());
aTolE = BRep_Tool::Tolerance(aE);
if (aTolE < aTolF) {
aBB.UpdateEdge(aE, aTolF);
UpdateShape(aE, aTolF, aMapToAvoid);
aTolE = aTolF;
}
//UpdateVertices(aE);
}
}
else {
const TopoDS_Vertex& aV=*(TopoDS_Vertex*)&aItF.Value();
aTolV = BRep_Tool::Tolerance(aV);
if (aTolV < aTolE) {
aBB.UpdateVertex(aV, aTolF);
UpdateShape(aV, aTolF, aMapToAvoid);
}
}
}
}
//=======================================================================
//function : UpdateShape
//purpose :
//=======================================================================
void UpdateShape(const TopoDS_Shape& aS,
const Standard_Real aTol,
const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
if (aMapToAvoid.Contains(aS)) {
return;
}
//
TopAbs_ShapeEnum aType;
BRep_Builder aBB;
//
aType=aS.ShapeType();
if (aType==TopAbs_EDGE) {
const TopoDS_Edge& aE = *((TopoDS_Edge*)&aS);
aBB.UpdateEdge(aE, aTol);
}
else if (aType==TopAbs_VERTEX) {
const TopoDS_Vertex& aV = *((TopoDS_Vertex*)&aS);
aBB.UpdateVertex(aV, aTol);
}
}
//=======================================================================
// Function : ComputeTolerance
// purpose :
//=======================================================================

View File

@@ -154,7 +154,24 @@ is
--- 2. the edge does not contain 3d curve and pcurves (-2)
--- 3. projection algorithm failed (-3)
---
ComputeVE (me:mutable;
aV : Vertex from TopoDS;
aE : Edge from TopoDS;
aT :out Real from Standard;
aTolVnew:out Real from Standard)
returns Integer from Standard;
---Purpose:
--- Computes parameter of the vertex aV on
--- the edge aE.
--- Returns zero if the distance between vertex
--- and edge is less than sum of tolerances,
--- otherwise and for following conditions returns
--- negative value
--- 1. the edge is degenerated (-1)
--- 2. the edge does not contain 3d curve and pcurves (-2)
--- 3. projection algorithm failed (-3)
ComputeVF (me:mutable;
aV : Vertex from TopoDS;
aF : Face from TopoDS;
@@ -171,6 +188,23 @@ is
--- 2. distance is more than sum of tolerances (-2)
--- 3. projection point out or on the boundaries of face (-3)
---
ComputeVF (me:mutable;
aV : Vertex from TopoDS;
aF : Face from TopoDS;
U : out Real from Standard;
V : out Real from Standard;
aTolVnew:out Real from Standard)
returns Integer from Standard;
---Purpose:
--- Computes UV parameters of the vertex aV on face aF
--- Returns zero if the distance between vertex and face is
--- less than or equal the sum of tolerances and the projection
--- point lays inside boundaries of the face.
--- For following conditions returns negative value
--- 1. projection algorithm failed (-1)
--- 2. distance is more than sum of tolerances (-2)
--- 3. projection point out or on the boundaries of face (-3)
StatePointFace(me:mutable;
aF : Face from TopoDS;

View File

@@ -509,6 +509,20 @@ Standard_Integer IntTools_Context::ComputeVE
(const TopoDS_Vertex& aV1,
const TopoDS_Edge& aE2,
Standard_Real& aT)
{
Standard_Real aTolVnew;
//
return ComputeVE(aV1, aE2, aT, aTolVnew);
}
//=======================================================================
//function : ComputeVE
//purpose :
//=======================================================================
Standard_Integer IntTools_Context::ComputeVE
(const TopoDS_Vertex& aV1,
const TopoDS_Edge& aE2,
Standard_Real& aT,
Standard_Real& aTolVnew)
{
if (BRep_Tool::Degenerated(aE2)) {
return -1;
@@ -539,6 +553,8 @@ Standard_Integer IntTools_Context::ComputeVE
aTolE2=BRep_Tool::Tolerance(aE2);
aTolSum = aTolV1 + aTolE2 + Precision::Confusion();
//
aTolVnew=aDist+aTolE2;
//
aT=aProjector.LowerDistanceParameter();
if (aDist > aTolSum) {
return -4;
@@ -546,7 +562,7 @@ Standard_Integer IntTools_Context::ComputeVE
return 0;
}
//=======================================================================
//function : ComputeVS
//function : ComputeVF
//purpose :
//=======================================================================
Standard_Integer IntTools_Context::ComputeVF
@@ -554,6 +570,21 @@ Standard_Integer IntTools_Context::ComputeVF
const TopoDS_Face& aF2,
Standard_Real& U,
Standard_Real& V)
{
Standard_Real aTolVnew;
//
return ComputeVF(aV1, aF2, U, V, aTolVnew);
}
//=======================================================================
//function : ComputeVF
//purpose :
//=======================================================================
Standard_Integer IntTools_Context::ComputeVF
(const TopoDS_Vertex& aV1,
const TopoDS_Face& aF2,
Standard_Real& U,
Standard_Real& V,
Standard_Real& aTolVnew)
{
Standard_Real aTolV1, aTolF2, aTolSum, aDist;
gp_Pnt aP;
@@ -574,7 +605,10 @@ Standard_Integer IntTools_Context::ComputeVF
aTolV1=BRep_Tool::Tolerance(aV1);
aTolF2=BRep_Tool::Tolerance(aF2);
aTolSum=aTolV1+aTolF2;
//
aTolSum=aTolV1 + aTolF2 + Precision::Confusion();
aTolVnew=aDist+aTolF2;
//
if (aDist > aTolSum) {
// the distance is too large
return -2;

View File

@@ -187,8 +187,10 @@ void IntTools_ShrunkRange::Perform()
return;
}
//
aTol1 = aTolV1+aTolE;
aTol2 = aTolV2+aTolE;
//aTol1 = aTolV1+aTolE;
//aTol2 = aTolV2+aTolE;
aTol1 = Max(aTolV1, aTolE);
aTol2 = Max(aTolV2, aTolE);
//
aCoeff1 = (aTolE>0.05) ? 1. : 2.;
aCoeff2 = aCoeff1;

View File

@@ -2727,14 +2727,14 @@ static Standard_Integer OCC25043 (Draw_Interpretor& theDI,
}
else
{
theDI << "Info. Faulty shape if found in source shape\n";
theDI << "Info. Faulty shape is found in source shape\n";
}
}
}
}
else
{
theDI << "Error. Problems are not detected. Test is not performed.";
theDI << "Problems are not detected. Test is not performed.";
}
return 0;

View File

@@ -1,5 +1,3 @@
puts "TODO #23876 ALL: Error : The bopcut cannot be built."
restore [locate_data_file case_9_edge.brep] a
restore [locate_data_file case_9_wire3.brep] b
settolerance a 0.1

View File

@@ -1,5 +1,5 @@
puts "TODO OCC26018 ALL: Error : The area of the resulting shape is"
puts "TODO OCC26018 Linux: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_et3_401-ta6037.prt.2.gdml.tcl]
## image is differ from application

View File

@@ -1,5 +1,5 @@
puts "TODO ?OCC26017 Windows: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO ?OCC26017 Windows: Error : The area of the resulting shape is"
puts "TODO ?OCC26017 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO ?OCC26017 ALL: Error : The area of the resulting shape is"
puts "TODO ?OCC26017 ALL: Error : The gdml is not valid. The area is"
source [locate_data_file 20000_et4_401-ta6319.prt.2.gdml.tcl]

View File

@@ -3,7 +3,7 @@
puts "TODO OCC26020 ALL: Error: bopcheck failed"
puts "TODO OCC26020 Linux: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO OCC26020 Linux: Error : The area of the resulting shape is"
puts "TODO OCC26020 ALL: Error : The area of the resulting shape is"
# planar face
plane pln_f1 590.6877421677151 -519.8775759738943 -93.555747452441423 0.64798185367609173 0.7547095802227719 -0.10263024323494339

View File

@@ -1,9 +1,5 @@
puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO OCC25917 ALL: Error : The square of result shape is"
if { [regexp {Debug mode} [dversion]] } {
puts "TODO OCC25917 ALL: TEST INCOMPLETE"
puts "TODO OCC25917 ALL: Tcl Exception"
}
puts "========================"
puts " OCC472 "

View File

@@ -1,8 +1,5 @@
puts "TODO OCC25917 ALL: Error : The command is not valid. The square is"
if { [regexp {Debug mode} [dversion]] } {
puts "TODO OCC25917 ALL: TEST INCOMPLETE"
puts "TODO OCC25917 ALL: Tcl Exception"
}
puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO OCC25917 ALL: Error : The square of result shape is"
puts "========================"
puts " OCC472 "

View File

@@ -1,8 +1,4 @@
if { [regexp {Debug mode} [dversion]] } {
puts "TODO OCC25917 ALL: TEST INCOMPLETE"
puts "TODO OCC25917 ALL: Tcl Exception"
}
puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "========================"
puts " OCC472 "
puts "(case 3)"
@@ -20,8 +16,6 @@ checkshape b2
bfuse result b1 b2
set nb_v_good 66
set nb_e_edge 107
set square 31657.5
set square 229.516
set 2dviewer 0

View File

@@ -8,13 +8,15 @@ puts ""
pload QAcommands
restore [locate_data_file bug25043.brep] a
subshape a v 3
settolerance a_3 0.0005
decho off
set info [OCC25043 a]
decho on
if { [regexp "Faulty shape if found in source shape" ${info}] == 1 } {
if { [regexp "Faulty shape is found in source shape" ${info}] == 1 } {
puts "OK : Good result"
} else {
} elseif { [regexp "Problems are not detected" $info] != 1 } {
puts "Error : Wrong result"
}