pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetFuzzyValue(myFuzzyValue);
+ pPF->SetNonDestructive(myNonDestructive);
//
pPF->Perform();
//
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <TopoDS_Compound.hxx>
-#include <TopoDS_Shape.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 :
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
myOrigins(100, myAllocator),
- myFuzzyValue(0.)
+ myFuzzyValue(0.),
+ myNonDestructive(Standard_False)
{
}
//=======================================================================
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
myOrigins(100, myAllocator),
- myFuzzyValue(0.)
+ myFuzzyValue(0.),
+ myNonDestructive(Standard_False)
{
}
//=======================================================================
return myFuzzyValue;
}
//=======================================================================
+//function : SetNonDestructive
+//purpose :
+//=======================================================================
+void BOPAlgo_Builder::SetNonDestructive(const Standard_Boolean theFlag)
+{
+ myNonDestructive = theFlag;
+}
+//=======================================================================
+//function : NonDestructive
+//purpose :
+//=======================================================================
+Standard_Boolean BOPAlgo_Builder::NonDestructive() const
+{
+ return myNonDestructive;
+}
+//=======================================================================
// function: CheckData
// purpose:
//=======================================================================
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetFuzzyValue(myFuzzyValue);
+ pPF->SetNonDestructive(myNonDestructive);
//
pPF->Perform();
//
void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller)
{
myEntryPoint=0;
+ myNonDestructive = theFiller.NonDestructive();
+ myFuzzyValue = theFiller.FuzzyValue();
PerformInternal(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);
}
Standard_EXPORT virtual void SetArguments (const BOPCol_ListOfShape& theLS);
Standard_EXPORT const BOPCol_ListOfShape& Arguments() const;
-
+
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
Standard_EXPORT virtual void PerformWithFiller (const BOPAlgo_PaveFiller& theFiller);
//! Returns the additional tolerance
Standard_EXPORT Standard_Real FuzzyValue() const;
+ //! Sets the flag that defines the mode of treatment.
+ //! In non-destructive mode the argument shapes are not modified. Instead
+ //! a copy of a sub-shape is created in the result if it is needed to be updated.
+ //! This flag is taken into account if internal PaveFiller is used only.
+ //! In the case of calling PerformWithFiller the corresponding flag of that PaveFiller
+ //! is in force.
+ Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag);
+ //! Returns the flag that defines the mode of treatment.
+ //! In non-destructive mode the argument shapes are not modified. Instead
+ //! a copy of a sub-shape is created in the result if it is needed to be updated.
+ Standard_EXPORT Standard_Boolean NonDestructive() const;
protected:
BOPCol_DataMapOfShapeListOfShape mySplits;
BOPCol_DataMapOfShapeShape myOrigins;
Standard_Real myFuzzyValue;
-
+ Standard_Boolean myNonDestructive;
private:
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItPB.Value();
- const Handle(BOPDS_PaveBlock)& aPBR=myDS->RealPaveBlock(aPB);
+ Handle(BOPDS_PaveBlock) aPBR=myDS->RealPaveBlock(aPB);
//
nSpR=aPBR->Edge();
const TopoDS_Shape& aSpR=myDS->Shape(nSpR);
}
//
virtual void Perform() {
- Standard_Real aT1, aT2;
+ Standard_Real aT1, aT2, dummy;
//
BOPAlgo_Algo::UserBreak();
- myFlag=myContext->ComputeVF(myV, myF, aT1, aT2);
+ myFlag = myContext->ComputeVF(myV, myF, aT1, aT2, dummy);
}
//
protected:
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);
}
Bnd_Box aBox;
BRepBndLib::Add(aSx, aBox);
+ aBox.SetGap(aBox.GetGap() + Precision::Confusion());
//
BOPAlgo_ShapeBox& aSB=aVSB.Append1();
aSB.SetShape(aSx);
}
}
//=======================================================================
-//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 :
//=======================================================================
//! 4 - V/V, V/E, E/E, V/F and E/F;
//! 5 - all interferences, default value.
Standard_EXPORT void SetLevelOfCheck (const Standard_Integer theLevel);
-
- //! 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
- Standard_EXPORT void SetNonDestructive (const Standard_Boolean theFlag);
-
- //! 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
- Standard_EXPORT Standard_Boolean NonDestructive() const;
-
-
-
protected:
Standard_Integer myLevelOfCheck;
- Standard_Boolean myNonDestructive;
BOPCol_DataMapOfShapeShape myNewOldMap;
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetFuzzyValue(myFuzzyValue);
+ pPF->SetNonDestructive(myNonDestructive);
pPF->Perform();
//
myEntryPoint = 1;
{
myDS=NULL;
myIterator=NULL;
+ myNonDestructive=Standard_False;
+ myIsPrimary=Standard_True;
}
//=======================================================================
//function :
{
myDS=NULL;
myIterator=NULL;
+ myNonDestructive=Standard_False;
+ myIsPrimary=Standard_True;
}
//=======================================================================
//function : ~
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 :
//=======================================================================
// 3 myContext
myContext=new IntTools_Context;
//
+ // 4 NonDestructive flag
+ SetNonDestructive();
+ //
myErrorStatus=0;
}
//=======================================================================
return;
}
//
+ UpdatePaveBlocksWithSDVertices();
myDS->UpdatePaveBlocks();
// 11
PerformEE();
if (myErrorStatus) {
return;
}
+ UpdatePaveBlocksWithSDVertices();
// 02
PerformVF();
if (myErrorStatus) {
return;
}
+ UpdatePaveBlocksWithSDVertices();
// 12
PerformEF();
if (myErrorStatus) {
return;
}
+ UpdatePaveBlocksWithSDVertices();
//
- MakeSplitEdges();
+ // 22
+ PerformFF();
if (myErrorStatus) {
return;
}
//
- // 22
- PerformFF();
+ UpdateBlocksWithSharedVertices();
+ //
+ MakeSplitEdges();
if (myErrorStatus) {
return;
}
//
+ UpdatePaveBlocksWithSDVertices();
+ //
MakeBlocks();
if (myErrorStatus) {
return;
if (myErrorStatus) {
return;
}
- //
// 03
PerformVZ();
if (myErrorStatus) {
class BOPDS_DS;
class BOPAlgo_SectionAttribute;
class BOPDS_PaveBlock;
+class BOPDS_CommonBlock;
class TopoDS_Vertex;
class gp_Pnt;
class BOPDS_Curve;
class TopoDS_Face;
-
class BOPAlgo_PaveFiller : public BOPAlgo_Algo
{
public:
Standard_EXPORT BOPAlgo_PaveFiller();
-Standard_EXPORT virtual ~BOPAlgo_PaveFiller();
+
+ Standard_EXPORT virtual ~BOPAlgo_PaveFiller();
Standard_EXPORT BOPAlgo_PaveFiller(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT void SetSectionAttribute (const BOPAlgo_SectionAttribute& theSecAttr);
+ //! Sets the flag that defines the mode of treatment.
+ //! In non-destructive mode the argument shapes are not modified. Instead
+ //! a copy of a sub-shape is created in the result if it is needed to be updated.
+ Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag);
+
+ //! Returns the flag that defines the mode of treatment.
+ //! In non-destructive mode the argument shapes are not modified. Instead
+ //! a copy of a sub-shape is created in the result if it is needed to be updated.
+ Standard_EXPORT Standard_Boolean NonDestructive() const;
+
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
//! Sets the additional tolerance
protected:
-
+ //! Sets non-destructive mode automatically if an argument
+ //! contains a locked sub-shape (see TopoDS_Shape::Locked()).
+ Standard_EXPORT void SetNonDestructive();
+
+ Standard_EXPORT void SetIsPrimary(const Standard_Boolean theFlag);
+
+ Standard_EXPORT Standard_Boolean IsPrimary() const;
+
Standard_EXPORT virtual void PerformInternal();
Standard_EXPORT virtual void Clear();
Standard_EXPORT void MakeBlocks();
Standard_EXPORT void MakePCurves();
+
+ Standard_EXPORT void MakeSDVertices(const BOPCol_ListOfInteger& theVertIndices);
Standard_EXPORT void ProcessDE();
//! Treatment of vertices that were created in EE intersections.
- Standard_EXPORT void TreatNewVertices (const BOPCol_IndexedDataMapOfShapeInteger& theMVI, BOPCol_IndexedDataMapOfShapeListOfShape& theImages);
+ Standard_EXPORT void TreatNewVertices(const BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, BOPCol_IndexedDataMapOfShapeListOfShape& theImages);
//! Put paves on the curve <aBC> in case when <aBC>
//! in the map <theDMI>.
Standard_EXPORT void UpdatePaveBlocks (const BOPCol_DataMapOfIntegerInteger& theDMI);
+ //! Updates tolerance vertex nV due to V/E interference.
+ //! It always creates new vertex if nV is from arguments.
+ //! @return DS index of updated vertex.
+ Standard_EXPORT Standard_Integer UpdateVertex(const Standard_Integer nV,
+ const Standard_Real aTolNew);
+
+ Standard_EXPORT void UpdatePaveBlocksWithSDVertices();
+
+ Standard_EXPORT void UpdateCommonBlocksWithSDVertices();
+
+ Standard_EXPORT void UpdateBlocksWithSharedVertices();
+
+ Standard_EXPORT Standard_Boolean EstimatePaveOnCurve(const Standard_Integer nV,
+ const BOPDS_Curve& theNC,
+ const Standard_Real theTolR3D);
+
+ Standard_EXPORT void UpdateEdgeTolerance(const Standard_Integer nE,
+ const Standard_Real aTolNew);
+
+ Standard_EXPORT void RemovePaveBlocks(const BOPCol_MapOfInteger theEdges);
+
+ Standard_EXPORT void CorrectToleranceOfSE();
BOPCol_ListOfShape myArguments;
BOPDS_PDS myDS;
Handle(IntTools_Context) myContext;
BOPAlgo_SectionAttribute mySectionAttribute;
Standard_Real myFuzzyValue;
+ Standard_Boolean myNonDestructive;
+ Standard_Boolean myIsPrimary;
private:
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPAlgo_Tools.hxx>
+#include <BOPCol_DataMapOfIntegerInteger.hxx>
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPDS_VectorOfInterfVV.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BRepBndLib.hxx>
+#include <BRep_TVertex.hxx>
+#include <BRep_Tool.hxx>
#include <gp_Pnt.hxx>
#include <IntTools_Context.hxx>
#include <NCollection_BaseAllocator.hxx>
+#include <Precision.hxx>
+#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
void BOPAlgo_PaveFiller::PerformVV()
{
Standard_Boolean bWithSubShape;
- Standard_Integer n1, n2, iFlag, nX, n, aSize, i, j, k, aNbBlocks;
+ Standard_Integer n1, n2, iFlag, aSize, k, aNbBlocks;
Handle(NCollection_BaseAllocator) aAllocator;
- BOPCol_ListIteratorOfListOfInteger aItLI, aItLI2;
- TopoDS_Vertex aVn;
- BOPDS_ShapeInfo aSIn;
//
myErrorStatus=0;
//
return;
}
//
- aSIn.SetShapeType(TopAbs_VERTEX);
-
BOPDS_VectorOfInterfVV& aVVs=myDS->InterfVV();
aVVs.SetIncrement(aSize);
//
NCollection_BaseAllocator::CommonBaseAllocator();
BOPCol_IndexedDataMapOfIntegerListOfInteger aMILI(100, aAllocator);
BOPCol_DataMapOfIntegerListOfInteger aMBlocks(100, aAllocator);
- BOPCol_ListOfShape aLV(aAllocator);
//
// 1. Map V/LV
for (; myIterator->More(); myIterator->Next()) {
for (k=0; k<aNbBlocks; ++k) {
const BOPCol_ListOfInteger& aLI=aMBlocks.Find(k);
//
- aLV.Clear();
- aItLI.Initialize(aLI);
- for (; aItLI.More(); aItLI.Next()) {
- nX=aItLI.Value();
- const TopoDS_Shape& aV=myDS->Shape(nX);
- aLV.Append(aV);
- }
- //
- BOPTools_AlgoTools::MakeVertex(aLV, aVn);
- //
- // Appennd new vertex to the DS
- aSIn.SetShape(aVn);
- n=myDS->Append(aSIn);
- //
- BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(n);
- Bnd_Box& aBox=aSIDS.ChangeBox();
- BRepBndLib::Add(aVn, aBox);
- //
- // Fill ShapesSD
- aItLI.Initialize(aLI);
- for (i=0; aItLI.More(); aItLI.Next(), ++i) {
- n1=aItLI.Value();
- myDS->AddShapeSD(n1, n);
- //
- aItLI2.Initialize(aLI);
- for (j=0; aItLI2.More(); aItLI2.Next(), ++j) {
- if (j>i) {
- n2=aItLI2.Value();
- //
- myDS->AddInterf(n1, n2);
- BOPDS_InterfVV& aVV=aVVs.Append1();
- //
- aVV.SetIndices(n1, n2);
- aVV.SetIndexNew(n);
- }
- }
- }
+ MakeSDVertices(aLI);
+ }
+ //
+ 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();
aMILI.Clear();
}
+
+//=======================================================================
+// function: PerformVV
+// purpose:
+//=======================================================================
+void BOPAlgo_PaveFiller::MakeSDVertices(const BOPCol_ListOfInteger& theVertIndices)
+{
+ TopoDS_Vertex aVSD, aVn;
+ BOPCol_ListIteratorOfListOfInteger aItLI(theVertIndices);
+ BOPCol_ListOfShape aLV;
+ for (; aItLI.More(); aItLI.Next()) {
+ Standard_Integer nX = aItLI.Value();
+ Standard_Integer nSD;
+ if (myDS->HasShapeSD(nX, nSD)) {
+ aVSD = TopoDS::Vertex(myDS->Shape(nSD));
+ }
+ const TopoDS_Shape& aV = myDS->Shape(nX);
+ aLV.Append(aV);
+ }
+ BOPTools_AlgoTools::MakeVertex(aLV, aVn);
+ if (!aVSD.IsNull()) {
+ // update old SD vertex with new value
+ Handle(BRep_TVertex)& aTVertex =
+ reinterpret_cast<Handle(BRep_TVertex)&>(const_cast<Handle(TopoDS_TShape)&>(aVSD.TShape()));
+ aTVertex->Pnt(BRep_Tool::Pnt(aVn));
+ aTVertex->Tolerance(BRep_Tool::Tolerance(aVn));
+ }
+ //
+ // Append new vertex to the DS
+ BOPDS_ShapeInfo aSIn;
+ aSIn.SetShapeType(TopAbs_VERTEX);
+ aSIn.SetShape(aVn);
+ Standard_Integer n = myDS->Append(aSIn);
+ //
+ BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(n);
+ Bnd_Box& aBox = aSIDS.ChangeBox();
+ BRepBndLib::Add(aVn, aBox);
+ aBox.SetGap(aBox.GetGap() + Precision::Confusion());
+ //
+ // Fill ShapesSD
+ BOPDS_VectorOfInterfVV& aVVs = myDS->InterfVV();
+ aVVs.SetIncrement(theVertIndices.Extent());
+ //
+ aItLI.Initialize(theVertIndices);
+ for (; aItLI.More(); aItLI.Next()) {
+ Standard_Integer n1 = aItLI.Value();
+ myDS->AddShapeSD(n1, n);
+ //
+ BOPCol_ListIteratorOfListOfInteger aItLI2 = aItLI;
+ aItLI2.Next();
+ for (; aItLI2.More(); aItLI2.Next()) {
+ Standard_Integer n2 = aItLI2.Value();
+ //
+ myDS->AddInterf(n1, n2);
+ BOPDS_InterfVV& aVV = aVVs.Append1();
+ //
+ aVV.SetIndices(n1, n2);
+ aVV.SetIndexNew(n);
+ }
+ }
+}
--- /dev/null
+// 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.hxx>
+
+#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 || myNonDestructive) {
+ 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);
+ aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
+ //
+ 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);
+ aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
+ }
+ }
+}
+//=======================================================================
+//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);
+ aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
+ }
+ 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);
+ aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
+ //
+ // add vertex to SD map
+ myDS->AddShapeSD(nV, nVNew);
+ //
+ myDS->InitPaveBlocksForVertex(nV);
+ //
+ return nVNew;
+}
+//=======================================================================
+//function : UpdatePaveBlocksWithSDVertices
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdatePaveBlocksWithSDVertices()
+{
+ myDS->UpdatePaveBlocksWithSDVertices();
+}
+//=======================================================================
+//function : UpdateCommonBlocksWithSDVertices
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
+{
+ if (!myNonDestructive) {
+ UpdatePaveBlocksWithSDVertices();
+ 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();
+}
#include <BOPDS_PassKey.hxx>
#include <BOPDS_PaveBlock.hxx>
#include <BOPDS_VectorOfInterfVE.hxx>
+#include <BOPTools_AlgoTools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepBndLib.hxx>
#include <gp_Pnt.hxx>
#include <IntTools_Context.hxx>
+#include <IntTools_Tools.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
+#include <Precision.hxx>
//=======================================================================
//class : BOPAlgo_VertexEdgeEdge
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(){
myV=aV;
}
//
- const TopoDS_Vertex& Vertex()const {
- return myV;
- }
- //
void SetEdge(const TopoDS_Edge& aE) {
myE=aE;
}
//
- const TopoDS_Edge& Edge()const {
+ const TopoDS_Vertex& Vertex() const {
+ return myV;
+ }
+ //
+ const TopoDS_Edge& Edge() const {
return myE;
}
//
return myT;
}
//
+ Standard_Real VertexNewTolerance()const {
+ return myTolVNew;
+ }
+ //
void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
- myFlag=myContext->ComputeVE (myV, myE, myT);
+ myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew);
};
//
protected:
Standard_Integer myIVx;
Standard_Integer myFlag;
Standard_Real myT;
+ Standard_Real myTolVNew;
TopoDS_Vertex myV;
TopoDS_Edge myE;
Handle(IntTools_Context) myContext;
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, k, aNbVE;
- Standard_Real aT, aTolE, aTolV;
+ Standard_Real aT, aT1, aT2, aTS1, aTS2;
BOPDS_Pave aPave;
BOPDS_PassKey aPK;
BOPDS_MapOfPassKey aMPK;
- BRep_Builder aBB;
BOPAlgo_VectorOfVertexEdge aVVE;
//
myErrorStatus=0;
//
+ FillShrunkData(TopAbs_VERTEX, TopAbs_EDGE);
+ //
myIterator->Initialize(TopAbs_VERTEX, TopAbs_EDGE);
iSize=myIterator->ExpectedLength();
if (!iSize) {
continue;
}
//
+ const BOPDS_ListOfPaveBlock& aLPB = myDS->PaveBlocks(nE);
+ if (aLPB.IsEmpty() || !aLPB.First()->HasShrunkData()) {
+ // this is a micro edge, ignore it
+ continue;
+ }
+ //
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape()));
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
//
if (!iFlag) {
aVESolver.Indices(nV, nE, nVx);
aT=aVESolver.Parameter();
- const TopoDS_Vertex& aV=aVESolver.Vertex();
- const TopoDS_Edge& aE=aVESolver.Edge();
+ //
+ // check if vertex hits beyond shrunk range, in such case create V-V interf
+ const BOPDS_ListOfPaveBlock& aLPB = myDS->PaveBlocks(nE);
+ const Handle(BOPDS_PaveBlock)& aPB = aLPB.First();
+ Bnd_Box aBox;
+ aPB->Range(aT1, aT2);
+ aPB->ShrunkData(aTS1, aTS2, aBox);
+ IntTools_Range aPaveR[2] = { IntTools_Range(aT1, aTS1), IntTools_Range(aTS2, aT2) };
+ Standard_Real aTol = Precision::Confusion();
+ Standard_Boolean isOnPave = Standard_False;
+ for (Standard_Integer i = 0; i < 2; i++) {
+ if (IntTools_Tools::IsOnPave1(aT, aPaveR[i], aTol)) {
+ Standard_Integer nV1 = (i == 0 ? aPB->Pave1().Index() : aPB->Pave2().Index());
+ if (!myDS->HasInterf(nV, nV1)) {
+ BOPCol_ListOfInteger aLI;
+ aLI.Append(nV);
+ aLI.Append(nV1);
+ MakeSDVertices(aLI);
+ }
+ isOnPave = Standard_True;
+ break;
+ }
+ }
+ if (isOnPave)
+ continue;
+ //
// 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) {
}
#include <BOPDS_PaveBlock.hxx>
#include <BOPDS_VectorOfInterfEE.hxx>
#include <BOPTools_AlgoTools.hxx>
-#include <BRep_Builder.hxx>
+
#include <BRep_Tool.hxx>
#include <BRepBndLib.hxx>
#include <BRepTools.hxx>
+#include <BRepAdaptor_Curve.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <gp_Pnt.hxx>
#include <IntTools_CommonPrt.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
-//
-//
-//
-//
-//
-//
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//class : BOPAlgo_EdgeEdge
}
//
void Perform() {
- myFlag=myContext->ComputeVE (myV, myE, myT);
+ Standard_Real dummy;
+ myFlag = myContext->ComputeVE(myV, myE, myT, dummy);
};
//
protected:
aR21(aT21, aTS21), aR22(aTS22, aT22);
//
const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts();
- aNbCPrts=aCPrts.Length();
+ aNbCPrts = aCPrts.Length();
+ //
+ Standard_Boolean bLineLine = Standard_False;
+ if (aNbCPrts) {
+ const TopoDS_Edge& aOE1 = *(TopoDS_Edge*)&myDS->Shape(nE1);
+ const TopoDS_Edge& aOE2 = *(TopoDS_Edge*)&myDS->Shape(nE2);
+ //
+ BRepAdaptor_Curve aBAC1(aOE1), aBAC2(aOE2);
+ //
+ bLineLine = (aBAC1.GetType() == GeomAbs_Line &&
+ aBAC2.GetType() == GeomAbs_Line);
+ }
+ //
for (i=1; i<=aNbCPrts; ++i) {
const IntTools_CommonPrt& aCPart=aCPrts(i);
//
}
//
BOPTools_AlgoTools::MakeNewVertex(aE1, aT1, aE2, aT2, aVnew);
+ Standard_Real aTolVnew = BRep_Tool::Tolerance(aVnew);
+ if (bLineLine) {
+ // increase tolerance for Line/Line intersection, but do not update
+ // the vertex till its intersection with some other shape
+ Standard_Real aTol = (aCR1.Last() - aCR1.First()) / 2.;
+ if (aTol > aTolVnew) {
+ aTolVnew = aTol;
+ }
+ }
// <-LXBR
{
Standard_Integer nVS[2], iFound;
- Standard_Real aTolVx, aTolVnew, aD2, aDT2;
+ Standard_Real aTolVx, aD2, aDT2;
BOPCol_MapOfInteger aMV;
gp_Pnt aPnew, aPx;
//
nVS[j]=nV[3];
}
//
- aTolVnew=BRep_Tool::Tolerance(aVnew);
aPnew=BRep_Tool::Pnt(aVnew);
//
for (Standard_Integer k1=0; k1<=j; ++k1) {
//
aCPB.SetPaveBlocks(aPB1, aPB2);
aCPB.SetIndexInterf(iX);
+ aCPB.SetTolerance(aTolVnew);
aMVCPB.Add(aVnew, aCPB);
}//case TopAbs_VERTEX:
break;
aMPBToUpdate.Clear();
}
//=======================================================================
-//function : PerformVertices
+//function : PerformVerticesEE
//purpose :
//=======================================================================
Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
//
// 1 prepare arguments
- //
- // <- DEB
- for (i=1; i<=aNbV; ++i) {
- const TopoDS_Shape& aS=theMVCPB.FindKey(i);
- const BOPDS_CoupleOfPaveBlocks& aCPB=theMVCPB.FindFromIndex(i);
- iV=aCPB.IndexInterf();
- aMVI.Add(aS, iV);
- }
- //
// 2 Fuse vertices
- TreatNewVertices(aMVI, aImages);
+ TreatNewVertices(theMVCPB, aImages);
//
// 3 Add new vertices to myDS;
// connect indices to CPB structure
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(iV);
Bnd_Box& aBox=aSIDS.ChangeBox();
BRepBndLib::Add(aV, aBox);
+ aBox.SetGap(aBox.GetGap() + Precision::Confusion());
//
aItLS.Initialize(aLVSD);
for (; aItLS.More(); aItLS.Next()) {
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::TreatNewVertices
- (const BOPCol_IndexedDataMapOfShapeInteger& aMapVI,
+(const BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
BOPCol_IndexedDataMapOfShapeListOfShape& myImages)
{
Standard_Integer i, aNbV;//, aNbVSD;
Standard_Real aTol;
TopoDS_Vertex aVnew;
- TopoDS_Shape aVF;
BOPCol_IndexedMapOfShape aMVProcessed;
BOPCol_MapOfInteger aMFence;
BOPCol_ListIteratorOfListOfInteger aIt;
- BOPCol_IndexedDataMapOfShapeListOfShape aDMVLV;
+ NCollection_Vector<BOPCol_ListOfShape> aVecOfLVSD;
//
- BOPCol_BoxBndTreeSelector aSelector;
BOPCol_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer,
Bnd_Box> aTreeFiller(aBBTree);
BOPAlgo_VectorOfTNV aVTNV;
//
- aNbV = aMapVI.Extent();
+ aNbV = theMVCPB.Extent();
for (i=1; i<=aNbV; ++i) {
- const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMapVI.FindKey(i));
+ const TopoDS_Vertex& aV = *((TopoDS_Vertex*)&theMVCPB.FindKey(i));
Bnd_Box aBox;
//
- aTol=BRep_Tool::Tolerance(aV);
- aBox.SetGap(aTol);
+ aTol = theMVCPB.FindFromIndex(i).Tolerance();
aBox.Add(BRep_Tool::Pnt(aV));
- aBox.Enlarge(aTol);
+ aBox.SetGap(aTol);
//
aTreeFiller.Add(i, aBox);
//
break; // from for(;;)
}
//
- aLIP.Clear();
- aItLIP.Initialize(aLIP1);
- for(; aItLIP.More(); aItLIP.Next()) {
- aIP=aItLIP.Value();
- aLIP.Append(aIP);
- aLIPC.Append(aIP);
- }
- aLIP1.Clear();
+ aLIP = aLIP1;
+ aLIPC.Append(aLIP1); // items of aLIP1 are moved to aLIPC
}// for(;;) {
//
aItLIP.Initialize(aLIPC);
const TopoDS_Vertex& aVP=aVTNV(aIP-1).Vertex();
aLVSD.Append(aVP);
}
- aVF=aLVSD.First();
- aDMVLV.Add(aVF, aLVSD);
+ aVecOfLVSD.Append(aLVSD);
}// for (i=1; i<=aNbV; ++i) {
// Make new vertices
- aNbV = aDMVLV.Extent();
- for (i = 1; i <= aNbV; ++i) {
- const TopoDS_Shape& aV = aDMVLV.FindKey(i);
- const BOPCol_ListOfShape& aLVSD = aDMVLV(i);
- if (aLVSD.IsEmpty()) {
- myImages.Add(aV, aLVSD);
- }
- else {
- BOPCol_ListOfShape* pLVSD=(BOPCol_ListOfShape*)&aLVSD;
- BOPTools_AlgoTools::MakeVertex(*pLVSD, aVnew);
- myImages.Add(aVnew, aLVSD);
- }
+ aNbV = aVecOfLVSD.Size();
+ for (i = 0; i < aNbV; ++i) {
+ const BOPCol_ListOfShape& aLVSD = aVecOfLVSD(i);
+ BOPTools_AlgoTools::MakeVertex(aLVSD, aVnew);
+ myImages.Add(aVnew, aLVSD);
}
}
//=======================================================================
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();
//
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);
- const TopoDS_Edge& aE = *(TopoDS_Edge*) &myDS->Shape(nE);
- aP=BRep_Tool::Pnt(aV);
+ nVx = nV;
+ if (myDS->HasShapeSD(nV, nVSD)) {
+ nVx = nVSD;
+ }
//
- GeomAPI_ProjectPointOnCurve& aProjector=myContext->ProjPC(aE);
- aProjector.Perform(aP);
+ const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nVx);
+ const TopoDS_Edge& aE = *(TopoDS_Edge*) &myDS->Shape(nE);
//
- 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
- */
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(){
aT2=myT2;
}
//
+ Standard_Real VertexNewTolerance()const {
+ return myTolVNew;
+ }
+ //
void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
- myFlag=myContext->ComputeVF(myV, myF, myT1, myT2);
+ myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew);
}
//
protected:
Standard_Integer myFlag;
Standard_Real myT1;
Standard_Real myT2;
+ Standard_Real myTolVNew;
TopoDS_Vertex myV;
TopoDS_Face myF;
Handle(IntTools_Context) myContext;
{
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;
//
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 {
void BOPAlgo_PaveFiller::TreatVerticesEE()
{
Standard_Integer i, aNbS,aNbEEs, nF, nV, iFlag;
- Standard_Real aT1, aT2;
+ Standard_Real aT1, aT2, dummy;
BOPCol_ListIteratorOfListOfInteger aItLI;
Handle(NCollection_BaseAllocator) aAllocator;
//
if (!aMVOn.Contains(nV)) {
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nV)));
const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
- iFlag=myContext->ComputeVF(aV, aF, aT1, aT2);
+ iFlag = myContext->ComputeVF(aV, aF, aT1, aT2, dummy);
if (!iFlag) {
// 1
BOPDS_InterfVF& aVF=aVFs.Append1();
// commercial license or contractual agreement.
+#include <Precision.hxx>
+
#include <Bnd_Box.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
+#include <BOPCol_DataMapOfShapeReal.hxx>
#include <BOPDS_CommonBlock.hxx>
#include <BOPDS_CoupleOfPaveBlocks.hxx>
#include <BOPDS_Curve.hxx>
#include <IntTools_Range.hxx>
#include <IntTools_SequenceOfCommonPrts.hxx>
#include <IntTools_Tools.hxx>
+#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
-//
-//
-//
-//
-//
-//
-//
-//
-//
//=======================================================================
//class : BOPAlgo_EdgeFace
//purpose :
TopAbs_ShapeEnum aType;
BOPDS_ListIteratorOfListOfPaveBlock aIt;
BOPAlgo_VectorOfEdgeFace aVEdgeFace;
- BRep_Builder aBB;
//-----------------------------------------------------scope f
//
aAllocator=NCollection_BaseAllocator::CommonBaseAllocator();
const BOPCol_MapOfInteger& aMIFIn=aFI.VerticesIn();
//~~~
const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeFace.CommonParts();
- aNbCPrts=aCPrts.Length();
+ aNbCPrts = aCPrts.Length();
+ //
+ Standard_Boolean bLinePlane = Standard_False;
+ if (aNbCPrts) {
+ BRepAdaptor_Curve aBAC(aE);
+ BRepAdaptor_Surface aBAS(aF, Standard_False);
+ //
+ bLinePlane = (aBAC.GetType() == GeomAbs_Line &&
+ aBAS.GetType() == GeomAbs_Plane);
+ }
+
for (i=1; i<=aNbCPrts; ++i) {
const IntTools_CommonPrt& aCPart=aCPrts(i);
aType=aCPart.Type();
bIsOnPave[0]=IntTools_Tools::IsInRange(aR1, aR, aTolToDecide);
bIsOnPave[1]=IntTools_Tools::IsInRange(aR2, aR, aTolToDecide);
//
- if (bIsOnPave[0] && bIsOnPave[1]) {
+ if ((bIsOnPave[0] && bIsOnPave[1]) ||
+ (bLinePlane && (bIsOnPave[0] || bIsOnPave[1]))) {
bV[0]=CheckFacePaves(nV[0], aMIFOn, aMIFIn);
bV[1]=CheckFacePaves(nV[1], aMIFOn, aMIFIn);
if (bV[0] && bV[1]) {
if (bV[j]) {
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);
continue;
}
//
+ Standard_Real aTolVnew = BRep_Tool::Tolerance(aVnew);
+ aTolVnew = Max(aTolVnew, Max(aTolE, aTolF));
+ BRep_Builder().UpdateVertex(aVnew, aTolVnew);
+ if (bLinePlane) {
+ // increase tolerance for Line/Plane intersection, but do not update
+ // the vertex till its intersection with some other shape
+ IntTools_Range aCR = aCPart.Range1();
+ aTolVnew = Max(aTolVnew, (aCR.Last() - aCR.First()) / 2.);
+ }
+ //
const gp_Pnt& aPnew = BRep_Tool::Pnt(aVnew);
- Standard_Real aTolV = BRep_Tool::Tolerance(aVnew);
- aTolV = Max(aTolV, Max(aTolE, aTolF));
//
- if (!myContext->IsPointInFace(aPnew, aF, aTolV)) {
+ if (!myContext->IsPointInFace(aPnew, aF, aTolVnew)) {
continue;
}
//
- aBB.UpdateVertex(aVnew, aTolV);
- //
aMIEFC.Add(nF);
// 1
BOPDS_InterfEF& aEF=aEFs.Append1();
//
aCPB.SetPaveBlocks(aPB, aPB);
aCPB.SetIndexInterf(iX);
+ aCPB.SetTolerance(aTolVnew);
aMVCPB.Add(aVnew, aCPB);
}
}
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);
////aAllocator.Nullify();
}
//=======================================================================
-//function : PerformVertices1
+//function : PerformVerticesEF
//purpose :
//=======================================================================
Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
}
//
Standard_Integer nVx, nVSD, iV, iErr, nE, iFlag, iX, i, aNbPBLI;
- Standard_Real aT;
+ Standard_Real aT, dummy;
TopoDS_Shape aV;
BOPCol_ListIteratorOfListOfShape aItLS;
BOPCol_ListIteratorOfListOfInteger aItLI;
BOPCol_DataMapOfShapeInteger aMVI(100, theAllocator);
BOPDS_IndexedDataMapOfPaveBlockListOfInteger aMPBLI(100, theAllocator);
BOPAlgo_PaveFiller aPF(theAllocator);
+ BOPCol_DataMapOfShapeReal aMVIniTol;
//
aSI.SetShapeType(TopAbs_VERTEX);
BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF();
//
// 1 prepare arguments
for (i=1; i<=aNbV; ++i) {
- const TopoDS_Shape& aS=theMVCPB.FindKey(i);
- aLS.Append(aS);
+ const TopoDS_Vertex& aV = TopoDS::Vertex(theMVCPB.FindKey(i));
+ aLS.Append(aV);
+ // if an enlarged tolerance is associated with the vertex then update it
+ // remembering its initial tolerance
+ Standard_Real aTolEnlarged = theMVCPB.FindFromIndex(i).Tolerance();
+ Standard_Real aIniTol = BRep_Tool::Tolerance(aV);
+ if (aTolEnlarged > aIniTol) {
+ aMVIniTol.Bind(aV, aIniTol);
+ BRep_Builder().UpdateVertex(aV, aTolEnlarged);
+ }
}
//
// 2 Fuse vertices
+ aPF.SetIsPrimary(Standard_False);
+ aPF.SetNonDestructive(myNonDestructive);
aPF.SetArguments(aLS);
aPF.Perform();
iErr=aPF.ErrorStatus();
}
aPDS=aPF.PDS();
//
+ // Recompute common vertex for each SD group containing enlarged vertex;
+ // for that first fill in the map of SD vertex -> its counterparts
+ BOPCol_IndexedDataMapOfShapeListOfShape aImages;
+ aItLS.Initialize(aLS);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aVx = aItLS.Value();
+ nVx = aPDS->Index(aVx);
+ //
+ if (aPDS->HasShapeSD(nVx, nVSD)) {
+ aV = aPDS->Shape(nVSD);
+ }
+ else {
+ aV = aVx;
+ }
+ BOPCol_ListOfShape* pLst = aImages.ChangeSeek(aV);
+ if (!pLst) {
+ pLst = &aImages.ChangeFromIndex(aImages.Add(aV, BOPCol_ListOfShape()));
+ }
+ pLst->Append(aVx);
+ }
// 3 Add new vertices to theDS;
+ for (i = 1; i <= aImages.Extent(); i++) {
+ TopoDS_Vertex aV = TopoDS::Vertex(aImages.FindKey(i));
+ const BOPCol_ListOfShape& aLVSD = aImages.FindFromIndex(i);
+ Standard_Boolean isReset = Standard_False;
+ BOPCol_ListIteratorOfListOfShape it(aLVSD);
+ for (; it.More(); it.Next()) {
+ const TopoDS_Vertex& aVx = TopoDS::Vertex(it.Value());
+ const Standard_Real* pTolIni = aMVIniTol.Seek(aVx);
+ if (pTolIni) {
+ // reset enlarged vertex tolerance to the initial value
+ reinterpret_cast<BRep_TVertex*>(aVx.TShape().operator->())->Tolerance(*pTolIni);
+ isReset = Standard_True;
+ }
+ }
+ TopoDS_Vertex aVnew = aV;
+ if (isReset && aLVSD.Extent() > 1) {
+ // make new vertex again
+ BOPTools_AlgoTools::MakeVertex(aLVSD, aVnew);
+ }
+ // index of new vertex in theDS -> iV
+ aSI.SetShape(aVnew);
+ iV = myDS->Append(aSI);
+ //
+ BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(iV);
+ Bnd_Box& aBox = aSIDS.ChangeBox();
+ BRepBndLib::Add(aVnew, aBox);
+ aBox.SetGap(aBox.GetGap() + Precision::Confusion());
+ //
+ aMVI.Bind(aV, iV);
+ }
+ //
// 4 Map PaveBlock/ListOfVertices to add to this PaveBlock ->aMPBLI
aItLS.Initialize(aLS);
for (; aItLS.More(); aItLS.Next()) {
else {
aV=aVx;
}
- // index of new vertex in theDS -> iV
- if (!aMVI.IsBound(aV)) {
- aSI.SetShape(aV);
- iV=myDS->Append(aSI);
- //
- BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(iV);
- Bnd_Box& aBox=aSIDS.ChangeBox();
- BRepBndLib::Add(aV, aBox);
- //
- aMVI.Bind(aV, iV);
- }
- else {
- iV=aMVI.Find(aV);
- }
+ iV = aMVI.Find(aV);
//
BOPDS_CoupleOfPaveBlocks &aCPB=theMVCPB.ChangeFromKey(aVx);
aCPB.SetIndex(iV);
nVx=aItLI.Value();
const TopoDS_Vertex& aVx=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
//
- iFlag=myContext->ComputeVE (aVx, aE, aT);
+ iFlag=myContext->ComputeVE (aVx, aE, aT, dummy);
if (!iFlag) {
aPave.SetIndex(nVx);
aPave.SetParameter(aT);
}
}
}
- // 6 Split PaveBlocksa
+ // 6 Split PaveBlocks
for (i=1; i<=aNbPBLI; ++i) {
Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
nE=aPB->OriginalEdge();
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);
+ iFlag = myContext->ComputeVF(aV, aF, U, V, aTolVNew);
+ if (iFlag == 0 || iFlag == -2) {
+ bRet=!bRet;
//
- gp_Pnt2d aP2d(U, V);
- bRet = myContext->IsPointInFace (aF, aP2d);
- if (bRet) {
- //Standard_Integer i;
- BRep_Builder aBB;
- //
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;
}
-
#include <BOPDS_ShapeInfo.hxx>
#include <BOPDS_VectorOfCurve.hxx>
#include <BOPDS_VectorOfPoint.hxx>
+#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools3D.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
+#include <BRep_TEdge.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBndLib.hxx>
#include <gp_Pnt.hxx>
#include <IntSurf_ListOfPntOn2S.hxx>
#include <IntSurf_PntOn2S.hxx>
+#include <IntTools.hxx>
#include <IntTools_Context.hxx>
#include <IntTools_Curve.hxx>
#include <IntTools_EdgeFace.hxx>
#include <Precision.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
Standard_Boolean bToSplit, bTangentFaces;
Standard_Integer nF1, nF2, aNbCurves, aNbPoints, i, aNbLP;
Standard_Integer aNbFaceFace, k;
- Standard_Real aApproxTol, aTolR3D, aTolR2D, aTolFF;
+ Standard_Real aApproxTol, aTolR3D, aTolR2D, aTolFF, aTolReal;
BRepAdaptor_Surface aBAS1, aBAS2;
BOPCol_MapOfInteger aMI;
BOPAlgo_VectorOfFaceFace aVFaceFace;
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);
if (bIsDone) {
aTolR3D=aFaceFace.TolReached3d();
aTolR2D=aFaceFace.TolReached2d();
+ aTolReal = aFaceFace.TolReal();
bTangentFaces=aFaceFace.TangentFaces();
//
if (aTolR3D < aTolFF){
aTolR3D=aTolFF;
}
+ if (aTolReal < aTolFF) {
+ aTolReal = aTolFF;
+ }
if (aTolR2D < 1.e-7){
aTolR2D=1.e-7;
}
//
aFF.SetTolR3D(aTolR3D);
aFF.SetTolR2D(aTolR2D);
+ aFF.SetTolReal(aTolReal);
aFF.SetTangentFaces(bTangentFaces);
//
// Curves, Points
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) ||
if (myErrorStatus) {
return;
}
+ // reduce tolerances of section edges where it is appropriate
+ CorrectToleranceOfSE();
//
// update face info
UpdateFaceInfo(aDMExEdges, aDMI);
//
Standard_Boolean bHasPaveBlocks, bOld;
Standard_Integer iErr, nSx, nVSD, iX, iP, iC, j, nV, iV = 0, iE, k;
- Standard_Integer jx, aNbLPBx;
- Standard_Real aT;
+ Standard_Integer aNbLPBx;
TopAbs_ShapeEnum aType;
TopoDS_Shape aV, aE;
BOPCol_ListIteratorOfListOfShape aItLS;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
BOPDS_PDS aPDS;
Handle(BOPDS_PaveBlock) aPB1;
- BOPDS_Pave aPave[2], aPave1[2];
+ BOPDS_Pave aPave[2];
BOPDS_ShapeInfo aSI;
//
BOPCol_ListOfShape aLS(theAllocator);
BOPAlgo_PaveFiller aPF(theAllocator);
+ aPF.SetIsPrimary(Standard_False);
+ aPF.SetNonDestructive(myNonDestructive);
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
//
else {
aSI.SetShapeType(aType);
aSI.SetShape(aSx);
- iE=myDS->Append(aSI);
+ iE = myDS->Append(aSI);
//
aPB1->SetEdge(iE);
}
BOPDS_Curve& aNC=aVNC(iC);
BOPDS_ListOfPaveBlock& aLPBC=aNC.ChangePaveBlocks();
//
- const BOPDS_ListOfPaveBlock& aLPBx=aPDS->PaveBlocks(nSx);
- aNbLPBx=aLPBx.Extent();
+ // check if edge occured to be micro edge;
+ // note we check not the edge aSx itself, but its image in aPDS
+ const BOPDS_ListOfPaveBlock& aLPBx = aPDS->PaveBlocks(nSx);
+ aNbLPBx = aLPBx.Extent();
+ if (aPDS->HasPaveBlocks(nSx) &&
+ (aNbLPBx == 0 || (aNbLPBx == 1 && !aLPBx.First()->HasShrunkData()))) {
+ BOPDS_ListIteratorOfListOfPaveBlock it(aLPBC);
+ for (; it.More(); it.Next()) {
+ if (it.Value() == aPB1) {
+ aLPBC.Remove(it);
+ break;
+ }
+ }
+ continue;
+ }
//
if (bOld && !aNbLPBx) {
aDMExEdges.ChangeFind(aPB1).Append(aPB1);
//
else {
aItLPB.Initialize(aLPBx);
- if (bOld) {
- aPave1[0] = aPB1->Pave1();
- aPave1[1] = aPB1->Pave2();
- }
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPBx=aItLPB.Value();
const Handle(BOPDS_PaveBlock) aPBRx=aPDS->RealPaveBlock(aPBx);
aPave[0]=aPBx->Pave1();
aPave[1]=aPBx->Pave2();
for (j=0; j<2; ++j) {
- jx = 0;
- if (bOld) {
- aT = aPave[j].Parameter();
- if (aT == aPave1[0].Parameter()) {
- jx = 1;
- } else if (aT == aPave1[1].Parameter()) {
- jx = 2;
- }
- //
- if (jx) {
- iV = aPave1[jx-1].Index();
- }
- }
- if (!jx) {
- nV=aPave[j].Index();
- aV=aPDS->Shape(nV);
- //
- if (!aMVI.IsBound(aV)) {
- // index of new vertex in theDS -> iV
- aSI.SetShapeType(TopAbs_VERTEX);
- aSI.SetShape(aV);
- iV=myDS->Append(aSI);
- aMVI.Bind(aV, iV);
- }
- else {
- iV=aMVI.Find(aV);
- }
+ nV = aPave[j].Index();
+ aV = aPDS->Shape(nV);
+ //
+ if (!aMVI.IsBound(aV)) {
+ // index of new vertex in theDS -> iV
+ aSI.SetShapeType(TopAbs_VERTEX);
+ aSI.SetShape(aV);
+ iV = myDS->Append(aSI);
+ aMVI.Bind(aV, iV);
+ }
+ else {
+ iV = aMVI.Find(aV);
}
const BOPDS_Pave& aP1 = !j ? aPB1->Pave1() : aPB1->Pave2();
if (aP1.Parameter() == aPave[j].Parameter() &&
aSI.SetShape(aE);
iE=myDS->Append(aSI);
aMVI.Bind(aE, iE);
+ // update real edge tolerance according to distances in common block if any
+ if (aPDS->IsCommonBlock(aPBx)) {
+ const Handle(BOPDS_CommonBlock)& aCB = aPDS->CommonBlock(aPBx);
+ Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, aPDS, aPF.Context());
+ if (aFF.TolReal() < aTol) {
+ aFF.SetTolReal(aTol);
+ }
+ }
}
else {
iE=aMVI.Find(aE);
//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;
- Standard_Real aTolV;
gp_Pnt aPV;
Bnd_Box aBoxP;
BOPCol_MapIteratorOfMapOfInteger aIt;
//
aIt.Initialize(aMVOnIn);
for (; aIt.More(); aIt.Next()) {
- Bnd_Box aBoxV;
- //
nV=aIt.Value();
- const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nV)));
- aPV=BRep_Tool::Pnt(aV);
- aTolV=BRep_Tool::Tolerance(aV);
- aBoxV.Add(aP);
- aBoxV.Enlarge(aTolV);
+ const BOPDS_ShapeInfo& aSIV=myDS->ShapeInfo(nV);
+ const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&aSIV.Shape()));
+ const Bnd_Box& aBoxV=aSIV.Box();
//
if (!aBoxP.IsOut(aBoxV)) {
iFlag=BOPTools_AlgoTools::ComputeVV(aV, aP, theTolR3D);
//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;
//
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)) {
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();
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVn);
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
BRepBndLib::Add(aVn, aBoxDS);
+ aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
//
aLVB.Append(nVn);
}
//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;
//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;
//
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVToUpdate);
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
BRepBndLib::Add(aVToUpdate, aBoxDS);
+ aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
}
}
}
//function : ProcessOldPaveBlocks
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
+void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
(const Standard_Integer theInt,
const BOPDS_IndexedMapOfPaveBlock& aMPBOnIn,
const BOPCol_DataMapOfIntegerListOfInteger& aDMBV,
return;
}
//
- Standard_Real aT;
+ Standard_Real aT, dummy;
Standard_Integer i, nV, nE, iC, aNbPB, iFlag;
BOPCol_ListIteratorOfListOfInteger aItLI;
BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItBV;
if (aMPB.Contains(aPB)) {
continue;
}
+ if (myDS->ShapeInfo(aPB->OriginalEdge()).HasFlag()) { // skip degenerated edges
+ continue;
+ }
//
nE = aPB->Edge();
const BOPDS_ShapeInfo& aSIE = myDS->ShapeInfo(nE);
//
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aSIE.Shape();
//
- iFlag = myContext->ComputeVE(aV, aE, aT);
+ iFlag = myContext->ComputeVE(aV, aE, aT, dummy);
if (!iFlag) {
aMPB.Add(aPB);
PreparePostTreatFF(theInt, iC, aPB, aMSCPB, aMVI, aLPBC);
//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;
myDS->SetCommonBlock(aPB2n, aCB);
myDS->ChangePaveBlocks(nE).Append(aPB2n);
}
- aCB->AddFaces(aFaces);
+ aCB->SetFaces(aFaces);
myDS->SortPaveBlocks(aCB);
//
const Handle(BOPDS_PaveBlock)& aPBNew = aCB->PaveBlocks().First();
// 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;
//function : PreparePostTreatFF
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::PreparePostTreatFF
+void BOPAlgo_PaveFiller::PreparePostTreatFF
(const Standard_Integer aInt,
const Standard_Integer aCur,
const Handle(BOPDS_PaveBlock)& aPB,
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdatePaveBlocks
- (const BOPCol_DataMapOfIntegerInteger& aDMI)
+(const BOPCol_DataMapOfIntegerInteger& aDMI)
{
if (aDMI.IsEmpty()) {
return;
Standard_Boolean bCB, bRebuild;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
BOPDS_MapOfPaveBlock aMPB;
+ BOPCol_MapOfInteger aMicroEdges;
//
- BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
+ BOPDS_VectorOfListOfPaveBlock& aPBP = myDS->ChangePaveBlocksPool();
aNbPBP = aPBP.Extent();
- for (i=0; i<aNbPBP; ++i) {
- BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
+ for (i = 0; i < aNbPBP; ++i) {
+ BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
//
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
- Handle(BOPDS_PaveBlock) aPB=aItPB.Value();
- const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
+ Handle(BOPDS_PaveBlock) aPB = aItPB.Value();
+ const Handle(BOPDS_CommonBlock)& aCB = myDS->CommonBlock(aPB);
bCB = !aCB.IsNull();
if (bCB) {
- aPB=aCB->PaveBlock1();
+ aPB = aCB->PaveBlock1();
}
//
if (aMPB.Add(aPB)) {
bRebuild = Standard_False;
aPB->Indices(nV[0], nV[1]);
aPB->Range(aT[0], aT[1]);
+ // remember the fact if the edge had different vertices before substitution
+ Standard_Boolean wasRegularEdge = (nV[0] != nV[1]);
//
for (j = 0; j < 2; ++j) {
if (aDMI.IsBound(nV[j])) {
bRebuild = Standard_True;
if (!j) {
aPB->SetPave1(aPave);
- } else {
+ }
+ else {
aPB->SetPave2(aPave);
}
}
}
//
if (bRebuild) {
+ Standard_Boolean isDegEdge = myDS->ShapeInfo(aPB->Edge()).HasFlag();
+ if (wasRegularEdge && !isDegEdge && nV[0] == nV[1]) {
+ // now edge has the same vertex on both ends;
+ // check if it is not a regular closed curve.
+ const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(aPB->Edge()));
+ const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV[0]));
+ Standard_Real aLength = IntTools::Length(aE);
+ Standard_Real aTolV = BRep_Tool::Tolerance(aV);
+ if (aLength <= aTolV * 2.) {
+ // micro edge, so mark it for removal
+ aMicroEdges.Add(aPB->Edge());
+ continue;
+ }
+ }
nSp = SplitEdge(aPB->OriginalEdge(), nV[0], aT[0], nV[1], aT[1]);
if (bCB) {
aCB->SetEdge(nSp);
}// for (; aItPB.More(); aItPB.Next()) {
}// for (i=0; i<aNbPBP; ++i) {
aMPB.Clear();
+
+ if (aMicroEdges.Extent())
+ RemovePaveBlocks(aMicroEdges);
}
+//=======================================================================
+//function : RemovePaveBlocks
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::RemovePaveBlocks(const BOPCol_MapOfInteger theEdges)
+{
+ // Remove all pave blocks referring to input edges:
+ //
+ // 1. from the Pave Blocks Pool
+ BOPDS_VectorOfListOfPaveBlock& aPBP = myDS->ChangePaveBlocksPool();
+ Standard_Integer aNbPBP = aPBP.Extent(), i;
+ for (i = 0; i < aNbPBP; ++i) {
+ BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
+ //
+ BOPDS_ListIteratorOfListOfPaveBlock aItPB(aLPB);
+ while (aItPB.More()) {
+ const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
+ if (theEdges.Contains(aPB->Edge()))
+ aLPB.Remove(aItPB);
+ else
+ aItPB.Next();
+ }
+ }
+
+ // 2. from Face Info and section curves
+ BOPCol_MapOfInteger aMPassed;
+ BOPDS_VectorOfInterfFF& aFFs = myDS->InterfFF();
+ Standard_Integer aNbFF = aFFs.Extent(), j;
+ for (i = 0; i < aNbFF; ++i) {
+ BOPDS_InterfFF& aFF = aFFs(i);
+ Standard_Integer nF1, nF2;
+ aFF.Indices(nF1, nF2);
+ //
+ // rebuild pave block maps of face info
+ for (j = 0; j < 2; j++) {
+ Standard_Integer nF = (j == 0 ? nF1 : nF2);
+ if (!aMPassed.Add(nF))
+ continue;
+ BOPDS_FaceInfo& aFI = myDS->ChangeFaceInfo(nF);
+ BOPDS_IndexedMapOfPaveBlock* aIMPB[] = { &aFI.ChangePaveBlocksIn(),
+ &aFI.ChangePaveBlocksOn(), &aFI.ChangePaveBlocksSc() };
+ for (Standard_Integer k = 0; k < 3; k++) {
+ Standard_Integer aNbPB = aIMPB[k]->Extent(), m;
+ for (m = 1; m <= aNbPB; ++m) {
+ const Handle(BOPDS_PaveBlock)& aPB = aIMPB[k]->FindKey(m);
+ if (theEdges.Contains(aPB->Edge()))
+ break;
+ }
+ if (m <= aNbPB) {
+ BOPDS_IndexedMapOfPaveBlock aMPBCopy = *aIMPB[k];
+ aIMPB[k]->Clear();
+ for (m = 1; m <= aNbPB; ++m) {
+ const Handle(BOPDS_PaveBlock)& aPB = aMPBCopy(m);
+ if (!theEdges.Contains(aPB->Edge()))
+ aIMPB[k]->Add(aPB);
+ }
+ }
+ }
+ }
+ // remove from Section pave blocks
+ BOPDS_VectorOfCurve& aVNC = aFF.ChangeCurves();
+ Standard_Integer aNbC = aVNC.Extent();
+ for (j = 0; j < aNbC; ++j) {
+ BOPDS_Curve& aNC = aVNC(j);
+ BOPDS_ListOfPaveBlock& aLPB = aNC.ChangePaveBlocks();
+ BOPDS_ListIteratorOfListOfPaveBlock aItPB(aLPB);
+ while (aItPB.More()) {
+ const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
+ if (theEdges.Contains(aPB->Edge()))
+ aLPB.Remove(aItPB);
+ else
+ aItPB.Next();
+ }
+ }
+ }
+}
+
//=======================================================================
//function : ToleranceFF
//purpose : Computes the TolFF according to the tolerance value and
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,
+ const 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;
+}
+
+//=======================================================================
+//function : CorrectToleranceOfSE
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::CorrectToleranceOfSE()
+{
+ BOPDS_VectorOfInterfFF& aFFs = myDS->InterfFF();
+ NCollection_IndexedDataMap<Standard_Integer,BOPDS_ListOfPaveBlock> aMVIPBs;
+ //
+ // iterate on all sections F-F
+ Standard_Integer aNb = aFFs.Extent(), i;
+ for (i = 0; i < aNb; ++i) {
+ const BOPDS_InterfFF& aFF = aFFs(i);
+ Standard_Real aTolR3D = aFF.TolR3D();
+ Standard_Real aTolReal = aFF.TolReal();
+ if (aTolReal < aTolR3D) {
+ // tolerance of intersection has been increased, so process this intersection
+ const BOPDS_VectorOfCurve& aVNC = aFF.Curves();
+ Standard_Integer aNbC = aVNC.Extent(), k;
+ for (k = 0; k < aNbC; ++k) {
+ const BOPDS_Curve& aNC = aVNC(k);
+ const BOPDS_ListOfPaveBlock& aLPB = aNC.PaveBlocks();
+ BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB);
+ for (; aItLPB.More(); aItLPB.Next()) {
+ const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
+ Standard_Integer nE;
+ if (!aPB->HasEdge(nE)) {
+ continue;
+ }
+ const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(nE));
+ Standard_Real aTolE = BRep_Tool::Tolerance(aE);
+ if (aTolReal < aTolE) {
+ // reduce edge tolerance
+ reinterpret_cast<BRep_TEdge*>(aE.TShape().operator->())->Tolerance(aTolReal);
+ }
+
+ // fill in the map vertex index - pave blocks
+ Handle(BOPDS_PaveBlock) aPBR = myDS->RealPaveBlock(aPB);
+ for (Standard_Integer j=0; j < 2; j++) {
+ Standard_Integer nV = (j == 0 ? aPBR->Pave1().Index() : aPBR->Pave2().Index());
+ BOPDS_ListOfPaveBlock *pPBList = aMVIPBs.ChangeSeek(nV);
+ if (!pPBList) {
+ pPBList = &aMVIPBs.ChangeFromIndex(aMVIPBs.Add(nV, BOPDS_ListOfPaveBlock()));
+ }
+ pPBList->Append(aPBR);
+ }
+ }
+ }
+ }
+ }
+ // try to reduce tolerances of connected vertices
+ aNb = aMVIPBs.Extent();
+ for (i = 1; i <= aNb; ++i) {
+ Standard_Integer nV = aMVIPBs.FindKey(i);
+ const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV));
+ gp_Pnt aP = BRep_Tool::Pnt(aV);
+ //
+ // compute the maximal distance from the vertex to the adjacent edges
+ Standard_Real aMaxTol = 0.;
+ const BOPDS_ListOfPaveBlock& aLPB = aMVIPBs.FindFromIndex(i);
+ BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB);
+ for (; aItLPB.More(); aItLPB.Next()) {
+ const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
+ Standard_Integer nE = aPB->Edge();
+ const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(nE));
+ const BOPDS_Pave& aPave = (aPB->Pave1().Index() == nV ? aPB->Pave1() : aPB->Pave2());
+ BRepAdaptor_Curve aC(aE);
+ gp_Pnt aPonE = aC.Value(aPave.Parameter());
+ Standard_Real aDist = aP.Distance(aPonE);
+ aDist += BRep_Tool::Tolerance(aE);
+ if (aDist > aMaxTol) {
+ aMaxTol = aDist;
+ }
+ }
+ Standard_Real aTolV = BRep_Tool::Tolerance(aV);
+ if (aMaxTol < aTolV) {
+ reinterpret_cast<BRep_TVertex*>(aV.TShape().operator->())->Tolerance(aMaxTol);
+ }
+ }
+}
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
+#include <BOPAlgo_Tools.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_Surface.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
+#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <gp_Pnt.hxx>
#include <IntTools_Context.hxx>
+#include <IntTools_Tools.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
BOPAlgo_Algo() {
myT1=0.;
myT2=0.;
+ myTol = 0.;
}
//
virtual ~BOPAlgo_SplitEdge() {
return myBox;
}
//
+ Standard_Real Tolerance() const {
+ return myTol;
+ }
+ //
+ void SetDS(const BOPDS_PDS theDS) {
+ myDS = theDS;
+ }
+ //
+ void SetContext(const Handle(IntTools_Context)& aContext) {
+ myContext = aContext;
+ }
+ //
virtual void Perform () {
BOPAlgo_Algo::UserBreak();
+ myTol = BOPAlgo_Tools::ComputeToleranceOfCB(myCB, myDS, myContext);
BOPTools_AlgoTools::MakeSplitEdge(myE,
myV1, myT1,
myV2, myT2,
myESp);
- BRepBndLib::Add(myESp, myBox);
+ BRepBndLib::Add(myESp, myBox);
+ myBox.SetGap(myBox.GetGap() + Precision::Confusion());
}
//
protected:
// <-
TopoDS_Edge myESp;
Bnd_Box myBox;
+ Standard_Real myTol;
+ //
+ BOPDS_PDS myDS;
+ Handle(IntTools_Context) myContext;
};
//
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_SplitEdge> BOPAlgo_VectorOfSplitEdge;
//
-typedef BOPCol_Functor
+typedef BOPCol_ContextFunctor
<BOPAlgo_SplitEdge,
- BOPAlgo_VectorOfSplitEdge> BOPAlgo_SplitEdgeFunctor;
+ BOPAlgo_VectorOfSplitEdge,
+ Handle(IntTools_Context),
+ IntTools_Context> BOPAlgo_SplitEdgeFunctor;
//
-typedef BOPCol_Cnt
+typedef BOPCol_ContextCnt
<BOPAlgo_SplitEdgeFunctor,
- BOPAlgo_VectorOfSplitEdge> BOPAlgo_SplitEdgeCnt;
+ BOPAlgo_VectorOfSplitEdge,
+ Handle(IntTools_Context)> BOPAlgo_SplitEdgeCnt;
//
//=======================================================================
//class : BOPAlgo_MPC
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);
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);
+ if (!myNonDestructive && bCB) {
+ const Handle(BOPDS_CommonBlock)& aCB = myDS->CommonBlock(aPB);
+ Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, myDS, myContext);
+ myDS->UpdateEdgeTolerance(nE, aTol);
+ }
+ 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) {
if (bCB) {
aBSE.SetCommonBlock(aCB);
}
+ aBSE.SetDS(myDS);
aBSE.SetProgressIndicator(myProgressIndicator);
}
} // for (; aItPB.More(); aItPB.Next()) {
//
aNbVBSE=aVBSE.Extent();
//======================================================
- BOPAlgo_SplitEdgeCnt::Perform(myRunParallel, aVBSE);
+ BOPAlgo_SplitEdgeCnt::Perform(myRunParallel, aVBSE, myContext);
//======================================================
//
BOPDS_ShapeInfo aSI;
nSp=myDS->Append(aSI);
//
if (!aCBk.IsNull()) {
+ myDS->UpdateEdgeTolerance(nSp, aBSE.Tolerance());
aCBk->SetEdge(nSp);
}
else {
}
}
}
+
//=======================================================================
// function: SplitEdge
// purpose:
//
Bnd_Box& aBox=aSI.ChangeBox();
BRepBndLib::Add(aSp, aBox);
+ aBox.SetGap(aBox.GetGap() + Precision::Confusion());
//
nSp=myDS->Append(aSI);
return nSp;
if (!myDS->IsCommonBlock(aPB)) {
// the PB seems to be untouced
aLPB.Clear();
+ Standard_Integer nE = aPB->OriginalEdge();
+ if (nE >= 0) {
+ myDS->ChangeShapeInfo(nE).SetReference(-1);
+ }
continue;
}
}//if (!(bV1 || bV2)) {
//=======================================================================
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,
// 1. Find PaveBlocks that are go through nV for nF
FindPaveBlocks(nV, nF, aLPBOut);
aNbPB=aLPBOut.Extent();
- if (!aNbPB) {
- continue;
+ if (aNbPB) {
+ //
+ // 2.
+ BOPDS_ListOfPaveBlock& aLPBD = myDS->ChangePaveBlocks(nE);
+ aPBD = aLPBD.First();
+ //
+ FillPaves(nV, nE, nF, aLPBOut, aPBD);
+ //
+ myDS->UpdatePaveBlock(aPBD);
}
//
- // 2.
- BOPDS_ListOfPaveBlock& aLPBD=myDS->ChangePaveBlocks(nE);
- aPBD=aLPBD.First();
- //
- FillPaves(nV, nE, nF, aLPBOut, aPBD);
- //
- myDS->UpdatePaveBlock(aPBD);
- //
MakeSplitEdge(nE, nF);
//
aLPBOut.Clear();
aPBD->AppendExtPave1(aPave);
}
}//for (; aItLPB.More(); aItLPB.Next()) {
- //
- myDS->UpdatePaveBlock(aPBD);
}
//=======================================================================
// function: MakeSplitEdge1
}
//
Standard_Boolean bJustAdd;
- Standard_Integer i, iEnd, nS[2], nE, nV1, nV2, aNbVSD, k, iWrn;
+ Standard_Integer i, nS[2], nE, nV1, nV2, aNbVSD, k, iWrn;
Standard_Real aT1, aT2, aTS1, aTS2;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
BOPCol_MapOfInteger aMI;
BOPAlgo_VectorOfShrunkRange aVSD;
- //
- iEnd=(aType2==TopAbs_EDGE) ? 2 : 1;
+ TopAbs_ShapeEnum aType[2] = { aType1, aType2 };
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nS[0], nS[1], bJustAdd);
continue;
}
//
- for (i=0; i<iEnd; ++i) {
+ for (i=0; i < 2; ++i) {
nE=nS[i];
- if (!aMI.Add(nE)) {
+ if (aType[i] != TopAbs_EDGE || !aMI.Add(nE)) {
continue;
}
//
#include <BOPDS_IndexedMapOfPaveBlock.hxx>
#include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_PaveBlock.hxx>
+#include <IntTools_Context.hxx>
+#include <BRep_Tool.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
+#include <GeomAPI_ProjectPointOnSurf.hxx>
//=======================================================================
//function : MakeBlocksCnx
//purpose :
//=======================================================================
- void BOPAlgo_Tools::MakeBlocksCnx(const BOPCol_IndexedDataMapOfIntegerListOfInteger& aMILI,
- BOPCol_DataMapOfIntegerListOfInteger& aMBlocks,
- const Handle(NCollection_BaseAllocator)& aAllocator)
+void BOPAlgo_Tools::MakeBlocksCnx(const BOPCol_IndexedDataMapOfIntegerListOfInteger& aMILI,
+ BOPCol_DataMapOfIntegerListOfInteger& aMBlocks,
+ const Handle(NCollection_BaseAllocator)& aAllocator)
{
Standard_Integer aNbV, nV, aNbVS, nVP, nVx, aNbVP, aNbEC, k, i, j;
BOPCol_ListIteratorOfListOfInteger aItLI;
//function : FillMap
//purpose :
//=======================================================================
- void BOPAlgo_Tools::FillMap(const Standard_Integer n1,
- const Standard_Integer n2,
- BOPCol_IndexedDataMapOfIntegerListOfInteger& aMILI,
- const Handle(NCollection_BaseAllocator)& aAllocator)
+void BOPAlgo_Tools::FillMap(const Standard_Integer n1,
+ const Standard_Integer n2,
+ BOPCol_IndexedDataMapOfIntegerListOfInteger& aMILI,
+ const Handle(NCollection_BaseAllocator)& aAllocator)
{
if (aMILI.Contains(n1)) {
BOPCol_ListOfInteger& aLI=aMILI.ChangeFromKey(n1);
//function : FillMap
//purpose :
//=======================================================================
- void BOPAlgo_Tools::FillMap(const Handle(BOPDS_PaveBlock)& aPB1,
- const Handle(BOPDS_PaveBlock)& aPB2,
- BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMPBLPB,
- const Handle(NCollection_BaseAllocator)& aAllocator)
+void BOPAlgo_Tools::FillMap(const Handle(BOPDS_PaveBlock)& aPB1,
+ const Handle(BOPDS_PaveBlock)& aPB2,
+ BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMPBLPB,
+ const Handle(NCollection_BaseAllocator)& aAllocator)
{
if (aMPBLPB.Contains(aPB1)) {
BOPDS_ListOfPaveBlock& aLPB=aMPBLPB.ChangeFromKey(aPB1);
//function : FillMap
//purpose :
//=======================================================================
- void BOPAlgo_Tools::FillMap(const Handle(BOPDS_PaveBlock)& aPB,
- const Standard_Integer nF,
- BOPDS_IndexedDataMapOfPaveBlockListOfInteger& aMPBLI,
- const Handle(NCollection_BaseAllocator)& aAllocator)
+void BOPAlgo_Tools::FillMap(const Handle(BOPDS_PaveBlock)& aPB,
+ const Standard_Integer nF,
+ BOPDS_IndexedDataMapOfPaveBlockListOfInteger& aMPBLI,
+ const Handle(NCollection_BaseAllocator)& aAllocator)
{
if (aMPBLI.Contains(aPB)) {
BOPCol_ListOfInteger& aLI=aMPBLI.ChangeFromKey(aPB);
//function : MakeBlocks
//purpose :
//=======================================================================
- void BOPAlgo_Tools::MakeBlocks(const BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMILI,
- BOPDS_DataMapOfIntegerListOfPaveBlock& aMBlocks,
- const Handle(NCollection_BaseAllocator)& aAllocator)
+void BOPAlgo_Tools::MakeBlocks(const BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMILI,
+ BOPDS_DataMapOfIntegerListOfPaveBlock& aMBlocks,
+ const Handle(NCollection_BaseAllocator)& aAllocator)
{
Standard_Integer aNbV, aNbVS, aNbVP, aNbEC, k, i, j;
BOPDS_ListIteratorOfListOfPaveBlock aItLI;
//function : PerformCommonBlocks
//purpose :
//=======================================================================
- void BOPAlgo_Tools::PerformCommonBlocks(BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMPBLPB,
- const Handle(NCollection_BaseAllocator)& aAllocator,
- BOPDS_PDS& pDS)
+void BOPAlgo_Tools::PerformCommonBlocks(BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMPBLPB,
+ const Handle(NCollection_BaseAllocator)& aAllocator,
+ BOPDS_PDS& pDS)
{
Standard_Integer aNbCB;
//
//function : PerformCommonBlocks
//purpose :
//=======================================================================
- void BOPAlgo_Tools::PerformCommonBlocks(const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& aMPBLI,
- const Handle(NCollection_BaseAllocator)& ,//aAllocator
- BOPDS_PDS& pDS)
+void BOPAlgo_Tools::PerformCommonBlocks(const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& aMPBLI,
+ const Handle(NCollection_BaseAllocator)& ,//aAllocator
+ BOPDS_PDS& pDS)
{
Standard_Integer nF, i, aNb;
BOPCol_ListIteratorOfListOfInteger aItLI;
}
//
const BOPCol_ListOfInteger& aLI=aMPBLI.FindFromKey(aPB);
+ BOPCol_ListOfInteger aNewFaces;
+ const BOPCol_ListOfInteger& anOldFaces = aCB->Faces();
aItLI.Initialize(aLI);
for (; aItLI.More(); aItLI.Next()) {
nF=aItLI.Value();
- aCB->AddFace(nF);
+ // the both lists aLI and anOldFaces are expected to be short,
+ // so we can allow to run nested loop here
+ BOPCol_ListIteratorOfListOfInteger it(anOldFaces);
+ for (; it.More(); it.Next()) {
+ if (it.Value() == nF)
+ break;
+ }
+ if (!it.More()) {
+ aNewFaces.Append(nF);
+ }
}
+ aCB->AppendFaces(aNewFaces);
pDS->SetCommonBlock(aPB, aCB);
}
}
+//=======================================================================
+//function : ComputeToleranceOfCB
+//purpose :
+//=======================================================================
+Standard_Real BOPAlgo_Tools::ComputeToleranceOfCB
+ (const Handle(BOPDS_CommonBlock)& theCB,
+ const BOPDS_PDS theDS,
+ const Handle(IntTools_Context)& theContext)
+{
+ Standard_Real aTolMax = 0.;
+ if (theCB.IsNull()) {
+ return aTolMax;
+ }
+ //
+ const Handle(BOPDS_PaveBlock)& aPBR = theCB->PaveBlock1();
+ Standard_Integer nE = aPBR->OriginalEdge();
+ const TopoDS_Edge& aEOr = *(TopoDS_Edge*)&theDS->Shape(nE);
+ aTolMax = BRep_Tool::Tolerance(aEOr);
+ //
+ const BOPDS_ListOfPaveBlock& aLPB = theCB->PaveBlocks();
+ const BOPCol_ListOfInteger& aLFI = theCB->Faces();
+ //
+ if ((aLPB.Extent() < 2) && aLFI.IsEmpty()) {
+ return aTolMax;
+ }
+ //
+ const Standard_Integer aNbPnt = 11;
+ Standard_Real aTol, aT, aT1, aT2, aDt;
+ gp_Pnt aP;
+ //
+ const Handle(Geom_Curve)& aC3D = BRep_Tool::Curve(aEOr, aT1, aT2);
+ //
+ aPBR->Range(aT1, aT2);
+ aDt = (aT2 - aT1) / (aNbPnt + 1);
+ //
+ // compute max tolerance for common blocks on edges
+ if (aLPB.Extent() > 1) {
+ // compute max distance between edges
+ BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+ GeomAPI_ProjectPointOnCurve aProjPC;
+ //
+ 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*)&theDS->Shape(nE);
+ aTol = BRep_Tool::Tolerance(aE);
+ //
+ aProjPC = theContext->ProjPC(aE);
+ //
+ aT = aT1;
+ for (Standard_Integer i=1; i <= aNbPnt; i++) {
+ aT += aDt;
+ aC3D->D0(aT, aP);
+ aProjPC.Perform(aP);
+ if (aProjPC.NbPoints()) {
+ Standard_Real aTolNew = aTol + aProjPC.LowerDistance();
+ if (aTolNew > aTolMax) {
+ aTolMax = aTolNew;
+ }
+ }
+ }
+ }
+ }
+ //
+ // compute max tolerance for common blocks on faces
+ if (aLFI.Extent()) {
+ Standard_Integer nF;
+ GeomAPI_ProjectPointOnSurf aProjPS;
+ BOPCol_ListIteratorOfListOfInteger aItLI;
+ //
+ aItLI.Initialize(aLFI);
+ for (; aItLI.More(); aItLI.Next()) {
+ nF = aItLI.Value();
+ const TopoDS_Face& aF = *(TopoDS_Face*)&theDS->Shape(nF);
+ aTol = BRep_Tool::Tolerance(aF);
+ //
+ aProjPS = theContext->ProjPS(aF);
+ //
+ aT = aT1;
+ for (Standard_Integer i=1; i <= aNbPnt; i++) {
+ aT += aDt;
+ aC3D->D0(aT, aP);
+ aProjPS.Perform(aP);
+ if (aProjPS.NbPoints()) {
+ Standard_Real aTolNew = aTol + aProjPS.LowerDistance();
+ if (aTolNew > aTolMax) {
+ aTolMax = aTolNew;
+ }
+ }
+ }
+ }
+ }
+ //
+ return aTolMax;
+}
#include <BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx>
class BOPDS_PaveBlock;
+class BOPDS_CommonBlock;
+class IntTools_Context;
class BOPAlgo_Tools
{
Standard_EXPORT static void PerformCommonBlocks (const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theMBlocks, const BOPCol_BaseAllocator& theAllocator, BOPDS_PDS& pDS);
+ Standard_EXPORT static Standard_Real ComputeToleranceOfCB
+ (const Handle(BOPDS_CommonBlock)& theCB,
+ const BOPDS_PDS theDS,
+ const Handle(IntTools_Context)& theContext);
+
};
#endif // _BOPAlgo_Tools_HeaderFile
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());
BOPAlgo_PaveFiller_8.cxx
BOPAlgo_PaveFiller_9.cxx
BOPAlgo_PaveFiller_10.cxx
+BOPAlgo_PaveFiller_11.cxx
BOPAlgo_PBOP.hxx
BOPAlgo_PBuilder.hxx
BOPAlgo_PPaveFiller.hxx
BOPAlgo_WireSplitter.lxx
BOPAlgo_WireSplitter_1.cxx
BOPAlgo_CellsBuilder.cxx
-BOPAlgo_CellsBuilder.hxx
\ No newline at end of file
+BOPAlgo_CellsBuilder.hxx
// function: AddFaces
// purpose:
//=======================================================================
- void BOPDS_CommonBlock::AddFaces(const BOPCol_ListOfInteger& aLF)
+ void BOPDS_CommonBlock::SetFaces(const BOPCol_ListOfInteger& aLF)
{
myFaces=aLF;
}
//=======================================================================
+// function: AppendFaces
+// purpose:
+//=======================================================================
+void BOPDS_CommonBlock::AppendFaces(BOPCol_ListOfInteger& aLF)
+{
+ myFaces.Append(aLF);
+}
+ //=======================================================================
// function: Faces
// purpose:
//=======================================================================
//! Modifier
- //! Adds the list of indices of faces <aLF>
- //! to the list of indices of faces
+ //! Sets the list of indices of faces <aLF>
//! of the common block
- Standard_EXPORT void AddFaces (const BOPCol_ListOfInteger& aLF);
-
+ Standard_EXPORT void SetFaces (const BOPCol_ListOfInteger& aLF);
+
+ //! Modifier
+ //! Appends the list of indices of faces <aLF>
+ //! to the list of indices of faces
+ //! of the common block (the input list is emptied)
+ Standard_EXPORT void AppendFaces(BOPCol_ListOfInteger& aLF);
+
//! Selector
//! Returns the list of pave blocks
/**
* Constructor
*/
- BOPDS_CoupleOfPaveBlocks() {
- myIndex=-1;
- myIndexInterf=-1;
- }
+ BOPDS_CoupleOfPaveBlocks() :
+ myIndexInterf(-1),
+ myIndex(-1),
+ myTolerance(0)
+ {}
//
/**
* Constructor
* secondt pave block
*/
BOPDS_CoupleOfPaveBlocks(const Handle(BOPDS_PaveBlock)& thePB1,
- const Handle(BOPDS_PaveBlock)& thePB2) {
- myIndex=-1;
- myIndexInterf=-1;
+ const Handle(BOPDS_PaveBlock)& thePB2) :
+ myIndexInterf(-1),
+ myIndex(-1),
+ myTolerance(0)
+ {
SetPaveBlocks(thePB1, thePB2);
}
//
const Handle(BOPDS_PaveBlock)& PaveBlock2()const {
return myPB[1];
}
+
+ /**
+ * Sets the tolerance associated with this couple
+ */
+ void SetTolerance(const Standard_Real theTol) {
+ myTolerance = theTol;
+ }
//
+ /**
+ * Returns the tolerance associated with this couple
+ */
+ Standard_Real Tolerance()const {
+ return myTolerance;
+ }
+
protected:
Standard_Integer myIndexInterf;
Standard_Integer myIndex;
Handle(BOPDS_PaveBlock) myPB[2];
+ Standard_Real myTolerance;
};
//
#endif
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.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,
myMapPBCB(100, myAllocator),
myFaceInfoPool(0, myAllocator),
myShapesSD(100, myAllocator),
+ myMapVE(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(0, myAllocator),
myInterfVE(0, myAllocator),
myMapPBCB(100, myAllocator),
myFaceInfoPool(0, myAllocator),
myShapesSD(100, myAllocator),
+ myMapVE(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(0, myAllocator),
myInterfVE(0, myAllocator),
myPaveBlocksPool.Clear();
myFaceInfoPool.Clear();
myShapesSD.Clear();
+ myMapVE.Clear();
myMapPBCB.Clear();
myInterfTB.Clear();
myInterfVV.Clear();
}
return iRet;
}
-
//=======================================================================
//function : Init
//purpose :
{
Standard_Integer i1, i2, j, aI, aNb, aNbS, aNbE, aNbSx;
Standard_Integer n1, n2, n3, nV, nW, nE, aNbF;
- Standard_Real aTol, aFuzz;
+ Standard_Real aTol, aFuzz, aTolAdd;
TopAbs_ShapeEnum aTS;
TopoDS_Iterator aItS;
BOPCol_ListIteratorOfListOfInteger aIt1, aIt2, aIt3;
BOPCol_ListIteratorOfListOfShape aIt;
BOPDS_IndexRange aR;
Handle(NCollection_BaseAllocator) aAllocator;
+ BOPCol_MapOfShape aMS;
//
// 1 Append Source Shapes
aNb=myArguments.Extent();
//
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
}
//
aFuzz = myFuzzyValue / 2.;
- myNbSourceShapes=NbShapes();
+ aTolAdd = Precision::Confusion();
+ myNbSourceShapes = NbShapes();
//
// 2 Bounding Boxes
//
BOPDS_ShapeInfo& aSI=ChangeShapeInfo(j);
//
const TopoDS_Shape& aS=aSI.Shape();
- ResetShape(aS);
//
aTS=aSI.ShapeType();
//
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);
//
- aBox.SetGap(aTol);
+ aBox.SetGap(aTol + aTolAdd);
aBox.Add(aP);
}
}
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);
Bnd_Box& aBx=aSIV.ChangeBox();
aBox.Add(aBx);
}
+ aBox.SetGap(aBox.GetGap() + aTolAdd);
++aNbE;
}
}
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);
aLW.Append(nV);
}
aMI.Clear();
+ aBox.SetGap(aBox.GetGap() + aTolAdd);
++aNbF;
}//if (aTS==TopAbs_FACE) {
}//for (j=0; j<myNbSourceShapes; ++j) {
}//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
}
return sLPB;
}
+
//=======================================================================
//function : ChangePaveBlocks
//purpose :
aPB=aItPB.ChangeValue();
if (aPB==thePB) {
aPB->Update(aLPBN);
- //
- aItPBN.Initialize(aLPBN);
- for (; aItPBN.More(); aItPBN.Next()) {
- Handle(BOPDS_PaveBlock)& aPBN=aItPBN.ChangeValue();
- aLPB.Append(aPBN);
- }
+ aLPB.Append(aLPBN);
aLPB.Remove(aItPB);
break;
}
//
aCBx=new BOPDS_CommonBlock;
aCBx->AddPaveBlocks(aLPBxN);
- aCBx->AddFaces(aLF);
+ aCBx->SetFaces(aLF);
//
aItPB.Initialize(aLPBxN);
for (; aItPB.More(); aItPB.Next()) {
BOPDS_InterfVF& aVF=aVFs(i);
if(aVF.Contains(theF)) {
nV=aVF.OppositeIndex(theF);
+ if (HasShapeSD(nV, nVSD)) {
+ nV=nVSD;
+ }
theMI.Add(nV);
}
}
return bRet;
}
-
//=======================================================================
// function: Paves
// purpose:
theLP.Append(pPaves(i));
}
}
-
//=======================================================================
// function: UpdateTolerance
// purpose:
BOPDS_ShapeInfo& aSIE=ChangeShapeInfo(nE);
Bnd_Box& aBoxE=aSIE.ChangeBox();
BRepBndLib::Add(aE, aBoxE);
+ aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
//
const BOPCol_ListOfInteger& aLI = aSIE.SubShapes();
aIt.Initialize(aLI);
BOPDS_ShapeInfo& aSIV = ChangeShapeInfo(nV);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::Add(aV, aBoxV);
+ aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
}
}
}
-
//=======================================================================
//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 :
}
}
}
+
+//=======================================================================
+//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);
+ }
+ }
+}
#include <BOPDS_DataMapOfPaveBlockCommonBlock.hxx>
#include <BOPDS_VectorOfFaceInfo.hxx>
#include <BOPCol_DataMapOfIntegerInteger.hxx>
+#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
#include <BOPDS_MapOfPassKey.hxx>
#include <BOPDS_VectorOfInterfVV.hxx>
#include <BOPDS_VectorOfInterfVE.hxx>
//! Updates tolerance of the sub-shapes of the shape with index <theIndex>.
Standard_EXPORT void UpdateEdgeTolerance (const Standard_Integer theIndex, const Standard_Real theTolerance);
-
+
+ Standard_EXPORT void UpdatePaveBlocksWithSDVertices();
+
+ Standard_EXPORT void UpdateCommonBlockWithSDVertices(const Handle(BOPDS_CommonBlock)& theCB);
+
+ Standard_EXPORT void InitPaveBlocksForVertex(const Standard_Integer theNV);
+
//! Sets the extended tolerance
void SetFuzzyValue (const Standard_Real theFuzz);
//! Initializes the pave blocks for the shape with index theIndex
Standard_EXPORT void InitPaveBlocks (const Standard_Integer theIndex);
-
+
+ Standard_EXPORT void UpdatePaveBlockWithSDVertices(const Handle(BOPDS_PaveBlock)& thePB);
//! Initializes the state of face with index theIndex
Standard_EXPORT void InitFaceInfo (const Standard_Integer theIndex);
BOPDS_DataMapOfPaveBlockCommonBlock myMapPBCB;
BOPDS_VectorOfFaceInfo myFaceInfoPool;
BOPCol_DataMapOfIntegerInteger myShapesSD;
+ BOPCol_DataMapOfIntegerListOfInteger myMapVE;
BOPDS_MapOfPassKey myInterfTB;
BOPDS_VectorOfInterfVV myInterfVV;
BOPDS_VectorOfInterfVE myInterfVE;
myTangentFaces(Standard_False),
myTolR3D(1.e-7),
myTolR2D(1.e-7),
+ myTolReal(1.e-7),
myCurves(0, myAllocator),
myPoints(0, myAllocator)
{
Standard_Real TolR2D()const {
return myTolR2D;
}
+ /**
+ * Modifier
+ * Sets the value of real not increased 3D tolerance
+ * @param theTol
+ * 3D tolerance
+ */
+ void SetTolReal(const Standard_Real theTol) {
+ myTolReal = theTol;
+ }
+ //
+ /**
+ * Selector
+ * Returns the value of real not increased 3D tolerance
+ * @return
+ * 3D tolerance
+ */
+ Standard_Real TolReal()const {
+ return myTolReal;
+ }
//
/**
* Selector
Standard_Boolean myTangentFaces;
Standard_Real myTolR3D;
Standard_Real myTolR2D;
+ Standard_Real myTolReal;
BOPDS_VectorOfCurve myCurves;
BOPDS_VectorOfPoint myPoints;
};
}
//
char buf[128];
- Standard_Boolean bRunParallel;
+ Standard_Boolean bRunParallel, bNonDestructive;
Standard_Integer iErr, iOp;
Standard_Real aFuzzyValue;
BRepAlgoAPI_Common aCommon;
//
bRunParallel=BOPTest_Objects::RunParallel();
aFuzzyValue=BOPTest_Objects::FuzzyValue();
+ bNonDestructive = BOPTest_Objects::NonDestructive();
//
if (aOp!=BOPAlgo_CUT21) {
pBuilder->SetArguments(aLS);
//
pBuilder->SetRunParallel(bRunParallel);
pBuilder->SetFuzzyValue(aFuzzyValue);
+ pBuilder->SetNonDestructive(bNonDestructive);
//
pBuilder->Build();
iErr=pBuilder->ErrorStatus();
}
//
char buf[128];
- Standard_Boolean bRunParallel;
+ Standard_Boolean bRunParallel, bNonDestructive;
Standard_Integer iErr;
Standard_Real aFuzzyValue;
BRepAlgoAPI_BuilderAlgo aBuilder;
//
bRunParallel=BOPTest_Objects::RunParallel();
aFuzzyValue=BOPTest_Objects::FuzzyValue();
+ bNonDestructive = BOPTest_Objects::NonDestructive();
//
aBuilder.SetArguments(aLS);
aBuilder.SetRunParallel(bRunParallel);
aBuilder.SetFuzzyValue(aFuzzyValue);
+ aBuilder.SetNonDestructive(bNonDestructive);
//
aBuilder.Build();
iErr=aBuilder.ErrorStatus();
const char** a)
{
char buf[32];
- Standard_Boolean bRunParallel;
+ Standard_Boolean bRunParallel, bNonDestructive;
Standard_Integer iErr;
Standard_Real aTol;
TopoDS_Shape aS1, aS2;
//
aTol=BOPTest_Objects::FuzzyValue();
bRunParallel=BOPTest_Objects::RunParallel();
+ bNonDestructive = BOPTest_Objects::NonDestructive();
//
aLC.Append(aS1);
aLC.Append(aS2);
pPF->SetArguments(aLC);
pPF->SetFuzzyValue(aTol);
pPF->SetRunParallel(bRunParallel);
+ pPF->SetNonDestructive(bNonDestructive);
//
pPF->Perform();
iErr=pPF->ErrorStatus();
}
//
char buf[80];
- Standard_Boolean bRunParallel, bApp, bPC1, bPC2;
+ Standard_Boolean bRunParallel, bNonDestructive, bApp, bPC1, bPC2;
Standard_Integer i, iErr;
Standard_Real aTol;
//
bPC2 = Standard_True;
aTol = BOPTest_Objects::FuzzyValue();
bRunParallel = BOPTest_Objects::RunParallel();
+ bNonDestructive = BOPTest_Objects::NonDestructive();
//
for (i = 4; i < n; ++i) {
if (!strcmp(a[i], "-n2d")) {
//
aSec.SetFuzzyValue(aTol);
aSec.SetRunParallel(bRunParallel);
+ aSec.SetNonDestructive(bNonDestructive);
//
aSec.Build();
iErr=aSec.ErrorStatus();
const BOPAlgo_Operation aOp)
{
char buf[32];
- Standard_Boolean bRunParallel;
+ Standard_Boolean bRunParallel, bNonDestructive;
Standard_Integer iErr;
TopoDS_Shape aS1, aS2;
BOPCol_ListOfShape aLC;
//
aTol=BOPTest_Objects::FuzzyValue();
bRunParallel = BOPTest_Objects::RunParallel();
+ bNonDestructive = BOPTest_Objects::NonDestructive();
//
Handle(NCollection_BaseAllocator)aAL=
NCollection_BaseAllocator::CommonBaseAllocator();
aPF.SetArguments(aLC);
aPF.SetFuzzyValue(aTol);
aPF.SetRunParallel(bRunParallel);
+ aPF.SetNonDestructive(bNonDestructive);
//
aPF.Perform();
iErr=aPF.ErrorStatus();
//
const char* usage = "Type mkvolume without arguments for the usage of the command.\n";
//
- Standard_Boolean bToIntersect, bRunParallel, bCompounds;
+ Standard_Boolean bToIntersect, bRunParallel, bNonDestructive, bCompounds;
Standard_Integer i;
Standard_Real aTol;
TopoDS_Shape aS;
//
aTol = BOPTest_Objects::FuzzyValue();
bRunParallel = BOPTest_Objects::RunParallel();
+ bNonDestructive = BOPTest_Objects::NonDestructive();
//
bToIntersect = Standard_True;
bCompounds = Standard_False;
aMV.SetIntersect(bToIntersect);
aMV.SetRunParallel(bRunParallel);
aMV.SetFuzzyValue(aTol);
+ aMV.SetNonDestructive(bNonDestructive);
//
aMV.Perform();
if (aMV.ErrorStatus()) {
//
myBuilder=myBuilderDefault;
myRunParallel=Standard_False;
- myFuzzyValue=0.;
+ myNonDestructive = Standard_False;
+ myFuzzyValue = 0.;
};
//
// Clear
return myFuzzyValue;
};
//
+ void SetNonDestructive(const Standard_Boolean theFlag) {
+ myNonDestructive = theFlag;
+ };
+ //
+ Standard_Boolean NonDestructive()const {
+ return myNonDestructive;
+ };
+ //
protected:
//
BOPTest_Session(const BOPTest_Session&);
BOPCol_ListOfShape myShapes;
BOPCol_ListOfShape myTools;
Standard_Boolean myRunParallel;
+ Standard_Boolean myNonDestructive;
Standard_Real myFuzzyValue;
};
//
return GetSession().FuzzyValue();
}
//=======================================================================
+//function : SetNonDestructive
+//purpose :
+//=======================================================================
+void BOPTest_Objects::SetNonDestructive(const Standard_Boolean theFlag)
+{
+ GetSession().SetNonDestructive(theFlag);
+}
+//=======================================================================
+//function : NonDestructive
+//purpose :
+//=======================================================================
+Standard_Boolean BOPTest_Objects::NonDestructive()
+{
+ return GetSession().NonDestructive();
+}
+//=======================================================================
//function : Allocator1
//purpose :
//=======================================================================
Standard_EXPORT static Standard_Real FuzzyValue();
+ Standard_EXPORT static void SetNonDestructive(const Standard_Boolean theFlag);
+
+ Standard_EXPORT static Standard_Boolean NonDestructive();
+
#include <string.h>
static Standard_Integer boptions (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer brunparallel (Draw_Interpretor&, Standard_Integer, const char**);
-static Standard_Integer bfuzzyvalue (Draw_Interpretor&, Standard_Integer, const char**);
-static Standard_Integer bparallelmode(Draw_Interpretor&, Standard_Integer, const char**);
+static Standard_Integer bnondestructive(Draw_Interpretor&, Standard_Integer, const char**);
+static Standard_Integer bfuzzyvalue(Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : OptionCommands
// Chapter's name
const char* g = "BOPTest commands";
// Commands
- theCommands.Add("boptions", "use boptions" , __FILE__, boptions, g);
+ theCommands.Add("boptions", "use boptions, shows current value of BOP options" , __FILE__, boptions, g);
theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
- theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value" , __FILE__, bfuzzyvalue, g);
- theCommands.Add("bparallelmode",
- "bparallelmode [1/0] : show / set parallel mode for boolean operations",
- __FILE__, bparallelmode, g);
-
+ theCommands.Add("bnondestructive", "use bnondestructive [0/1]", __FILE__, bnondestructive, g);
+ theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value", __FILE__, bfuzzyvalue, g);
}
//=======================================================================
//function : boptions
}
//
char buf[128];
- Standard_Boolean bRunParallel;
+ Standard_Boolean bRunParallel, bNonDestructive;
Standard_Real aFuzzyValue;
//
bRunParallel=BOPTest_Objects::RunParallel();
- aFuzzyValue=BOPTest_Objects::FuzzyValue();
+ bNonDestructive = BOPTest_Objects::NonDestructive();
+ aFuzzyValue = BOPTest_Objects::FuzzyValue();
Sprintf(buf, " RunParallel: %d\n", bRunParallel);
di << buf;
+ Sprintf(buf, " NonDestructive: %d\n", bNonDestructive);
+ di << buf;
Sprintf(buf, " FuzzyValue : %lf\n", aFuzzyValue);
di << buf;
//
return 0;
}
//=======================================================================
-//function : bparallelmode
+//function : bnondestructive
//purpose :
//=======================================================================
-Standard_Integer bparallelmode(Draw_Interpretor& di,
- Standard_Integer n,
- const char** a)
+Standard_Integer bnondestructive(Draw_Interpretor& di,
+ Standard_Integer n,
+ const char** a)
{
- Standard_Boolean bRunParallel;
- //
- if (n == 2) {
- bRunParallel=(Standard_Boolean)Draw::Atoi(a[1]);
- BOPTest_Objects::SetRunParallel(bRunParallel);
- if (bRunParallel) {
- di << "Parallel mode for boolean operations has been enabled";
- }
- else {
- di << "Parallel mode for boolean operations has been disabled";
- }
+ if (n != 2) {
+ di << " use bnondestructive [0/1]\n";
+ return 0;
}
- else {
- bRunParallel=BOPTest_Objects::RunParallel();
- di << "Parallel mode state for boolean operations: "
- << (bRunParallel? "enabled" : "disabled");
+ //
+ Standard_Integer iX;
+ Standard_Boolean bNonDestructive;
+ //
+ iX = Draw::Atoi(a[1]);
+ if (iX<0 || iX>1) {
+ di << " Wrong value.\n";
+ return 0;
}
+ //
+ bNonDestructive = (Standard_Boolean)(iX);
+ BOPTest_Objects::SetNonDestructive(bNonDestructive);
+ //
return 0;
}
}
//
char buf[32];
- Standard_Boolean bRunParallel, bShowTime;
+ Standard_Boolean bRunParallel, bNonDestructive, bShowTime;
Standard_Integer i, aNbS, iErr;
Standard_Real aTol;
BOPCol_ListIteratorOfListOfShape aIt;
bShowTime = Standard_False;
//
bRunParallel=BOPTest_Objects::RunParallel();
- aTol=BOPTest_Objects::FuzzyValue();
+ bNonDestructive = BOPTest_Objects::NonDestructive();
+ aTol = BOPTest_Objects::FuzzyValue();
//
for (i=1; i<n; ++i) {
if (!strcmp(a[i], "-t")) {
//
aPF.SetArguments(aLC);
aPF.SetRunParallel(bRunParallel);
+ aPF.SetNonDestructive(bNonDestructive);
aPF.SetFuzzyValue(aTol);
//
OSD_Timer aTimer;
}
// 2
aTolF2=BRep_Tool::Tolerance(aF2);
- aTol=aTolF1+aTolF2;
+ aTol = aTolF1 + aTolF2 + Precision::Confusion();
//
iErr = BOPTools_AlgoTools3D::PointInFace(aF1, aP, aP2D,
theContext);
//
aTolV1=BRep_Tool::Tolerance(aV1);
- aTolSum=aTolV1+aTolP2;
+ aTolSum = aTolV1 + aTolP2 + Precision::Confusion();
aTolSum2=aTolSum*aTolSum;
//
aP1=BRep_Tool::Pnt(aV1);
//
aTolV1=BRep_Tool::Tolerance(aV1);
aTolV2=BRep_Tool::Tolerance(aV2);
- aTolSum=aTolV1+aTolV2;
+ aTolSum = aTolV1 + aTolV2 + Precision::Confusion();
aTolSum2=aTolSum*aTolSum;
//
aP1=BRep_Tool::Pnt(aV1);
// function: MakeVertex
// purpose :
//=======================================================================
-void BOPTools_AlgoTools::MakeVertex(BOPCol_ListOfShape& aLV,
+void BOPTools_AlgoTools::MakeVertex(const BOPCol_ListOfShape& aLV,
TopoDS_Vertex& aVnew)
{
Standard_Integer aNb;
Standard_EXPORT static Standard_Integer ComputeVV (const TopoDS_Vertex& aV1, const TopoDS_Vertex& aV2);
- Standard_EXPORT static void MakeVertex (BOPCol_ListOfShape& aLV, TopoDS_Vertex& aV);
+ Standard_EXPORT static void MakeVertex (const BOPCol_ListOfShape& aLV, TopoDS_Vertex& aV);
Standard_EXPORT static void MakeEdge (const IntTools_Curve& theCurve, const TopoDS_Vertex& theV1, const Standard_Real theT1, const TopoDS_Vertex& theV2, const Standard_Real theT2, const Standard_Real theTolR3D, TopoDS_Edge& theE);
//! accepted for correction. If real value of the tolerance
//! will be greater than <aTolMax>, the correction does not
//! perform.
- Standard_EXPORT static void CorrectTolerances (const TopoDS_Shape& theS, const Standard_Real theTolMax = 0.0001, const Standard_Boolean theRunParallel = Standard_False);
-
+ Standard_EXPORT static void CorrectTolerances
+ (const TopoDS_Shape& theS,
+ const BOPCol_IndexedMapOfShape& theMapToAvoid,
+ const Standard_Real theTolMax = 0.0001,
+ const Standard_Boolean theRunParallel = Standard_False);
//! Provides valid values of tolerances for the shape <theS>
//! in terms of BRepCheck_InvalidCurveOnSurface.
- Standard_EXPORT static void CorrectCurveOnSurface (const TopoDS_Shape& theS, const Standard_Real theTolMax = 0.0001, const Standard_Boolean theRunParallel = Standard_False);
-
+ Standard_EXPORT static void CorrectCurveOnSurface
+ (const TopoDS_Shape& theS,
+ const BOPCol_IndexedMapOfShape& theMapToAvoid,
+ const Standard_Real theTolMax = 0.0001,
+ const Standard_Boolean theRunParallel = Standard_False);
//! Provides valid values of tolerances for the shape <theS>
//! in terms of BRepCheck_InvalidPointOnCurve.
- Standard_EXPORT static void CorrectPointOnCurve (const TopoDS_Shape& theS, const Standard_Real theTolMax = 0.0001, const Standard_Boolean theRunParallel = Standard_False);
-
+ Standard_EXPORT static void CorrectPointOnCurve
+ (const TopoDS_Shape& theS,
+ const BOPCol_IndexedMapOfShape& theMapToAvoid,
+ const Standard_Real theTolMax = 0.0001,
+ const Standard_Boolean theRunParallel = Standard_False);
//! Make a vertex using 3D-point <aP1> and 3D-tolerance value <aTol>
Standard_EXPORT static void MakeNewVertex (const gp_Pnt& aP1, const Standard_Real aTol, TopoDS_Vertex& aNewVertex);
//! Corrects tolerance values of the sub-shapes of the shape <theS> if needed.
- Standard_EXPORT static void CorrectShapeTolerances (const TopoDS_Shape& theS, const Standard_Boolean theRunParallel = Standard_False);
-
+ Standard_EXPORT static void CorrectShapeTolerances
+ (const TopoDS_Shape& theS,
+ const BOPCol_IndexedMapOfShape& theMapToAvoid,
+ const Standard_Boolean theRunParallel = Standard_False);
//! Retutns dimension of the shape <theS>.
Standard_EXPORT static Standard_Integer Dimension (const TopoDS_Shape& theS);
//
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,
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,
class BOPTools_CPC {
public:
BOPTools_CPC()
- : myMaxTol(1.e-7) {
+ : myMaxTol(1.e-7), mypMapToAvoid(0L) {
}
//
~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;
};
//
//=======================================================================
//=======================================================================
class BOPTools_CWT {
public:
- BOPTools_CWT() {
+ BOPTools_CWT() : mypMapToAvoid(0L) {
}
//
~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;
class BOPTools_CDT {
public:
BOPTools_CDT()
- : myMaxTol(1.e-7) {
+ : myMaxTol(1.e-7), mypMapToAvoid(0L) {
}
//
~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;
//=======================================================================
class BOPTools_CVT {
public:
- BOPTools_CVT() {
+ BOPTools_CVT() : mypMapToAvoid(0L) {
}
//
~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;
};
//
//=======================================================================
//=======================================================================
class BOPTools_CET {
public:
- BOPTools_CET() {
+ BOPTools_CET() : mypMapToAvoid(0L) {
}
//
~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;
//=======================================================================
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);
}
//
//=======================================================================
//=======================================================================
void BOPTools_AlgoTools::CorrectPointOnCurve
(const TopoDS_Shape& aS,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid,
const Standard_Real aMaxTol,
const Standard_Boolean bRunParallel)
{
BOPTools_CPC& aCPC=aVCPC.Append1();
aCPC.SetEdge(aE);
aCPC.SetMaxTol(aMaxTol);
+ aCPC.SetMapToAvoid(aMapToAvoid);
}
//
//======================================================
//=======================================================================
void BOPTools_AlgoTools::CorrectCurveOnSurface
(const TopoDS_Shape& aS,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid,
const Standard_Real aMaxTol,
const Standard_Boolean bRunParallel)
{
//
BOPTools_CWT& aCWT=aVCWT.Append1();
aCWT.SetFace(aF);
+ aCWT.SetMapToAvoid(aMapToAvoid);
//
aExpE.Init(aF, TopAbs_EDGE);
for (; aExpE.More(); aExpE.Next()) {
aCDT.SetEdge(aE);
aCDT.SetFace(aF);
aCDT.SetMaxTol(aMaxTol);
+ aCDT.SetMapToAvoid(aMapToAvoid);
}
}
//
//=======================================================================
void BOPTools_AlgoTools::CorrectShapeTolerances
(const TopoDS_Shape& aShape,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid,
const Standard_Boolean bRunParallel)
{
TopExp_Explorer aExp;
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExp.Current();
BOPTools_CVT& aCVT=aVCVT.Append1();
aCVT.SetEdge(aE);
+ aCVT.SetMapToAvoid(aMapToAvoid);
}
//
//======================================================
const TopoDS_Face& aF = *(TopoDS_Face*)&aExp.Current();
BOPTools_CET& aCET=aVCET.Append1();
aCET.SetFace(aF);
+ aCET.SetMapToAvoid(aMapToAvoid);
}
//
//======================================================
// 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;
if (aD2 > aTol) {
aNewTolerance=sqrt(aD2)+dd;
if (aNewTolerance<aMaxTol)
- TV->UpdateTolerance(aNewTolerance);
+ UpdateShape(aV, aNewTolerance, aMapToAvoid);
}
}
aItPR.Next();
if (aD2 > aTol) {
aNewTolerance=sqrt(aD2)+dd;
if (aNewTolerance<aMaxTol)
- TV->UpdateTolerance(aNewTolerance);
+ UpdateShape(aV, aNewTolerance, aMapToAvoid);
}
}
}
// 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;
}// 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) {
}
//=======================================================================
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
Tol, SameParameter, aNewTol);
if (ok) {
if (aNewTol<aMaxTol) {
- TE->UpdateTolerance(aNewTol+Delta);
- //
- CorrectVertexTolerance(myShape);
+ UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
+ CorrectVertexTolerance(myShape, aMapToAvoid);
}
}
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);
}
}
}
Tol,Standard_True, aNewTol);
if (okx) {
if (aNewTol<aMaxTol) {
- TE->UpdateTolerance(aNewTol+Delta);
- CorrectVertexTolerance(myShape);
+ UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
+ CorrectVertexTolerance(myShape, aMapToAvoid);
}
}
}
//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;
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);
}
}
}
// 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);
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 :
//=======================================================================
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(myProgressIndicator);
myDSFiller->SetFuzzyValue(myFuzzyValue);
+ myDSFiller->SetNonDestructive(myNonDestructive);
//
SetAttributes();
//
myEntryType(1),
myDSFiller(NULL),
myBuilder(NULL),
- myFuzzyValue(0.)
+ myFuzzyValue(0.),
+ myNonDestructive(Standard_False)
{}
//=======================================================================
// function:
BRepAlgoAPI_Algo(),
myEntryType(0),
myBuilder(NULL),
- myFuzzyValue(0.)
+ myFuzzyValue(0.),
+ myNonDestructive(Standard_False)
{
BOPAlgo_PaveFiller* pPF=(BOPAlgo_PaveFiller*)&aPF;
myDSFiller=pPF;
return myFuzzyValue;
}
//=======================================================================
+//function : SetNonDestructive
+//purpose :
+//=======================================================================
+void BRepAlgoAPI_BuilderAlgo::SetNonDestructive(const Standard_Boolean theFlag)
+{
+ myNonDestructive = theFlag;
+}
+//=======================================================================
+//function : NonDestructive
+//purpose :
+//=======================================================================
+Standard_Boolean BRepAlgoAPI_BuilderAlgo::NonDestructive() const
+{
+ return myNonDestructive;
+}
+//=======================================================================
//function : Clear
//purpose :
//=======================================================================
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(myProgressIndicator);
myDSFiller->SetFuzzyValue(myFuzzyValue);
+ myDSFiller->SetNonDestructive(myNonDestructive);
//
myDSFiller->Perform();
iErr=myDSFiller->ErrorStatus();
//! Returns the additional tolerance
Standard_EXPORT Standard_Real FuzzyValue() const;
-
+
+ //! Sets the flag that defines the mode of treatment.
+ //! In non-destructive mode the argument shapes are not modified. Instead
+ //! a copy of a sub-shape is created in the result if it is needed to be updated.
+ Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag);
+
+ //! Returns the flag that defines the mode of treatment.
+ //! In non-destructive mode the argument shapes are not modified. Instead
+ //! 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 arguments
Standard_EXPORT void SetArguments (const TopTools_ListOfShape& theLS);
BOPAlgo_PPaveFiller myDSFiller;
BOPAlgo_PBuilder myBuilder;
Standard_Real myFuzzyValue;
+ Standard_Boolean myNonDestructive;
TopTools_ListOfShape myArguments;
{
myCurve = theCurve;
- myCriteria = myBeanTolerance + myFaceTolerance;
+ myCriteria = myBeanTolerance + myFaceTolerance + Precision::Confusion();
myCurveResolution = myCurve.Resolution(myCriteria);
mySurface = theSurface;
myBeanTolerance = BRep_Tool::Tolerance(theEdge);
myFaceTolerance = BRep_Tool::Tolerance(theFace);
- myCriteria = myBeanTolerance + myFaceTolerance;
+ myCriteria = myBeanTolerance + myFaceTolerance + Precision::Confusion();
myCurveResolution = myCurve.Resolution(myCriteria);
SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(),
myBeanTolerance = theBeanTolerance;
myFaceTolerance = theFaceTolerance;
- myCriteria = myBeanTolerance + myFaceTolerance;
+ myCriteria = myBeanTolerance + myFaceTolerance + Precision::Confusion();
myCurveResolution = myCurve.Resolution(myCriteria);
SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(),
if(myUMinParameter > u || u > myUMaxParameter || myVMinParameter > v || v > myVMaxParameter) {
return;
}
-
- Standard_Real t1 = Max(myFirstParameter, t-myCriteria);
- Standard_Real t2 = Min(myLastParameter, t+myCriteria);
+ //
+ // compute correct range on the edge
+ Standard_Real anAngle, aDt;
+ gp_Dir aDL, aDP;
+ //
+ aDL = L.Position().Direction();
+ aDP = P.Position().Direction();
+ anAngle = Abs(M_PI_2 - aDL.Angle(aDP));
+ //
+ aDt = IntTools_Tools::ComputeIntRange
+ (myBeanTolerance, myFaceTolerance, anAngle);
+ //
+ Standard_Real t1 = Max(myFirstParameter, t - aDt);
+ Standard_Real t2 = Min(myLastParameter, t + aDt);
IntTools_Range aRange(t1, t2);
myResults.Append(aRange);
return;
-
}
aDist=aProjector.LowerDistance();
//
aTolE2=BRep_Tool::Tolerance(aE2);
- aTolSum=aTolP1+aTolE2;
+ aTolSum = aTolP1 + aTolE2 + Precision::Confusion();
//
aT=aProjector.LowerDistanceParameter();
if (aDist > aTolSum) {
Standard_Integer IntTools_Context::ComputeVE
(const TopoDS_Vertex& aV1,
const TopoDS_Edge& aE2,
- Standard_Real& aT)
+ Standard_Real& aParam,
+ Standard_Real& aTolVnew)
{
if (BRep_Tool::Degenerated(aE2)) {
return -1;
}
//
aDist=aProjector.LowerDistance();
-
- // tolerance of check for coincidence is sum of tolerances of edge and vertex
- // extended by additional Precision::Confusion() to allow for interference where
- // it is very close but not fit to tolerance (see #24108)
+ //
aTolV1=BRep_Tool::Tolerance(aV1);
aTolE2=BRep_Tool::Tolerance(aE2);
aTolSum = aTolV1 + aTolE2 + Precision::Confusion();
//
- aT=aProjector.LowerDistanceParameter();
+ aTolVnew=aDist+aTolE2;
+ //
+ aParam=aProjector.LowerDistanceParameter();
if (aDist > aTolSum) {
return -4;
}
return 0;
}
//=======================================================================
-//function : ComputeVS
+//function : ComputeVF
//purpose :
//=======================================================================
Standard_Integer IntTools_Context::ComputeVF
(const TopoDS_Vertex& aV1,
const TopoDS_Face& aF2,
Standard_Real& U,
- Standard_Real& V)
+ Standard_Real& V,
+ Standard_Real& aTolVnew)
{
Standard_Real aTolV1, aTolF2, aTolSum, aDist;
gp_Pnt aP;
// 2. Check the distance between the projection point and
// the original point
aDist=aProjector.LowerDistance();
-
+ //
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;
Extrema_ExtPC anExt2(aPv, aGAC, 1.e-10);
Standard_Real aMinDist = RealLast();
Standard_Integer aMinIdx = -1;
- for (Standard_Integer anIdx = 1; anIdx <= anExt2.NbExt(); anIdx++)
- {
- if ( anExt2.IsMin(anIdx) &&
- anExt2.SquareDistance(anIdx) < aMinDist )
+ if (anExt2.IsDone()) {
+ for (Standard_Integer anIdx = 1; anIdx <= anExt2.NbExt(); anIdx++)
+ {
+ if ( anExt2.IsMin(anIdx) &&
+ anExt2.SquareDistance(anIdx) < aMinDist )
{
aMinDist = anExt2.SquareDistance(anIdx);
aMinIdx = anIdx;
}
+ }
}
if (aMinIdx != -1)
{
Extrema_ExtPC anExt2(aPv, aGAC, 1.e-10);
Standard_Real aMinDist = RealLast();
Standard_Integer aMinIdx = -1;
- for (Standard_Integer anIdx = 1; anIdx <= anExt2.NbExt(); anIdx++)
- {
- if ( anExt2.IsMin(anIdx) &&
- anExt2.SquareDistance(anIdx) < aMinDist )
+ if (anExt2.IsDone()) {
+ for (Standard_Integer anIdx = 1; anIdx <= anExt2.NbExt(); anIdx++)
+ {
+ if ( anExt2.IsMin(anIdx) &&
+ anExt2.SquareDistance(anIdx) < aMinDist )
{
aMinDist = anExt2.SquareDistance(anIdx);
aMinIdx = anIdx;
}
+ }
}
if (aMinIdx != -1)
{
//! Computes parameter of the vertex aV on
- //! the edge aE.
+ //! the edge aE and new increased value of vertex tolerance.
//! 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)
+ //! negative value: <br>
+ //! 1. the edge is degenerated (-1) <br>
+ //! 2. the edge does not contain 3d curve and pcurves (-2) <br>
//! 3. projection algorithm failed (-3)
- Standard_EXPORT Standard_Integer ComputeVE (const TopoDS_Vertex& aV, const TopoDS_Edge& aE, Standard_Real& aT);
-
+ Standard_EXPORT Standard_Integer ComputeVE (const TopoDS_Vertex& aV,
+ const TopoDS_Edge& aE,
+ Standard_Real& aParam,
+ Standard_Real& aTolVnew);
+
//! Computes UV parameters of the vertex aV on face aF
+ //! and new increased value of vertex tolerance.
//! 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)
+ //! For following conditions returns negative value <br>
+ //! 1. projection algorithm failed (-1) <br>
+ //! 2. distance is more than sum of tolerances (-2) <br>
//! 3. projection point out or on the boundaries of face (-3)
- Standard_EXPORT Standard_Integer ComputeVF (const TopoDS_Vertex& aV, const TopoDS_Face& aF, Standard_Real& U, Standard_Real& V);
-
+ Standard_EXPORT Standard_Integer ComputeVF (const TopoDS_Vertex& aV,
+ const TopoDS_Face& aF,
+ Standard_Real& U,
+ Standard_Real& V,
+ Standard_Real& aTolVnew);
+
//! Returns the state of the point aP2D
//! relative to face aF
#include <IntTools_CommonPrt.hxx>
#include <IntTools_EdgeEdge.hxx>
#include <IntTools_Range.hxx>
+#include <IntTools_Tools.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
mySwap = Standard_True;
}
//
- myTol1 = myCurve1.Tolerance();
- myTol2 = myCurve2.Tolerance();
+ Standard_Real aTolAdd = Precision::Confusion() / 2.;
+ myTol1 = myCurve1.Tolerance() + aTolAdd;
+ myTol2 = myCurve2.Tolerance() + aTolAdd;
myTol = myTol1 + myTol2;
//
if (iCT1 != 0 || iCT2 != 0) {
bThin = ((aT12 - aT11) < myRes1) ||
(aB1.IsXThin(myTol) && aB1.IsYThin(myTol) && aB1.IsZThin(myTol));
//
- bOut = !FindParameters(myCurve2, aTB21, aTB22, myRes2, myPTol2,
+ bOut = !FindParameters(myCurve2, aTB21, aTB22, myTol2, myRes2, myPTol2,
myResCoeff2, aB1, aT21, aT22);
if (bOut || bThin) {
break;
bThin = ((aT22 - aT21) < myRes2) ||
(aB2.IsXThin(myTol) && aB2.IsYThin(myTol) && aB2.IsZThin(myTol));
//
- bOut = !FindParameters(myCurve1, aTB11, aTB12, myRes1, myPTol1,
+ bOut = !FindParameters(myCurve1, aTB11, aTB12, myTol1, myRes1, myPTol1,
myResCoeff1, aB2, aT11, aT12);
//
if (bOut || bThin) {
//=======================================================================
Standard_Boolean IntTools_EdgeEdge::FindParameters(const BRepAdaptor_Curve& theBAC,
const Standard_Real aT1,
- const Standard_Real aT2,
+ const Standard_Real aT2,
+ const Standard_Real theTol,
const Standard_Real theRes,
const Standard_Real thePTol,
const Standard_Real theResCoeff,
Standard_Boolean bRet;
Standard_Integer aC, i, k;
Standard_Real aCf, aDiff, aDt, aT, aTB, aTOut, aTIn;
- Standard_Real aDist, aDistP, aDistTol, aTol;
+ Standard_Real aDist, aDistP, aDistTol;
gp_Pnt aP;
Bnd_Box aCBx;
//
bRet = Standard_False;
aCf = 0.6180339887498948482045868343656;// =0.5*(1.+sqrt(5.))/2.;
aDt = theRes;
- aTol = theBAC.Tolerance();
aDistP = 0.;
- aDistTol = Precision::PConfusion();
+ aDistTol = 1e-9;
aCBx = theCBox;
- aCBx.Enlarge(aTol);
+ aCBx.Enlarge(theTol);
//
const Handle(Geom_Curve)& aCurve = theBAC.Curve().Curve();
const GeomAbs_CurveType aCurveType = theBAC.GetType();
while (aC*(aT-aTB) >= 0) {
theBAC.D0(aTB, aP);
aDist = PointBoxDistance(theCBox, aP);
- if (aDist > aTol) {
+ if (aDist > theTol) {
if (fabs(aDist - aDistP) < aDistTol) {
aDt = Resolution(aCurve, aCurveType, theResCoeff, (++k)*aDist);
} else {
return;
}
//
- aCommonPrt.SetRange1(aT1 - myTol, aT1 + myTol);
- aCommonPrt.AppendRange2(aT2 - myTol, aT2 + myTol);
+ // compute correct range on the edges
+ Standard_Real anAngle, aDt1, aDt2;
+ //
+ anAngle = aD1.Angle(aD2);
+ //
+ aDt1 = IntTools_Tools::ComputeIntRange(myTol1, myTol2, anAngle);
+ aDt2 = IntTools_Tools::ComputeIntRange(myTol2, myTol1, anAngle);
+ //
+ aCommonPrt.SetRange1(aT1 - aDt1, aT1 + aDt1);
+ aCommonPrt.AppendRange2(aT2 - aDt2, aT2 + aDt2);
aCommonPrt.SetType(TopAbs_VERTEX);
aCommonPrt.SetVertexParameter1(aT1);
aCommonPrt.SetVertexParameter2(aT2);
//! Empty contructor
- IntTools_EdgeEdge();
-~IntTools_EdgeEdge();
-
+ IntTools_EdgeEdge();
+
+ //! Destructor
+ ~IntTools_EdgeEdge();
//! Contructor
- IntTools_EdgeEdge(const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2);
+ IntTools_EdgeEdge(const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2);
//! Contructor
- IntTools_EdgeEdge(const TopoDS_Edge& theEdge1, const Standard_Real aT11, const Standard_Real aT12, const TopoDS_Edge& theEdge2, const Standard_Real aT21, const Standard_Real aT22);
+ IntTools_EdgeEdge(const TopoDS_Edge& theEdge1, const Standard_Real aT11,
+ const Standard_Real aT12, const TopoDS_Edge& theEdge2,
+ const Standard_Real aT21, const Standard_Real aT22);
//! Sets the first edge
- void SetEdge1 (const TopoDS_Edge& theEdge);
+ void SetEdge1(const TopoDS_Edge& theEdge);
//! Sets the first edge and its range
- void SetEdge1 (const TopoDS_Edge& theEdge, const Standard_Real aT1, const Standard_Real aT2);
+ void SetEdge1(const TopoDS_Edge& theEdge, const Standard_Real aT1, const Standard_Real aT2);
//! Sets the range for the first edge
- void SetRange1 (const IntTools_Range& theRange1);
+ void SetRange1(const IntTools_Range& theRange1);
//! Sets the range for the first edge
- void SetRange1 (const Standard_Real aT1, const Standard_Real aT2);
+ void SetRange1(const Standard_Real aT1, const Standard_Real aT2);
//! Sets the second edge
- void SetEdge2 (const TopoDS_Edge& theEdge);
+ void SetEdge2(const TopoDS_Edge& theEdge);
//! Sets the first edge and its range
- void SetEdge2 (const TopoDS_Edge& theEdge, const Standard_Real aT1, const Standard_Real aT2);
+ void SetEdge2(const TopoDS_Edge& theEdge, const Standard_Real aT1, const Standard_Real aT2);
//! Sets the range for the second edge
- void SetRange2 (const IntTools_Range& theRange);
+ void SetRange2(const IntTools_Range& theRange);
//! Sets the range for the second edge
- void SetRange2 (const Standard_Real aT1, const Standard_Real aT2);
+ void SetRange2(const Standard_Real aT1, const Standard_Real aT2);
//! Performs the intersection between edges
//! Returns TRUE if common part(s) is(are) found
- Standard_Boolean IsDone() const;
+ Standard_Boolean IsDone() const;
//! Returns common parts
- const IntTools_SequenceOfCommonPrts& CommonParts() const;
+ const IntTools_SequenceOfCommonPrts& CommonParts() const;
//! Checks the data
- void CheckData();
+ void CheckData();
//! Prepares the data
//! Intermediate function
- Standard_EXPORT void FindSolutions (IntTools_SequenceOfRanges& theRanges1, IntTools_SequenceOfRanges& theRanges2, Standard_Boolean& bSplit2);
+ Standard_EXPORT void FindSolutions (IntTools_SequenceOfRanges& theRanges1,
+ IntTools_SequenceOfRanges& theRanges2, Standard_Boolean& bSplit2);
//! Looking for the exact intersection ranges
- Standard_EXPORT void FindSolutions (const IntTools_Range& theR1, const IntTools_Range& theR2, const Bnd_Box& theBox2, IntTools_SequenceOfRanges& theRanges1, IntTools_SequenceOfRanges& theRanges2);
+ Standard_EXPORT void FindSolutions (const IntTools_Range& theR1,
+ const IntTools_Range& theR2, const Bnd_Box& theBox2,
+ IntTools_SequenceOfRanges& theRanges1, IntTools_SequenceOfRanges& theRanges2);
//! Merges found solutions
- Standard_EXPORT void MergeSolutions (const IntTools_SequenceOfRanges& theRanges1, const IntTools_SequenceOfRanges& theRanges2, const Standard_Boolean bSplit2);
+ Standard_EXPORT void MergeSolutions (const IntTools_SequenceOfRanges& theRanges1,
+ const IntTools_SequenceOfRanges& theRanges2, const Standard_Boolean bSplit2);
//! Looking for the range of the edge whick is in the box
- Standard_EXPORT static Standard_Boolean FindParameters (const BRepAdaptor_Curve& theBAC, const Standard_Real aT1, const Standard_Real aT2, const Standard_Real theRes, const Standard_Real thePTol, const Standard_Real theResCoeff, const Bnd_Box& theCBox, Standard_Real& aTB1, Standard_Real& aTB2);
+ Standard_EXPORT static Standard_Boolean FindParameters(const BRepAdaptor_Curve& theBAC,
+ const Standard_Real aT1, const Standard_Real aT2, const Standard_Real theTol,
+ const Standard_Real theRes, const Standard_Real thePTol,
+ const Standard_Real theResCoeff, const Bnd_Box& theCBox,
+ Standard_Real& aTB1, Standard_Real& aTB2);
//! Checks if edges coincide on the ranges
- Standard_EXPORT Standard_Integer CheckCoincidence (const Standard_Real aT11, const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22, const Standard_Real theCriteria, const Standard_Real theCurveRes1);
+ Standard_EXPORT Standard_Integer CheckCoincidence (const Standard_Real aT11,
+ const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22,
+ const Standard_Real theCriteria, const Standard_Real theCurveRes1);
//! Adds common part of the given type to myCommonParts
- Standard_EXPORT void AddSolution (const Standard_Real aT11, const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22, const TopAbs_ShapeEnum theType);
+ Standard_EXPORT void AddSolution (const Standard_Real aT11, const Standard_Real aT12,
+ const Standard_Real aT21, const Standard_Real aT22, const TopAbs_ShapeEnum theType);
//! Looking for the minimal distance between edges on the ranges
- Standard_EXPORT void FindBestSolution (const Standard_Real aT11, const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22, Standard_Real& aT1, Standard_Real& aT2);
+ Standard_EXPORT void FindBestSolution (const Standard_Real aT11, const Standard_Real aT12,
+ const Standard_Real aT21, const Standard_Real aT22,
+ Standard_Real& aT1, Standard_Real& aT2);
//! Checks is there an intersection between edges on the given ranges
//! (for nearly conicident edges)
- Standard_EXPORT Standard_Boolean IsIntersection (const Standard_Real aT11, const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22);
+ Standard_EXPORT Standard_Boolean IsIntersection (const Standard_Real aT11,
+ const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22);
TopoDS_Edge myEdge1;
Standard_Integer myErrorStatus;
IntTools_SequenceOfCommonPrts myCommonParts;
-
private:
-
-
-
-
};
-
#include <IntTools_EdgeEdge.lxx>
-
-
-
-
#endif // _IntTools_EdgeEdge_HeaderFile
myCriteria=1.5*myTolE+myTolF;
}
else {
- myCriteria=myTolE+myTolF;
+ myCriteria = myTolE + myTolF + Precision::Confusion();
}
// 2.a myTmin, myTmax
myTmin=myRange.First();
myCriteria=1.5*myTolE+myTolF;
}
else {
- myCriteria=myTolE+myTolF;
+ myCriteria = myTolE + myTolF + Precision::Confusion();
}
myTmin=myRange.First();
static void PerformPlanes(const Handle(GeomAdaptor_HSurface)& theS1,
const Handle(GeomAdaptor_HSurface)& theS2,
+ const Standard_Real TolF1,
+ const Standard_Real TolF2,
const Standard_Real TolAng,
const Standard_Real TolTang,
const Standard_Boolean theApprox1,
const Standard_Boolean theApprox2,
IntTools_SequenceOfCurves& theSeqOfCurve,
- Standard_Boolean& theTangentFaces);
+ Standard_Boolean& theTangentFaces,
+ Standard_Real& TolReached3d);
static Standard_Boolean ClassifyLin2d(const Handle(GeomAdaptor_HSurface)& theS,
const gp_Lin2d& theLin2d,
myHS2 = new GeomAdaptor_HSurface ();
myTolReached2d=0.;
myTolReached3d=0.;
+ myTolReal = 0.;
SetParameters(Standard_True, Standard_True, Standard_True, 1.e-07);
}
return myTolReached3d;
}
//=======================================================================
+//function : TolReal
+//purpose :
+//=======================================================================
+Standard_Real IntTools_FaceFace::TolReal() const
+{
+ return myTolReal;
+}
+//=======================================================================
//function : Lines
//purpose : return lines of intersection
//=======================================================================
const Standard_Real Tolang = 1.e-8;
const Standard_Real aTolF1=BRep_Tool::Tolerance(theF1);
const Standard_Real aTolF2=BRep_Tool::Tolerance(theF2);
- const Standard_Real aTolSum = aTolF1 + aTolF2;
+ const Standard_Real aTolSum = aTolF1 + aTolF2 + Precision::Confusion();
Standard_Real aHigh = 0.0;
const BRepAdaptor_Surface aBAS1(theF1), aBAS2(theF2);
mySeqOfCurve.Clear();
myTolReached2d=0.;
myTolReached3d=0.;
+ myTolReal = 0.;
myIsDone = Standard_False;
myNbrestr=0;//?
const Standard_Real aTolF1=BRep_Tool::Tolerance(myFace1);
const Standard_Real aTolF2=BRep_Tool::Tolerance(myFace2);
- Standard_Real TolArc = aTolF1 + aTolF2;
+ Standard_Real TolArc = aTolF1 + aTolF2 + Precision::Confusion();
Standard_Real TolTang = TolArc;
const Standard_Boolean isFace1Quad = (aType1 == GeomAbs_Cylinder ||
//
Standard_Real TolAng = 1.e-8;
//
- PerformPlanes(myHS1, myHS2, TolAng, TolTang, myApprox1, myApprox2,
- mySeqOfCurve, myTangentFaces);
+ PerformPlanes(myHS1, myHS2,
+ aTolF1, aTolF2, TolAng, TolTang,
+ myApprox1, myApprox2,
+ mySeqOfCurve, myTangentFaces, myTolReached3d);
//
myIsDone = Standard_True;
const Standard_Integer NbLinPP = mySeqOfCurve.Length();
if(NbLinPP) {
Standard_Real aTolFMax;
- myTolReached3d = 1.e-7;
aTolFMax=Max(aTolF1, aTolF2);
- if (aTolFMax>myTolReached3d) {
- myTolReached3d=aTolFMax;
+ myTolReal = Precision::Confusion();
+ if (aTolFMax > myTolReal) {
+ myTolReal = aTolFMax;
+ }
+ if (aTolFMax > myTolReached3d) {
+ myTolReached3d = aTolFMax;
}
//
- myTolReached2d = myTolReached3d;
+ myTolReached2d = myTolReal;
if (bReverse) {
Handle(Geom2d_Curve) aC2D1, aC2D2;
//function :ComputeTolReached3d
//purpose :
//=======================================================================
- void IntTools_FaceFace::ComputeTolReached3d()
+void IntTools_FaceFace::ComputeTolReached3d()
{
Standard_Integer aNbLin;
GeomAbs_SurfaceType aType1, aType2;
Standard_Real aDMax = ComputeTolerance();
if (aDMax > myTolReached3d)
{
- myTolReached3d = aDMax;
- }
+ myTolReached3d = aDMax;
}
+ myTolReal = myTolReached3d;
+}
//=======================================================================
//function : MakeCurve
//=======================================================================
void PerformPlanes(const Handle(GeomAdaptor_HSurface)& theS1,
const Handle(GeomAdaptor_HSurface)& theS2,
+ const Standard_Real TolF1,
+ const Standard_Real TolF2,
const Standard_Real TolAng,
const Standard_Real TolTang,
const Standard_Boolean theApprox1,
const Standard_Boolean theApprox2,
IntTools_SequenceOfCurves& theSeqOfCurve,
- Standard_Boolean& theTangentFaces)
+ Standard_Boolean& theTangentFaces,
+ Standard_Real& TolReached3d)
{
gp_Pln aPln1 = theS1->Surface().Plane();
}
theSeqOfCurve.Append(aCurve);
-
+ //
+ // computation of the tolerance reached
+ Standard_Real anAngle, aDt;
+ gp_Dir aD1, aD2;
+ //
+ aD1 = aPln1.Position().Direction();
+ aD2 = aPln2.Position().Direction();
+ anAngle = aD1.Angle(aD2);
+ //
+ aDt = IntTools_Tools::ComputeIntRange(TolF1, TolF2, anAngle);
+ TolReached3d = sqrt(aDt*aDt + TolF1*TolF1);
}
//=======================================================================
Standard_EXPORT const IntTools_SequenceOfPntOn2Faces& Points() const;
- //! Returns tolerance reached during approximation.
+ //! Returns tolerance reached during approximation,
+ //! and possibly increased to cover more area due to a small angle between surfaces.
//! If approximation was not done, returns zero.
Standard_EXPORT Standard_Real TolReached3d() const;
-
+
+ //! Returns tolerance reached during approximation, without any increase.
+ //! If approximation was not done, returns zero.
+ Standard_EXPORT Standard_Real TolReal() const;
//! Returns tolerance reached during approximation.
//! If approximation was not done, returns zero.
//! Returns True if faces are tangent
Standard_EXPORT Standard_Boolean TangentFaces() const;
-
+
//! Provides post-processing the result lines.
//! <bToSplit> - the flag.
Standard_Integer myNbrestr;
Standard_Real myTolReached2d;
Standard_Real myTolReached3d;
+ Standard_Real myTolReal;
Standard_Boolean myApprox;
Standard_Boolean myApprox1;
Standard_Boolean myApprox2;
void IntTools_ShrunkRange::Perform()
{
Standard_Real aCF, aCL, aTolE, aTolV1;
- Standard_Real aTolV2, t1, t11, t1C, t2, t12, t2C;
+ Standard_Real aTolV2, t1, t11, t1C, t2, t12, t2C, dummy;
Standard_Real aCoeff1, aCoeff2, aTol1, aTol2, dt1, dt2, aR, anEps;
Standard_Integer pri;
Standard_Boolean bInf1, bInf2, bAppr;
return;
}
//
- aTol1 = aTolV1+aTolE;
- aTol2 = aTolV2+aTolE;
+ aTol1 = Max(aTolV1, aTolE);
+ aTol2 = Max(aTolV2, aTolE);
//
aCoeff1 = (aTolE>0.05) ? 1. : 2.;
aCoeff2 = aCoeff1;
//
if (fabs(aTV1-aCF)<aEps) {
aCoeff1=1.;
+ aTol1 += Precision::Confusion();
}
if (fabs(aTV2-aCL)<aEps) {
aCoeff2=1.;
+ aTol2 += Precision::Confusion();
}
}
//
BRepBuilderAPI_MakeVertex aMV1(aP1L);
const TopoDS_Vertex& aV1L=aMV1.Vertex();
//
- pri=myCtx->ComputeVE (aV1L, myEdge, t1C);
+ pri = myCtx->ComputeVE(aV1L, myEdge, t1C, dummy);
//
if (pri==-3) {
myErrorStatus=4;
BRepBuilderAPI_MakeVertex aMV2(aP2L);
const TopoDS_Vertex& aV2L=aMV2.Vertex();
//
- pri=myCtx->ComputeVE (aV2L, myEdge, t2C);
+ pri = myCtx->ComputeVE(aV2L, myEdge, t2C, dummy);
//
if (pri==-3) {
myErrorStatus=5;
myTS2=t2C;
//
// BndBox
- Standard_Real ddx=aTolE;//1.e-12;
+ Standard_Real ddx = aTolE + Precision::Confusion();
BndLib_Add3dCurve::Add (aBAC, t1C, t2C, ddx, myBndBox);
}
/////////////////////////////////////////////////////////////////////////
//
aT1=aCPRange.First();
aT2=aCPRange.Last();
- bIsOnPave=(aTR>=aT1 && aTR<=aT1);
+ bIsOnPave=(aTR>=aT1 && aTR<=aT2);
if (bIsOnPave) {
return bIsOnPave;
}
//
return Standard_True;
}
+
+//=======================================================================
+// Function : ComputeIntRange
+// purpose :
+//=======================================================================
+Standard_Real IntTools_Tools::ComputeIntRange(const Standard_Real theTol1,
+ const Standard_Real theTol2,
+ const Standard_Real theAngle)
+{
+ Standard_Real aDt;
+ //
+ if (Abs(M_PI_2 - theAngle) < Precision::Angular()) {
+ aDt = theTol2;
+ }
+ else {
+ Standard_Real a1, a2, anAngle;
+ //
+ anAngle = (theAngle > M_PI_2) ? (M_PI - theAngle) : theAngle;
+ a1 = theTol1 * tan(M_PI_2 - anAngle);
+ a2 = theTol2 / sin(anAngle);
+ aDt = a1 + a2;
+ }
+ //
+ return aDt;
+}
Standard_EXPORT static Standard_Boolean ComputeTolerance (const Handle(Geom_Curve)& theCurve3D, const Handle(Geom2d_Curve)& theCurve2D, const Handle(Geom_Surface)& theSurf, const Standard_Real theFirst, const Standard_Real theLast, Standard_Real& theMaxDist, Standard_Real& theMaxPar);
+ //! Computes the correct Intersection range for
+ //! Line/Line, Line/Plane and Plane/Plane intersections
+ Standard_EXPORT static Standard_Real ComputeIntRange(const Standard_Real theTol1,
+ const Standard_Real theTol2,
+ const Standard_Real theAngle);
protected:
}
int aNbEnters = 0;
- Standard_Real aPerfMeter_CPUtime = 0., aTimer_ElapsedTime = aTM.ElapsedTime();
+ Standard_Real aPerfMeter_CPUtime = 0., aTimer_CPUTime = 0., aS;
+ Standard_Integer aM, aH;
+ aTM.Show(aS, aM, aH, aTimer_CPUTime);
perf_get_meter("TestMeter", &aNbEnters, &aPerfMeter_CPUtime);
+ perf_init_meter("TestMeter");
- Standard_Real aTimeDiff = (fabs(aTimer_ElapsedTime - aPerfMeter_CPUtime) / aTimer_ElapsedTime);
+ Standard_Real aTimeDiff = (fabs(aTimer_CPUTime - aPerfMeter_CPUtime) / aTimer_CPUTime);
printf("\nMeasurement results (%d cycles):\n", count);
- printf("\nOSD_PerfMeter CPU time: %lf\nOSD_Timer elapsed time: %lf\n", aPerfMeter_CPUtime, aTimer_ElapsedTime);
+ printf("\nOSD_PerfMeter CPU time: %lf\nOSD_Timer CPU time: %lf\n",
+ aPerfMeter_CPUtime, aTimer_CPUTime);
printf("Time delta is: %.3lf %%\n", aTimeDiff * 100);
if (aTimeDiff > 0.2)
}
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;
-puts "TODO #23876 ALL: Error: The command 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
bsection result a_1 a_2
checkprops result -l 22.2575
-checksection result
\ No newline at end of file
+checksection result
-puts "TODO #OCC26814 ALL: Error : The length of result shape is"
-
restore [locate_data_file lh3d_px1.brep] a
plane p 0 0 0 1 0 0
mkface f p
bsection result a f
-checkprops result -l 20674.3
+checkprops result -l 18981.2
checksection result
bsection result a b
-checkprops result -l 135.096
+checkprops result -l 130.625
checksection result
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_bat-nord.asm.4.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_bat-nord_et2.asm.4.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_bat-nord_et2_13302.prt.3.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_et1_401-ta6025.prt.3.gdml.tcl]
source [locate_data_file 20000_et1_401-ta6027.prt.2.gdml.tcl]
## image is differ from application
-checkprops result -s 1.26259e+07
+checkprops result -s 1.50445e+007
-puts "TODO OCC26018 Linux: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_et1_401-ta6029.prt.2.gdml.tcl]
+checkprops result -s 1.0285e+007
-puts "TODO OCC26018 ALL: Error : The area of result shape is"
-#puts "TODO OCC26018 Linux: 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
-checkprops result -s 0
+checkprops result -s 2.00593e+007
-puts "TODO OCC26018 Linux: Faulty shapes in variables faulty_1 to"
-
source [locate_data_file 20000_et4_401-ta6049.prt.2.gdml.tcl]
-puts "TODO OCC26018 Windows: Error : The area of result shape is"
-puts "TODO OCC26018 Linux: Error : The command is not valid. The area is"
source [locate_data_file 20000_et4_401-ta6319.prt.2.gdml.tcl]
## image is differ from application
-checkprops result -s 0
\ No newline at end of file
+donly result
+checkprops result -s empty
\ No newline at end of file
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_et5_401-ta6156.prt.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_et5_401-ta6160.prt.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_et3.asm.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_et3_401-ta13450.prt.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_et5.asm.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_et5_401-ta13428.prt.2.gdml.tcl]
-puts "TODO OCC26018 Linux: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_et5_401-ta13429.prt.2.gdml.tcl]
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_et5_401-ta13457.prt.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_et6.asm.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_et6_401-ta13432.prt.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_et6_401-ta13460.prt.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_rdc.asm.3.gdml.tcl]
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_rdc_401-ta13415.prt.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_rdc_401-ta13416.prt.3.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_ss1.asm.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_ss2.asm.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_ss2_401-ta13399.prt.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_h1-2_ss2_401-ta13435.prt.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_rdc_401-ta6018.prt.2.gdml.tcl]
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_salle-experience.asm.4.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_ss1_401-ta6004.prt.2.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_ss1_401-ta6005.prt.2.gdml.tcl]
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 20000_ss1_401-ta6009.prt.2.gdml.tcl]
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 200a0-1_sid-deploye.asm.1.gdml.tcl]
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 200a0-1_sid-retracte.asm.1.gdml.tcl]
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 200a0-1_sid_ens-fixe.asm.1.gdml.tcl]
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 200a0-1_sid_ens-fixe_vanne-tete.prt.1.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 200a0-1_sopac-dn500.asm.1.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 200a0-1_sopac-dn500_piquage.prt.1.gdml.tcl]
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 200a0-1_sopac-dn500_support.prt.1.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file 51678_flame-sbr.prt.1.gdml.tcl]
-puts "TODO ?OCC26018 ALL: Error: bopcheck failed"
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to"
source [locate_data_file 52109_shapiro.prt.gdml.tcl]
set bcheck [bopcheck result]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file bt_ndc.prt.1.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file equipement_chambre.asm.1.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC26018 ALL: bopcheck failed"
source [locate_data_file mos2014-asm-scf-final.asm.1.gdml.tcl]
+set bcheck [bopcheck result]
+puts $bcheck
+if {![regexp {This shape seems to be OK.} $bcheck]} {
+ puts "Error: bopcheck failed"
+}
\ No newline at end of file
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file mos2014-ndc-final.asm.1.gdml.tcl]
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file mos2014-po-modif.prt.1.gdml.tcl]
-puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_"
source [locate_data_file mos2014-po-modif.prt.15.gdml.tcl]
-puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC26018 ALL: bopcheck failed"
source [locate_data_file mos2014-scf-final.prt.1.gdml.tcl]
+set bcheck [bopcheck result]
+puts $bcheck
+if {![regexp {This shape seems to be OK.} $bcheck]} {
+ puts "Error: bopcheck failed"
+}
\ No newline at end of file
# plane unstable
puts "TODO OCC26020 ALL: Error: bopcheck failed"
+puts "TODO ?OCC26020 ALL: Faulty shapes in variables faulty_1"
+puts "TODO OCC26020 ALL: Error : The area of result shape is"
# planar face
plane pln_f1 0 -870 -1.3877787807814457e-014 0 1 1.1102230246251565e-016
# test script on make volume operation
# plane unstable
-puts "TODO OCC26020 Windows: Error: bopcheck failed"
-puts "TODO OCC26020 Linux: Error : The area of result shape is"
-puts "TODO OCC26020 Linux: Error : The command is not valid. The area is"
-
# planar face
plane pln_f1 -2740.6595835899998 -150 -1050 1.110223024625157e-016 1 1.1102230246251563e-016
erase pln_f1
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6 f7
-checkprops result -s 9.99961e+012
+checkprops result -s 25577.7
# test script on make volume operation
# plane unstable
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Error : The area of result shape is"
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-
# planar face
plane pln_f1 -513.57358775546049 376.87261141864394 391.24411461018769 -0.35888381816183362 -0.86162916044152549 0.35888381816183351
erase pln_f1
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6 f7 f8 f9
-checkprops result -s 2.99991e+012
+checkprops result -s 16887.7
# test script on make volume operation
# plane unstable
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Error : The area of result shape is"
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-
# planar face
plane pln_f1 0 1960 8.8817841970012523e-015 0 -1 -1.1102230246251565e-016
erase pln_f1
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6 f7
-checkprops result -s 4.00252e+012
+checkprops result -s 70935.2
# plane unstable
puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Error : The area of result shape is"
+puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to"
# planar face
plane pln_f1 -1863.18155559 1250 -1538.57262704 1.110223024625157e-016 1 1.1102230246251563e-016
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6
-checkprops result -s 7.73553e+007
-
+checkprops result -s 23130.3
# test script on make volume operation
# plane
-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 result shape is"
-
# planar face
plane pln_f1 590.6877421677151 -519.8775759738943 -93.555747452441423 0.64798185367609173 0.7547095802227719 -0.10263024323494339
erase pln_f1
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6 f7
+donly result
-checkprops result -s 9.99931e+012
-
+checkprops result -s empty
# test script on make volume operation
# plane
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO ?OCC26020 ALL: Error : The area of result shape is"
-
# planar face
plane pln_f1 79.400363856921899 8.7220982904821555e-015 -94.116057183203139 -0.83335943573869897 -2.2204460492503131e-016 -0.55273144551877762
erase pln_f1
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6 f7
-checkprops result -s 1.19997e+013
+checkprops result -s 236.65
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6
-checkprops result -s 12400.
+checkprops result -s empty
# test script on make volume operation
# plane
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Error : The area of result shape is"
-
# planar face
plane pln_f1 35.877464033656999 5.9462928582193458e-016 -25.973690230789806 -0.64944804833018333 -3.0834627769631957e-016 -0.76040596560003137
erase pln_f1
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6 f7
-checkprops result -s 4.31002e+007
+checkprops result -s empty
# test script on make volume operation
# plane
-puts "TODO OCC26560 ALL: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26560 ALL: Error : The area of result shape is"
-
# planar face
plane pln_f1 18.855982726712998 17.500000000800412 0 -0.96152394764524818 -0.27472112788189063 0
erase pln_f1
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6 f7 f8 f9
-checkprops result -s 1.3412e+013
+checkprops result -s 45760.9
# test script on make volume operation
# plane
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Error : The area of result shape is"
-
# planar face
plane pln_f1 32.294537607197917 1.8096910201742288e-014 -39.176406819310692 -0.77162458338772011 -6.6613381477509373e-016 -0.63607822027776384
erase pln_f1
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6 f7 f8 f9
-checkprops result -s 2.20868e+013
+checkprops result -s 40838.8
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6
-checkprops result -s 26668.8
+checkprops result -s 97028.3
# test script on make volume operation
# plane
-puts "TODO OCC26020 Windows: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC26020 Linux: Error : The command is not valid. The area is"
-puts "TODO OCC26020 Linux: Error : The area of result shape is"
-
# planar face
plane pln_f1 -513.57358775546049 376.87261141864394 391.24411461018769 -0.35888381816183362 -0.86162916044152549 0.35888381816183351
erase pln_f1
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6 f7
-checkprops result -s 5.29724e-005 -eps 1.0e-3
+checkprops result -s empty
# cylinder plane
puts "TODO OCC26737 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC26737 ALL: Error: bopcheck failed"
# planar face
plane pln_f1 0 515 1.1102230246251565e-015 0 -1 -1.1102230246251565e-016
# test script on make volume operation
# cylinder plane unstable
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-
# planar face
plane pln_f1 1634.597165131441 820 -503.19389260275346 0.26050450864264807 2.2204460492503131e-016 0.96547263087922519
erase pln_f1
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6 f7 f8 f9
-checkprops result -s 2.02141e+012
+checkprops result -s 2.12115e+007
# test script on make volume operation
# cylinder plane unstable
-puts "TODO OCC26020 Linux: Error: bopcheck failed"
-
# planar face
plane pln_f1 0 -875 -1.4432899320127035e-014 0 1 1.1102230246251565e-016
erase pln_f1
# test script on make volume operation
# cylinder plane unstable
-puts "TODO OCC26020 Linux: Error: bopcheck failed"
-puts "TODO OCC26020 Linux: Faulty shapes in variables faulty_1 to faulty_"
-
# planar face
plane pln_f1 0 -870 -1.3877787807814457e-014 0 1 1.1102230246251565e-016
erase pln_f1
# test script on make volume operation
# cylinder plane unstable
-puts "TODO OCC26020 Windows: Error: bopcheck failed"
-puts "TODO OCC26020 Linux: Error : The area of result shape is"
+puts "TODO OCC26020 ALL: Error: bopcheck failed"
# planar face
plane pln_f1 0 -232.5 3.8857805861880479e-015 0 -1 -1.1102230246251565e-016
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6 f7
-checkprops result -s 1.00502e+012
-
+checkprops result -s 1.93904e+007
# test script on make volume operation
# cylinder plane unstable
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC26020 ALL: Error : The area of result shape is"
-
# planar face
plane pln_f1 -2591.6564295634707 -1492.5 -1185.6605612884966 0.46174861323503397 1.1102230246251565e-016 -0.88701083317822171
erase pln_f1
# test script on make volume operation
# cylinder plane
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 Linux: Error : The area of result shape is"
-
# planar face
plane pln_f1 1665.7013364039071 -825 -339.75605834598957 0.15643446504023129 4.4408920985006257e-016 0.98768834059513766
erase pln_f1
# test script on make volume operation
# cylinder plane
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-puts "TODO OCC26020 Linux: Error : The area of result shape is"
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to"
+puts "TODO OCC26020 Linux: Error: bopcheck failed"
+puts "TODO OCC26020 Linux: Faulty shapes in variables faulty_1 to"
# planar face
plane pln_f1 0 -1450 -4.4408920985006262e-015 0 1 1.1102230246251565e-016
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6 f7 f8
-checkprops result -s 1.8917e+007
-
+checkprops result -s 1.96647e+007
# test script on make volume operation
# cylinder plane
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-
# planar face
plane pln_f1 1441.7792892394632 -1532.5 900.69424230424909 -0.6072926454886024 -2.2204460492503121e-016 0.79447822042863747
erase pln_f1
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6 f7 f8
-#checkprops result -s 2.00003e+012
+#checkprops result -s 2.13502e+007
puts "TODO OCC26020 ALL: Error: bopcheck failed"
puts "TODO OCC26020 ALL: Error : The area of result shape is"
+puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to"
# planar face
plane pln_f1 -460.8377555733228 -1160 -121.8751945104883 0.17364817766693036 -5.955424826592936e-017 -0.98480775301220813
# cone plane
# Error status: 191
-puts "TODO OCC26020 Windows: Error status"
-puts "TODO OCC26020 Windows: TEST INCOMPLETE"
-puts "TODO OCC26020 Linux: Faulty shapes in variables faulty_1 to faulty_"
-
# planar face
plane pln_f1 -2.4595121467478056e-014 -746.52181700999995 1844.22896887 0.86602540378443849 -0.47367733686073094 -0.16009303715192033
erase pln_f1
# make volume operation
mkvolume result f1 f2 f3 f4 f5 f6
+
+checkprops result -s 1.13448e+007
\ No newline at end of file
# test script on make volume operation
# cone plane
-puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
-
# planar face
plane pln_f1 0 -746.52181700999995 1844.22896887 -0.86602540378443904 -0.4736773368607301 -0.16009303715192008
erase pln_f1
# make volume operation
mkvolume result f1 f2 f3 f4 f5
-checkprops result -s 8.06875e+006
+checkprops result -s 8.92077e+006
-puts "TODO OCC26717 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO ?OCC26717 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC26717 ALL: Error : operation bfuse is WRONG because number of SOLID"
puts "=========="
puts "BUC60462"
puts "Fuse end"
checkshape result r
-
+checknbshapes result -solid 1 -m "operation bfuse"
checkprops result -s 93237.9
checkshape result
set 2dviewer 0
checkshape b
bfuse result a b
-checkprops result -s 61626.2
+checkprops result -s 60771.3
checkshape result
set 2dviewer 1
bopsection result
puts "Finish boolean operation ..."
-checkprops result -l 3331.35
+checkprops result -l 3384.97
checkshape result
checksection result
checknbshapes result -vertex 1197 -edge 1182 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 2380
puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO OCC25917 ALL: Error : The area of result shape is"
-if { [regexp {Debug mode} [dversion]] } {
- puts "TODO OCC25917 ALL: TEST INCOMPLETE"
- puts "TODO OCC25917 ALL: Tcl Exception"
-}
puts "========================"
puts " OCC472 "
-puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
-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 command is not valid. The area is"
+puts "TODO OCC25917 ALL: Error : The area of result shape is"
puts "========================"
puts " OCC472 "
puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO OCC25917 ALL: Error : The area of result shape is"
puts "TODO OCC25917 ALL: Error : is WRONG because number of "
-if { [regexp {Debug mode} [dversion]] } {
- puts "TODO OCC25917 ALL: TEST INCOMPLETE"
- puts "TODO OCC25917 ALL: Tcl Exception"
-}
-
puts "========================"
puts " OCC472 "
puts "(case 3)"
checknbshapes result -vertex 66 -edge 107
-checkprops result -s 31657.5
+checkprops result -s 229.516
checkshape result
set 2dviewer 0
+puts "TODO OCC26999 ALL: Error : .*The area .*is"
+
puts "========"
puts "OCC772"
puts "SAM1643"
bsection result shell cut
-checknbshapes result -vertex 15 -edge 14
+checknbshapes result -vertex 14 -edge 13
set 2dviewer 1
-puts "REQUIRED All: Info. Faulty shape if found in source shape"
+puts "REQUIRED All: Info. Faulty shape is found in source shape"
puts "============"
puts "OCC25043"
puts "============"
pload QAcommands
restore [locate_data_file bug25043.brep] a
+subshape a v 3
+settolerance a_3 0.0005
set info [OCC25043 a]
-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"
}
+puts "TODO OCC27014 ALL: Faulty shapes in variables faulty_1 to"
+puts "TODO OCC27014 ALL: Error : is WRONG because number of .* entities in shape .* is"
+
puts "============"
puts "OCC25232"
puts "============"
--- /dev/null
+puts "TODO OCC27014 ALL: Error : result is WRONG because number of .* entities in shape"
+
+puts "============"
+puts "OCC26619"
+puts "============"
+puts ""
+#######################################################################
+# Tolerances of operands are modified using bop
+#######################################################################
+
+restore [locate_data_file bug26619_shell_ft81_h0.brep] h0
+restore [locate_data_file bug26619_the_face.brep] f0
+
+regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance h0] full MaxTolerance1
+
+tolerance f0
+
+#turn on non-destructive mode of BOP
+#setflags h0 locked
+#setflags f0 locked
+bnondestructive 1
+
+bop h0 f0
+bopsection result
+
+set length 145.692
+
+set nbshapes_expected "
+Number of shapes in shape
+ VERTEX : 46
+ EDGE : 46
+ WIRE : 0
+ FACE : 0
+ SHELL : 0
+ SOLID : 0
+ COMPSOLID : 0
+ COMPOUND : 1
+ SHAPE : 93
+"
+checknbshapes result -ref ${nbshapes_expected} -t -m "result"
+
+regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance h0] full MaxTolerance2
+
+set expected_MaxTolerance ${MaxTolerance1}
+set tol_abs_MaxTolerance 0.0001
+set tol_rel_MaxTolerance 0.0001
+checkreal "MaxTolerance" ${MaxTolerance2} ${expected_MaxTolerance} ${tol_abs_MaxTolerance} ${tol_rel_MaxTolerance}
+
+set 2dviewer 1
bfillds
bbop result 0
-checkprops result -s 42.0108
+checkprops result -s 42.131
set 2dviewer 1