mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0026619: Tolerances of operands are modified using bop
0026796: The result of General Fuse operation is self-intersecting shape The fix forces creation of new sub-shapes (vertex, edge) when the tolerance of some sub-shape of an argument is to be increased. This new behavior is turned off by default. It can be turned on using two ways: 1) Setting 'locking' flag of the arguments. 2) Calling the method SetNonDestructive(Standard_True) of the API classes. Various bug fixes in the algorithm: - Compute correct tolerance values for intersections of type Line/Line, Line/Plane, Plane/Plane. - In case of Line/Plane intersection check if line's vertices lie on the plane. - Do not allow decreasing of the tolerance value of the Line/Line intersection vertex. - In IntTools_EdgeEdge, call the method FindParameters with proper 3D tolerance of the curve. - Force making copy of a degenerated edge if its vertex is touched but no 2D intersection with other curves is found. - Remove pave blocks both ends of which became referring to the same vertex after vertices substitution. - Avoid exception in IntTools_Context::IsVertexOnLine if Extrema is not done. - Reduce tolerance of vertex/edge using actual distances to interfered shapes if it was increased due to line/line, line/plane, or plane/plane small intersection angle. - Update tolerance of edges to reach all representations in a common block. - In V-E intersections, check if a vertex hits beyond shrunk range, in such case create V-V interference. - Do not put a section edge to the result if it becomes to be a micro edge after updating its vertex. - Correctly make vertices same-domain during the work of MakeBlocks. - Decrease shrunk range at least on a Precision::Confusion() in addition to vertex tolerance. - Add Confusion to bounding boxes of new shapes in DS - Add tolerance Precision::Confusion() to compare distances of touching cases to fix regressions. TODO marks have been removed from (or modified in) the following test cases (Improvements): boolean bsection M3 N2 R2 boolean gdml_private B6 C2 C6 G7 I6 F6 J1 J4 M7 N1 N8 N9 O3 O4 O6 O8 O9 P1 P2 P5 Q1 Q3 Q5 S9 T2 U4 U5 U9 ZB5 ZB6 ZC1 ZC5 ZD3 ZD6 ZD7 ZH2 ZH5 ZI2 ZI5 ZI7 ZI9 ZJ3 ZJ4 ZJ7 F8 I6 G1 boolean volumemaker A5 A6 B3 B4 B7 B9 D3 D4 D7 F1 boolean bopcut_2d D5 bugs modalg_5 bug25043 bugs modalg_2 bug472_1 bug472_2 bug472_3 Test cases updated because they are still bad but can be accepted as non-regression: boolean volumemaker C4 A3 A7 E6 bugs modalg_1 bug10232 boolean bsection N2 Put new TODO in the scripts: bugs modalg_5 bug25232_9 bugs modalg_6 bug26619 bugs modalg_1 buc60462_2 bugs modalg_4 bug772 For the following tests the result in fix became better, so take fix result as the reference: bugs modalg_5 bug24628 bugs modalg_6 bug26954_3 boolean volumemaker A4 B5 B6 C3 C8 D2 D5 F2 bugs modalg_2 bug472_2 bugs modalg_1 buc60776_1 - Add the method SetNonDestructive to API classes of user level
This commit is contained in:
@@ -375,6 +375,7 @@ void BOPAlgo_BOP::Perform()
|
||||
pPF->SetRunParallel(myRunParallel);
|
||||
pPF->SetProgressIndicator(myProgressIndicator);
|
||||
pPF->SetFuzzyValue(myFuzzyValue);
|
||||
pPF->SetNonDestructive(myNonDestructive);
|
||||
//
|
||||
pPF->Perform();
|
||||
//
|
||||
|
@@ -24,9 +24,17 @@
|
||||
#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 :
|
||||
@@ -43,7 +51,8 @@ BOPAlgo_Builder::BOPAlgo_Builder()
|
||||
myShapesSD(100, myAllocator),
|
||||
mySplits(100, myAllocator),
|
||||
myOrigins(100, myAllocator),
|
||||
myFuzzyValue(0.)
|
||||
myFuzzyValue(0.),
|
||||
myNonDestructive(Standard_False)
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -63,7 +72,8 @@ BOPAlgo_Builder::BOPAlgo_Builder
|
||||
myShapesSD(100, myAllocator),
|
||||
mySplits(100, myAllocator),
|
||||
myOrigins(100, myAllocator),
|
||||
myFuzzyValue(0.)
|
||||
myFuzzyValue(0.),
|
||||
myNonDestructive(Standard_False)
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -192,6 +202,22 @@ Standard_Real BOPAlgo_Builder::FuzzyValue() const
|
||||
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:
|
||||
//=======================================================================
|
||||
@@ -259,6 +285,7 @@ void BOPAlgo_Builder::Perform()
|
||||
pPF->SetRunParallel(myRunParallel);
|
||||
pPF->SetProgressIndicator(myProgressIndicator);
|
||||
pPF->SetFuzzyValue(myFuzzyValue);
|
||||
pPF->SetNonDestructive(myNonDestructive);
|
||||
//
|
||||
pPF->Perform();
|
||||
//
|
||||
@@ -272,6 +299,8 @@ void BOPAlgo_Builder::Perform()
|
||||
void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller)
|
||||
{
|
||||
myEntryPoint=0;
|
||||
myNonDestructive = theFiller.NonDestructive();
|
||||
myFuzzyValue = theFiller.FuzzyValue();
|
||||
PerformInternal(theFiller);
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -406,17 +435,30 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
|
||||
PostTreat();
|
||||
|
||||
}
|
||||
//
|
||||
// myErrorStatus
|
||||
//
|
||||
// 0 - Ok
|
||||
//
|
||||
//=======================================================================
|
||||
//function : PostTreat
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_Builder::PostTreat()
|
||||
{
|
||||
BOPTools_AlgoTools::CorrectTolerances(myShape, 0.05, myRunParallel);
|
||||
BOPTools_AlgoTools::CorrectShapeTolerances(myShape, myRunParallel);
|
||||
Standard_Integer i, aNbS;
|
||||
TopAbs_ShapeEnum aType;
|
||||
BOPCol_IndexedMapOfShape aMA;
|
||||
if (myPaveFiller->NonDestructive()) {
|
||||
// MapToAvoid
|
||||
aNbS=myDS->NbSourceShapes();
|
||||
for (i=0; i<aNbS; ++i) {
|
||||
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
|
||||
aType=aSI.ShapeType();
|
||||
if (aType==TopAbs_VERTEX ||
|
||||
aType==TopAbs_EDGE||
|
||||
aType==TopAbs_FACE) {
|
||||
const TopoDS_Shape& aS=aSI.Shape();
|
||||
aMA.Add(aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
BOPTools_AlgoTools::CorrectTolerances(myShape, aMA, 0.05, myRunParallel);
|
||||
BOPTools_AlgoTools::CorrectShapeTolerances(myShape, aMA, myRunParallel);
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ Standard_EXPORT virtual ~BOPAlgo_Builder();
|
||||
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);
|
||||
@@ -99,7 +99,18 @@ Standard_EXPORT virtual ~BOPAlgo_Builder();
|
||||
//! 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:
|
||||
@@ -162,7 +173,7 @@ protected:
|
||||
BOPCol_DataMapOfShapeListOfShape mySplits;
|
||||
BOPCol_DataMapOfShapeShape myOrigins;
|
||||
Standard_Real myFuzzyValue;
|
||||
|
||||
Standard_Boolean myNonDestructive;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -86,7 +86,7 @@
|
||||
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);
|
||||
|
@@ -208,10 +208,10 @@ class BOPAlgo_VFI : public BOPAlgo_Algo {
|
||||
}
|
||||
//
|
||||
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:
|
||||
@@ -405,8 +405,10 @@ void BOPAlgo_Builder::BuildSplitFaces()
|
||||
aLE.Append(aSp);
|
||||
}
|
||||
//
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane (aLE, aFF);
|
||||
//
|
||||
if (!myPaveFiller->NonDestructive()) {
|
||||
// speed up for planar faces
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane (aLE, aFF);
|
||||
}
|
||||
// 3 Build split faces
|
||||
BOPAlgo_BuilderFace& aBF=aVBF.Append1();
|
||||
aBF.SetFace(aF);
|
||||
|
@@ -581,6 +581,7 @@ void BOPAlgo_Builder::FillIn3DParts
|
||||
}
|
||||
Bnd_Box aBox;
|
||||
BRepBndLib::Add(aSx, aBox);
|
||||
aBox.SetGap(aBox.GetGap() + Precision::Confusion());
|
||||
//
|
||||
BOPAlgo_ShapeBox& aSB=aVSB.Append1();
|
||||
aSB.SetShape(aSx);
|
||||
|
@@ -70,22 +70,6 @@ void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel)
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetNonDestructive
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_CheckerSI::SetNonDestructive(const Standard_Boolean theFlag)
|
||||
{
|
||||
myNonDestructive=theFlag;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : NonDestructive
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BOPAlgo_CheckerSI::NonDestructive() const
|
||||
{
|
||||
return myNonDestructive;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
@@ -50,21 +50,6 @@ Standard_EXPORT virtual ~BOPAlgo_CheckerSI();
|
||||
//! 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:
|
||||
|
||||
@@ -81,7 +66,6 @@ protected:
|
||||
|
||||
|
||||
Standard_Integer myLevelOfCheck;
|
||||
Standard_Boolean myNonDestructive;
|
||||
BOPCol_DataMapOfShapeShape myNewOldMap;
|
||||
|
||||
|
||||
|
@@ -100,6 +100,7 @@ void BOPAlgo_MakerVolume::Perform()
|
||||
pPF->SetRunParallel(myRunParallel);
|
||||
pPF->SetProgressIndicator(myProgressIndicator);
|
||||
pPF->SetFuzzyValue(myFuzzyValue);
|
||||
pPF->SetNonDestructive(myNonDestructive);
|
||||
pPF->Perform();
|
||||
//
|
||||
myEntryPoint = 1;
|
||||
|
@@ -42,6 +42,8 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
|
||||
{
|
||||
myDS=NULL;
|
||||
myIterator=NULL;
|
||||
myNonDestructive=Standard_False;
|
||||
myIsPrimary=Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function :
|
||||
@@ -55,6 +57,8 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
|
||||
{
|
||||
myDS=NULL;
|
||||
myIterator=NULL;
|
||||
myNonDestructive=Standard_False;
|
||||
myIsPrimary=Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ~
|
||||
@@ -65,6 +69,38 @@ BOPAlgo_PaveFiller::~BOPAlgo_PaveFiller()
|
||||
Clear();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetNonDestructive
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::SetNonDestructive(const Standard_Boolean bFlag)
|
||||
{
|
||||
myNonDestructive=bFlag;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : NonDestructive
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BOPAlgo_PaveFiller::NonDestructive()const
|
||||
{
|
||||
return myNonDestructive;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetIsPrimary
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::SetIsPrimary(const Standard_Boolean bFlag)
|
||||
{
|
||||
myIsPrimary=bFlag;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsPrimary
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BOPAlgo_PaveFiller::IsPrimary()const
|
||||
{
|
||||
return myIsPrimary;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
@@ -175,6 +211,9 @@ void BOPAlgo_PaveFiller::Init()
|
||||
// 3 myContext
|
||||
myContext=new IntTools_Context;
|
||||
//
|
||||
// 4 NonDestructive flag
|
||||
SetNonDestructive();
|
||||
//
|
||||
myErrorStatus=0;
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -224,27 +263,26 @@ void BOPAlgo_PaveFiller::PerformInternal()
|
||||
return;
|
||||
}
|
||||
//
|
||||
UpdatePaveBlocksWithSDVertices();
|
||||
myDS->UpdatePaveBlocks();
|
||||
// 11
|
||||
PerformEE();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
UpdatePaveBlocksWithSDVertices();
|
||||
// 02
|
||||
PerformVF();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
UpdatePaveBlocksWithSDVertices();
|
||||
// 12
|
||||
PerformEF();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
MakeSplitEdges();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
UpdatePaveBlocksWithSDVertices();
|
||||
//
|
||||
// 22
|
||||
PerformFF();
|
||||
@@ -252,6 +290,15 @@ void BOPAlgo_PaveFiller::PerformInternal()
|
||||
return;
|
||||
}
|
||||
//
|
||||
UpdateBlocksWithSharedVertices();
|
||||
//
|
||||
MakeSplitEdges();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
UpdatePaveBlocksWithSDVertices();
|
||||
//
|
||||
MakeBlocks();
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
@@ -268,7 +315,6 @@ void BOPAlgo_PaveFiller::PerformInternal()
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
// 03
|
||||
PerformVZ();
|
||||
if (myErrorStatus) {
|
||||
|
@@ -50,13 +50,13 @@ class IntTools_Context;
|
||||
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:
|
||||
@@ -65,7 +65,8 @@ public:
|
||||
|
||||
|
||||
Standard_EXPORT BOPAlgo_PaveFiller();
|
||||
Standard_EXPORT virtual ~BOPAlgo_PaveFiller();
|
||||
|
||||
Standard_EXPORT virtual ~BOPAlgo_PaveFiller();
|
||||
|
||||
Standard_EXPORT BOPAlgo_PaveFiller(const BOPCol_BaseAllocator& theAllocator);
|
||||
|
||||
@@ -83,6 +84,16 @@ Standard_EXPORT virtual ~BOPAlgo_PaveFiller();
|
||||
|
||||
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
|
||||
@@ -96,7 +107,14 @@ Standard_EXPORT virtual ~BOPAlgo_PaveFiller();
|
||||
|
||||
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();
|
||||
@@ -134,6 +152,8 @@ protected:
|
||||
Standard_EXPORT void MakeBlocks();
|
||||
|
||||
Standard_EXPORT void MakePCurves();
|
||||
|
||||
Standard_EXPORT void MakeSDVertices(const BOPCol_ListOfInteger& theVertIndices);
|
||||
|
||||
Standard_EXPORT void ProcessDE();
|
||||
|
||||
@@ -231,7 +251,7 @@ protected:
|
||||
|
||||
|
||||
//! 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>
|
||||
@@ -276,6 +296,28 @@ protected:
|
||||
//! 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;
|
||||
@@ -283,6 +325,8 @@ protected:
|
||||
Handle(IntTools_Context) myContext;
|
||||
BOPAlgo_SectionAttribute mySectionAttribute;
|
||||
Standard_Real myFuzzyValue;
|
||||
Standard_Boolean myNonDestructive;
|
||||
Standard_Boolean myIsPrimary;
|
||||
|
||||
|
||||
private:
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#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>
|
||||
@@ -31,9 +32,13 @@
|
||||
#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>
|
||||
|
||||
@@ -44,11 +49,8 @@
|
||||
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;
|
||||
//
|
||||
@@ -58,8 +60,6 @@ void BOPAlgo_PaveFiller::PerformVV()
|
||||
return;
|
||||
}
|
||||
//
|
||||
aSIn.SetShapeType(TopAbs_VERTEX);
|
||||
|
||||
BOPDS_VectorOfInterfVV& aVVs=myDS->InterfVV();
|
||||
aVVs.SetIncrement(aSize);
|
||||
//
|
||||
@@ -68,7 +68,6 @@ void BOPAlgo_PaveFiller::PerformVV()
|
||||
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()) {
|
||||
@@ -91,47 +90,80 @@ void BOPAlgo_PaveFiller::PerformVV()
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
232
src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx
Normal file
232
src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx
Normal file
@@ -0,0 +1,232 @@
|
||||
// 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();
|
||||
}
|
@@ -28,14 +28,17 @@
|
||||
#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
|
||||
@@ -48,7 +51,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
|
||||
|
||||
BOPAlgo_VertexEdge() :
|
||||
BOPAlgo_Algo(),
|
||||
myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.) {
|
||||
myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.), myTolVNew(-1.) {
|
||||
};
|
||||
//
|
||||
virtual ~BOPAlgo_VertexEdge(){
|
||||
@@ -74,15 +77,15 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
|
||||
myV=aV;
|
||||
}
|
||||
//
|
||||
const TopoDS_Vertex& Vertex()const {
|
||||
return myV;
|
||||
}
|
||||
//
|
||||
void SetEdge(const TopoDS_Edge& aE) {
|
||||
myE=aE;
|
||||
}
|
||||
//
|
||||
const TopoDS_Edge& Edge()const {
|
||||
const TopoDS_Vertex& Vertex() const {
|
||||
return myV;
|
||||
}
|
||||
//
|
||||
const TopoDS_Edge& Edge() const {
|
||||
return myE;
|
||||
}
|
||||
//
|
||||
@@ -94,6 +97,10 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
|
||||
return myT;
|
||||
}
|
||||
//
|
||||
Standard_Real VertexNewTolerance()const {
|
||||
return myTolVNew;
|
||||
}
|
||||
//
|
||||
void SetContext(const Handle(IntTools_Context)& aContext) {
|
||||
myContext=aContext;
|
||||
}
|
||||
@@ -104,7 +111,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
myFlag=myContext->ComputeVE (myV, myE, myT);
|
||||
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew);
|
||||
};
|
||||
//
|
||||
protected:
|
||||
@@ -113,6 +120,7 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
|
||||
Standard_Integer myIVx;
|
||||
Standard_Integer myFlag;
|
||||
Standard_Real myT;
|
||||
Standard_Real myTolVNew;
|
||||
TopoDS_Vertex myV;
|
||||
TopoDS_Edge myE;
|
||||
Handle(IntTools_Context) myContext;
|
||||
@@ -140,15 +148,16 @@ void BOPAlgo_PaveFiller::PerformVE()
|
||||
{
|
||||
Standard_Boolean bJustAdd;
|
||||
Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, k, aNbVE;
|
||||
Standard_Real aT, aTolE, aTolV;
|
||||
Standard_Real aT, 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) {
|
||||
@@ -188,6 +197,12 @@ void BOPAlgo_PaveFiller::PerformVE()
|
||||
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)));
|
||||
//
|
||||
@@ -211,29 +226,50 @@ void BOPAlgo_PaveFiller::PerformVE()
|
||||
if (!iFlag) {
|
||||
aVESolver.Indices(nV, nE, nVx);
|
||||
aT=aVESolver.Parameter();
|
||||
const TopoDS_Vertex& aV=aVESolver.Vertex();
|
||||
const TopoDS_Edge& aE=aVESolver.Edge();
|
||||
//
|
||||
// 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) {
|
||||
}
|
||||
|
@@ -40,10 +40,11 @@
|
||||
#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>
|
||||
@@ -61,12 +62,6 @@
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_EdgeEdge
|
||||
@@ -239,7 +234,8 @@ class BOPAlgo_PVE {
|
||||
}
|
||||
//
|
||||
void Perform() {
|
||||
myFlag=myContext->ComputeVE (myV, myE, myT);
|
||||
Standard_Real dummy;
|
||||
myFlag = myContext->ComputeVE(myV, myE, myT, dummy);
|
||||
};
|
||||
//
|
||||
protected:
|
||||
@@ -392,7 +388,19 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
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);
|
||||
//
|
||||
@@ -448,10 +456,19 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
}
|
||||
//
|
||||
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;
|
||||
//
|
||||
@@ -469,7 +486,6 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
nVS[j]=nV[3];
|
||||
}
|
||||
//
|
||||
aTolVnew=BRep_Tool::Tolerance(aVnew);
|
||||
aPnew=BRep_Tool::Pnt(aVnew);
|
||||
//
|
||||
for (Standard_Integer k1=0; k1<=j; ++k1) {
|
||||
@@ -503,6 +519,7 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
//
|
||||
aCPB.SetPaveBlocks(aPB1, aPB2);
|
||||
aCPB.SetIndexInterf(iX);
|
||||
aCPB.SetTolerance(aTolVnew);
|
||||
aMVCPB.Add(aVnew, aCPB);
|
||||
}//case TopAbs_VERTEX:
|
||||
break;
|
||||
@@ -571,7 +588,7 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
aMPBToUpdate.Clear();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformVertices
|
||||
//function : PerformVerticesEE
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
|
||||
@@ -603,17 +620,8 @@ 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
|
||||
@@ -628,6 +636,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
|
||||
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()) {
|
||||
@@ -729,33 +738,30 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
|
||||
//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);
|
||||
//
|
||||
@@ -806,14 +812,8 @@ void BOPAlgo_PaveFiller::TreatNewVertices
|
||||
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);
|
||||
@@ -822,23 +822,15 @@ void BOPAlgo_PaveFiller::TreatNewVertices
|
||||
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);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -891,8 +883,8 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
|
||||
Handle(BOPDS_PaveBlock)& aPB,
|
||||
BOPDS_MapOfPaveBlock& aMPBToUpdate)
|
||||
{
|
||||
Standard_Integer aNbPnt, nE;
|
||||
gp_Pnt aP;
|
||||
Standard_Integer nE, nVx, nVSD, iFlag;
|
||||
Standard_Real aT, aTolVNew;
|
||||
//
|
||||
nE = aPB->OriginalEdge();
|
||||
//
|
||||
@@ -909,60 +901,44 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) {
|
||||
if (aPB->Pave1().Index() == nV ||
|
||||
aPB->Pave2().Index() == nV) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
|
||||
nVx = nV;
|
||||
if (myDS->HasShapeSD(nV, nVSD)) {
|
||||
nVx = nVSD;
|
||||
}
|
||||
//
|
||||
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nVx);
|
||||
const TopoDS_Edge& aE = *(TopoDS_Edge*) &myDS->Shape(nE);
|
||||
aP=BRep_Tool::Pnt(aV);
|
||||
//
|
||||
GeomAPI_ProjectPointOnCurve& aProjector=myContext->ProjPC(aE);
|
||||
aProjector.Perform(aP);
|
||||
//
|
||||
aNbPnt = aProjector.NbPoints();
|
||||
if (aNbPnt) {
|
||||
Standard_Real aT, aDist;
|
||||
//Standard_Integer i;
|
||||
BRep_Builder aBB;
|
||||
iFlag = myContext->ComputeVE(aV, aE, aT, aTolVNew);
|
||||
if (iFlag == 0 || iFlag == -4) {
|
||||
BOPDS_Pave aPave;
|
||||
//
|
||||
aDist=aProjector.LowerDistance();
|
||||
aT=aProjector.LowerDistanceParameter();
|
||||
//
|
||||
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
|
||||
aVEs.SetIncrement(10);
|
||||
// 1
|
||||
BOPDS_InterfVE& aVE=aVEs.Append1();
|
||||
aVE.SetIndices(nV, nE);
|
||||
aVE.SetParameter(aT);
|
||||
//
|
||||
// 2
|
||||
myDS->AddInterf(nV, nE);
|
||||
//
|
||||
aBB.UpdateVertex(aV, aDist);
|
||||
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
|
||||
Bnd_Box& aBox=aSIDS.ChangeBox();
|
||||
BRepBndLib::Add(aV, aBox);
|
||||
//
|
||||
aPave.SetIndex(nV);
|
||||
// 3 update vertex V/E if necessary
|
||||
nVx=UpdateVertex(nV, aTolVNew);
|
||||
// 4
|
||||
if (myDS->IsNewShape(nVx)) {
|
||||
aVE.SetIndexNew(nVx);
|
||||
}
|
||||
// 5 append ext pave to pave block
|
||||
aPave.SetIndex(nVx);
|
||||
aPave.SetParameter(aT);
|
||||
aPB->AppendExtPave(aPave);
|
||||
//
|
||||
aMPBToUpdate.Add(aPB);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// DEBf
|
||||
{
|
||||
TopoDS_Compound aCx;
|
||||
BRep_Builder aBBx;
|
||||
aBBx.MakeCompound(aCx);
|
||||
aItMVCPB.Initialize(theMVCPB);
|
||||
for (; aItMVCPB.More(); aItMVCPB.Next()) {
|
||||
const TopoDS_Shape& aS=aItMVCPB.Key();
|
||||
aBBx.Add(aCx, aS);
|
||||
}
|
||||
BRepTools::Write(aCx, "cx");
|
||||
}
|
||||
// DEBt
|
||||
*/
|
||||
|
@@ -54,7 +54,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
|
||||
BOPAlgo_VertexFace() :
|
||||
BOPAlgo_Algo(),
|
||||
myIV(-1), myIF(-1), myIVx(-1),
|
||||
myFlag(-1), myT1(-1.), myT2(-1.) {
|
||||
myFlag(-1), myT1(-1.), myT2(-1.), myTolVNew(-1.) {
|
||||
}
|
||||
//
|
||||
virtual ~BOPAlgo_VertexFace(){
|
||||
@@ -102,6 +102,10 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
|
||||
aT2=myT2;
|
||||
}
|
||||
//
|
||||
Standard_Real VertexNewTolerance()const {
|
||||
return myTolVNew;
|
||||
}
|
||||
//
|
||||
void SetContext(const Handle(IntTools_Context)& aContext) {
|
||||
myContext=aContext;
|
||||
}
|
||||
@@ -112,7 +116,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2);
|
||||
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew);
|
||||
}
|
||||
//
|
||||
protected:
|
||||
@@ -122,6 +126,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
|
||||
Standard_Integer myFlag;
|
||||
Standard_Real myT1;
|
||||
Standard_Real myT2;
|
||||
Standard_Real myTolVNew;
|
||||
TopoDS_Vertex myV;
|
||||
TopoDS_Face myF;
|
||||
Handle(IntTools_Context) myContext;
|
||||
@@ -149,8 +154,7 @@ void BOPAlgo_PaveFiller::PerformVF()
|
||||
{
|
||||
Standard_Boolean bJustAdd;
|
||||
Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, aNbVF, k;
|
||||
Standard_Real aT1, aT2, aTolF, aTolV;
|
||||
BRep_Builder aBB;
|
||||
Standard_Real aT1, aT2;
|
||||
BOPAlgo_VectorOfVertexFace aVVF;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
@@ -214,27 +218,25 @@ void BOPAlgo_PaveFiller::PerformVF()
|
||||
//
|
||||
aVertexFace.Indices(nV, nF, nVx);
|
||||
aVertexFace.Parameters(aT1, aT2);
|
||||
const TopoDS_Vertex& aV=aVertexFace.Vertex();
|
||||
const TopoDS_Face& aF=aVertexFace.Face();
|
||||
// 1
|
||||
BOPDS_InterfVF& aVF=aVFs.Append1();
|
||||
aVF.SetIndices(nVx, nF);
|
||||
aVF.SetUV(aT1, aT2);
|
||||
// 2
|
||||
myDS->AddInterf(nVx, nF);
|
||||
// 3
|
||||
//
|
||||
// 3 update vertex V/F if necessary
|
||||
Standard_Real aTolVNew = aVertexFace.VertexNewTolerance();
|
||||
nVx=UpdateVertex(nVx, aTolVNew);
|
||||
//
|
||||
// 4
|
||||
if (myDS->IsNewShape(nVx)) {
|
||||
aVF.SetIndexNew(nVx);
|
||||
}
|
||||
// 5 update FaceInfo
|
||||
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
|
||||
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
|
||||
aMVIn.Add(nVx);
|
||||
// 4
|
||||
aTolV = BRep_Tool::Tolerance(aV);
|
||||
aTolF = BRep_Tool::Tolerance(aF);
|
||||
if (aTolV < aTolF) {
|
||||
aBB.UpdateVertex(aV, aTolF);
|
||||
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVx);
|
||||
Bnd_Box& aBoxV = aSIV.ChangeBox();
|
||||
BRepBndLib::Add(aV, aBoxV);
|
||||
}
|
||||
}//for (k=0; k < aNbVF; ++k) {
|
||||
}// if (iSize) {
|
||||
else {
|
||||
@@ -252,7 +254,7 @@ void BOPAlgo_PaveFiller::PerformVF()
|
||||
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;
|
||||
//
|
||||
@@ -313,7 +315,7 @@ void BOPAlgo_PaveFiller::TreatVerticesEE()
|
||||
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();
|
||||
|
@@ -16,6 +16,8 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_SectionAttribute.hxx>
|
||||
@@ -23,6 +25,7 @@
|
||||
#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>
|
||||
@@ -46,19 +49,11 @@
|
||||
#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 :
|
||||
@@ -159,7 +154,6 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
TopAbs_ShapeEnum aType;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aIt;
|
||||
BOPAlgo_VectorOfEdgeFace aVEdgeFace;
|
||||
BRep_Builder aBB;
|
||||
//-----------------------------------------------------scope f
|
||||
//
|
||||
aAllocator=NCollection_BaseAllocator::CommonBaseAllocator();
|
||||
@@ -272,7 +266,17 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
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();
|
||||
@@ -294,7 +298,8 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
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]) {
|
||||
@@ -318,10 +323,23 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
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);
|
||||
@@ -334,15 +352,21 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
continue;
|
||||
}
|
||||
//
|
||||
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)) {
|
||||
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.);
|
||||
}
|
||||
//
|
||||
aBB.UpdateVertex(aVnew, aTolV);
|
||||
const gp_Pnt& aPnew = BRep_Tool::Pnt(aVnew);
|
||||
//
|
||||
if (!myContext->IsPointInFace(aPnew, aF, aTolVnew)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aMIEFC.Add(nF);
|
||||
// 1
|
||||
@@ -357,6 +381,7 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
//
|
||||
aCPB.SetPaveBlocks(aPB, aPB);
|
||||
aCPB.SetIndexInterf(iX);
|
||||
aCPB.SetTolerance(aTolVnew);
|
||||
aMVCPB.Add(aVnew, aCPB);
|
||||
}
|
||||
}
|
||||
@@ -375,11 +400,6 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
myDS->AddInterf(nE, nF);
|
||||
break;
|
||||
}
|
||||
//update tolerance of edge if needed
|
||||
if (aTolE < aTolF) {
|
||||
myDS->UpdateEdgeTolerance(nE, aTolF);
|
||||
aTolE = aTolF;
|
||||
}
|
||||
aEF.SetCommonPart(aCPart);
|
||||
// 2
|
||||
myDS->AddInterf(nE, nF);
|
||||
@@ -417,7 +437,7 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
////aAllocator.Nullify();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformVertices1
|
||||
//function : PerformVerticesEF
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
|
||||
@@ -433,7 +453,7 @@ 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;
|
||||
@@ -445,17 +465,28 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
|
||||
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();
|
||||
@@ -465,7 +496,58 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
|
||||
}
|
||||
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()) {
|
||||
@@ -478,20 +560,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
|
||||
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);
|
||||
@@ -527,7 +596,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
|
||||
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);
|
||||
@@ -535,7 +604,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
|
||||
}
|
||||
}
|
||||
}
|
||||
// 6 Split PaveBlocksa
|
||||
// 6 Split PaveBlocks
|
||||
for (i=1; i<=aNbPBLI; ++i) {
|
||||
Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
|
||||
nE=aPB->OriginalEdge();
|
||||
@@ -620,46 +689,37 @@ Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF
|
||||
const Standard_Integer nF)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Integer iFlag, nVx;
|
||||
Standard_Real U, V, aTolVNew;
|
||||
//
|
||||
bRet = Standard_False;
|
||||
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
|
||||
const TopoDS_Face& aF = *(TopoDS_Face*) &myDS->Shape(nF);
|
||||
//
|
||||
GeomAPI_ProjectPointOnSurf& aProj = myContext->ProjPS(aF);
|
||||
const gp_Pnt& aP = BRep_Tool::Pnt(aV);
|
||||
aProj.Perform(aP);
|
||||
if (!aProj.IsDone()) {
|
||||
return bRet;
|
||||
}
|
||||
Standard_Real aDist, U, V;
|
||||
iFlag = myContext->ComputeVF(aV, aF, U, V, aTolVNew);
|
||||
if (iFlag == 0 || iFlag == -2) {
|
||||
bRet=!bRet;
|
||||
//
|
||||
aDist=aProj.LowerDistance();
|
||||
aProj.LowerDistanceParameters(U, V);
|
||||
//
|
||||
gp_Pnt2d aP2d(U, V);
|
||||
bRet = myContext->IsPointInFace (aF, aP2d);
|
||||
if (bRet) {
|
||||
//Standard_Integer i;
|
||||
BRep_Builder aBB;
|
||||
//
|
||||
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;
|
||||
}
|
||||
|
||||
|
@@ -42,10 +42,12 @@
|
||||
#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>
|
||||
@@ -58,6 +60,7 @@
|
||||
#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>
|
||||
@@ -70,6 +73,7 @@
|
||||
#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>
|
||||
@@ -181,7 +185,7 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
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;
|
||||
@@ -204,22 +208,21 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
const TopoDS_Face& aF1=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
|
||||
const TopoDS_Face& aF2=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
|
||||
//
|
||||
if (aMI.Add(nF1)) {
|
||||
myDS->UpdateFaceInfoOn(nF1);
|
||||
myDS->UpdateFaceInfoIn(nF1);
|
||||
}
|
||||
if (aMI.Add(nF2)) {
|
||||
myDS->UpdateFaceInfoOn(nF2);
|
||||
myDS->UpdateFaceInfoIn(nF2);
|
||||
}
|
||||
//
|
||||
aBAS1.Initialize(aF1, Standard_False);
|
||||
aBAS2.Initialize(aF2, Standard_False);
|
||||
//
|
||||
if (aBAS1.GetType() == GeomAbs_Plane &&
|
||||
aBAS2.GetType() == GeomAbs_Plane) {
|
||||
Standard_Boolean bToIntersect;
|
||||
//
|
||||
if (aMI.Add(nF1)) {
|
||||
myDS->UpdateFaceInfoOn(nF1);
|
||||
myDS->UpdateFaceInfoIn(nF1);
|
||||
}
|
||||
if (aMI.Add(nF2)) {
|
||||
myDS->UpdateFaceInfoOn(nF2);
|
||||
myDS->UpdateFaceInfoIn(nF2);
|
||||
}
|
||||
//
|
||||
bToIntersect = CheckPlanes(nF1, nF2);
|
||||
if (!bToIntersect) {
|
||||
myDS->AddInterf(nF1, nF2);
|
||||
@@ -264,11 +267,15 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
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;
|
||||
}
|
||||
@@ -290,6 +297,7 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
//
|
||||
aFF.SetTolR3D(aTolR3D);
|
||||
aFF.SetTolR2D(aTolR2D);
|
||||
aFF.SetTolReal(aTolReal);
|
||||
aFF.SetTangentFaces(bTangentFaces);
|
||||
//
|
||||
// Curves, Points
|
||||
@@ -525,10 +533,11 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
|
||||
aTolE = BRep_Tool::Tolerance(aE);
|
||||
if (aTolR3D > aTolE) {
|
||||
myDS->UpdateEdgeTolerance(nE, aTolR3D);
|
||||
UpdateEdgeTolerance(nE, aTolR3D);
|
||||
}
|
||||
bInBothFaces = Standard_False;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bInBothFaces = (aFI1.PaveBlocksOn().Contains(aPBOut) ||
|
||||
aFI1.PaveBlocksIn().Contains(aPBOut))&&
|
||||
(aFI2.PaveBlocksOn().Contains(aPBOut) ||
|
||||
@@ -594,6 +603,8 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
// reduce tolerances of section edges where it is appropriate
|
||||
CorrectToleranceOfSE();
|
||||
//
|
||||
// update face info
|
||||
UpdateFaceInfo(aDMExEdges, aDMI);
|
||||
@@ -630,19 +641,20 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
//
|
||||
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();
|
||||
//
|
||||
@@ -756,7 +768,7 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
else {
|
||||
aSI.SetShapeType(aType);
|
||||
aSI.SetShape(aSx);
|
||||
iE=myDS->Append(aSI);
|
||||
iE = myDS->Append(aSI);
|
||||
//
|
||||
aPB1->SetEdge(iE);
|
||||
}
|
||||
@@ -767,8 +779,21 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
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);
|
||||
@@ -805,10 +830,6 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
//
|
||||
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);
|
||||
@@ -817,33 +838,18 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
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() &&
|
||||
@@ -863,6 +869,14 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
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);
|
||||
@@ -1035,14 +1049,13 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
|
||||
//function : IsExistingVertex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex
|
||||
(const gp_Pnt& aP,
|
||||
const Standard_Real theTolR3D,
|
||||
const BOPCol_MapOfInteger& aMVOnIn)const
|
||||
Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex
|
||||
(const gp_Pnt& aP,
|
||||
const Standard_Real theTolR3D,
|
||||
const BOPCol_MapOfInteger& aMVOnIn)const
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Integer nV, iFlag;
|
||||
Standard_Real aTolV;
|
||||
gp_Pnt aPV;
|
||||
Bnd_Box aBoxP;
|
||||
BOPCol_MapIteratorOfMapOfInteger aIt;
|
||||
@@ -1054,14 +1067,10 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
|
||||
//
|
||||
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);
|
||||
@@ -1076,11 +1085,11 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
|
||||
//function : IsExistingPaveBlock
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
(const Handle(BOPDS_PaveBlock)& thePB,
|
||||
const BOPDS_Curve& theNC,
|
||||
const Standard_Real theTolR3D,
|
||||
const BOPCol_ListOfInteger& theLSE)
|
||||
Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
(const Handle(BOPDS_PaveBlock)& thePB,
|
||||
const BOPDS_Curve& theNC,
|
||||
const Standard_Real theTolR3D,
|
||||
const BOPCol_ListOfInteger& theLSE)
|
||||
{
|
||||
Standard_Boolean bRet=Standard_True;
|
||||
//
|
||||
@@ -1103,6 +1112,8 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
|
||||
aItLI.Initialize(theLSE);
|
||||
for (; aItLI.More(); aItLI.Next()) {
|
||||
nE=aItLI.Value();
|
||||
if (nE < 0)
|
||||
continue;
|
||||
const BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE);
|
||||
const Bnd_Box& aBoxE=aSIE.Box();
|
||||
if (!aBoxE.IsOut(aBoxPm)) {
|
||||
@@ -1159,6 +1170,8 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
|
||||
const Handle(BOPDS_PaveBlock)& aPB = theMPBOnIn(i);
|
||||
aPB->Indices(nV21, nV22);
|
||||
nSp=aPB->Edge();
|
||||
if (nSp < 0)
|
||||
continue;
|
||||
const BOPDS_ShapeInfo& aSISp=myDS->ChangeShapeInfo(nSp);
|
||||
const TopoDS_Edge& aSp=(*(TopoDS_Edge *)(&aSISp.Shape()));
|
||||
const Bnd_Box& aBoxSp=aSISp.Box();
|
||||
@@ -1288,6 +1301,7 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
|
||||
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVn);
|
||||
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
|
||||
BRepBndLib::Add(aVn, aBoxDS);
|
||||
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
|
||||
//
|
||||
aLVB.Append(nVn);
|
||||
}
|
||||
@@ -1418,9 +1432,10 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance
|
||||
//function : GetEFPnts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::GetEFPnts(const Standard_Integer nF1,
|
||||
const Standard_Integer nF2,
|
||||
IntSurf_ListOfPntOn2S& aListOfPnts)
|
||||
void BOPAlgo_PaveFiller::GetEFPnts
|
||||
(const Standard_Integer nF1,
|
||||
const Standard_Integer nF2,
|
||||
IntSurf_ListOfPntOn2S& aListOfPnts)
|
||||
{
|
||||
Standard_Integer nE, nF, nFOpposite, aNbEFs, i;
|
||||
Standard_Real U1, U2, V1, V2, f, l;
|
||||
@@ -1625,11 +1640,11 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance
|
||||
//function : GetStickVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1,
|
||||
const Standard_Integer nF2,
|
||||
BOPCol_MapOfInteger& aMVStick,
|
||||
BOPCol_MapOfInteger& aMVEF,
|
||||
BOPCol_MapOfInteger& aMI)
|
||||
void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1,
|
||||
const Standard_Integer nF2,
|
||||
BOPCol_MapOfInteger& aMVStick,
|
||||
BOPCol_MapOfInteger& aMVEF,
|
||||
BOPCol_MapOfInteger& aMI)
|
||||
{
|
||||
Standard_Integer nS1, nS2, nVNew, aTypeInt, i;
|
||||
//
|
||||
@@ -1799,6 +1814,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVToUpdate);
|
||||
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
|
||||
BRepBndLib::Add(aVToUpdate, aBoxDS);
|
||||
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1807,7 +1823,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
//function : ProcessOldPaveBlocks
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
|
||||
void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
|
||||
(const Standard_Integer theInt,
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBOnIn,
|
||||
const BOPCol_DataMapOfIntegerListOfInteger& aDMBV,
|
||||
@@ -1819,7 +1835,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Real aT;
|
||||
Standard_Real aT, dummy;
|
||||
Standard_Integer i, nV, nE, iC, aNbPB, iFlag;
|
||||
BOPCol_ListIteratorOfListOfInteger aItLI;
|
||||
BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItBV;
|
||||
@@ -1857,6 +1873,9 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
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);
|
||||
@@ -1868,7 +1887,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
//
|
||||
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);
|
||||
@@ -1881,11 +1900,11 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
//function : UpdateExistingPaveBlocks
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
|
||||
(const Handle(BOPDS_PaveBlock)& aPBf,
|
||||
BOPDS_ListOfPaveBlock& aLPB,
|
||||
const Standard_Integer nF1,
|
||||
const Standard_Integer nF2)
|
||||
void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
|
||||
(const Handle(BOPDS_PaveBlock)& aPBf,
|
||||
BOPDS_ListOfPaveBlock& aLPB,
|
||||
const Standard_Integer nF1,
|
||||
const Standard_Integer nF2)
|
||||
{
|
||||
Standard_Integer nE;
|
||||
Standard_Boolean bCB;
|
||||
@@ -1967,7 +1986,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
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();
|
||||
@@ -2043,7 +2062,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
// function: PutClosingPaveOnCurve
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
|
||||
void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
|
||||
{
|
||||
Standard_Boolean bIsClosed, bHasBounds, bAdded;
|
||||
Standard_Integer nVC, j;
|
||||
@@ -2098,7 +2117,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
//function : PreparePostTreatFF
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PreparePostTreatFF
|
||||
void BOPAlgo_PaveFiller::PreparePostTreatFF
|
||||
(const Standard_Integer aInt,
|
||||
const Standard_Integer aCur,
|
||||
const Handle(BOPDS_PaveBlock)& aPB,
|
||||
@@ -2170,7 +2189,7 @@ Standard_Boolean BOPAlgo_PaveFiller::CheckPlanes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::UpdatePaveBlocks
|
||||
(const BOPCol_DataMapOfIntegerInteger& aDMI)
|
||||
(const BOPCol_DataMapOfIntegerInteger& aDMI)
|
||||
{
|
||||
if (aDMI.IsEmpty()) {
|
||||
return;
|
||||
@@ -2181,25 +2200,28 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
|
||||
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])) {
|
||||
@@ -2212,13 +2234,28 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
|
||||
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);
|
||||
@@ -2231,7 +2268,87 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
|
||||
}// 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
|
||||
@@ -2264,3 +2381,201 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
|
||||
aTolFF = Max(aTolFF, 5.e-6);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : UpdateBlocksWithSharedVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::UpdateBlocksWithSharedVertices()
|
||||
{
|
||||
if (!myNonDestructive) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
Standard_Integer aNbFF;
|
||||
//
|
||||
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
|
||||
aNbFF=aFFs.Extent();
|
||||
if (!aNbFF) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bOnCurve, bHasShapeSD;
|
||||
Standard_Integer i, nF1, nF2, aNbC, j, nV, nVSD;
|
||||
Standard_Real aTolR3D, aTolV;
|
||||
BOPCol_MapOfInteger aMF;
|
||||
//
|
||||
for (i=0; i<aNbFF; ++i) {
|
||||
BOPDS_InterfFF& aFF=aFFs(i);
|
||||
//
|
||||
BOPDS_VectorOfCurve& aVC=aFF.ChangeCurves();
|
||||
aNbC=aVC.Extent();
|
||||
if (!aNbC) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aFF.Indices(nF1, nF2);
|
||||
aTolR3D=aFF.TolR3D();
|
||||
//
|
||||
if (aMF.Add(nF1)) {
|
||||
myDS->UpdateFaceInfoOn(nF1);
|
||||
}
|
||||
if (aMF.Add(nF2)) {
|
||||
myDS->UpdateFaceInfoOn(nF2);
|
||||
}
|
||||
//
|
||||
// Collect old vertices that are shared for nF1, nF2 ->aMI;
|
||||
BOPCol_MapOfInteger aMI;
|
||||
BOPCol_MapIteratorOfMapOfInteger aItMI;
|
||||
//
|
||||
BOPDS_FaceInfo& aFI1=myDS->ChangeFaceInfo(nF1);
|
||||
BOPDS_FaceInfo& aFI2=myDS->ChangeFaceInfo(nF2);
|
||||
//
|
||||
const BOPCol_MapOfInteger& aMVOn1=aFI1.VerticesOn();
|
||||
const BOPCol_MapOfInteger& aMVIn1=aFI1.VerticesIn();
|
||||
const BOPCol_MapOfInteger& aMVOn2=aFI2.VerticesOn();
|
||||
const BOPCol_MapOfInteger& aMVIn2=aFI2.VerticesIn();
|
||||
//
|
||||
for (j=0; j<2; ++j) {
|
||||
const BOPCol_MapOfInteger& aMV1=(!j) ? aMVOn1 : aMVIn1;
|
||||
aItMI.Initialize(aMV1);
|
||||
for (; aItMI.More(); aItMI.Next()) {
|
||||
nV=aItMI.Value();
|
||||
if (myDS->IsNewShape(nV)) {
|
||||
continue;
|
||||
}
|
||||
if (aMVOn2.Contains(nV) || aMVIn2.Contains(nV)) {
|
||||
aMI.Add(nV);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Try to put vertices aMI on curves
|
||||
for (j=0; j<aNbC; ++j) {
|
||||
BOPDS_Curve& aNC=aVC.ChangeValue(j);
|
||||
//const IntTools_Curve& aIC=aNC.Curve();
|
||||
//
|
||||
aItMI.Initialize(aMI);
|
||||
for (; aItMI.More(); aItMI.Next()) {
|
||||
nV=aItMI.Value();
|
||||
//
|
||||
bHasShapeSD=myDS->HasShapeSD(nV, nVSD);
|
||||
if (bHasShapeSD) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
bOnCurve=EstimatePaveOnCurve(nV, aNC, aTolR3D);
|
||||
if (!bOnCurve) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Vertex& aV=*((TopoDS_Vertex *)&myDS->Shape(nV));
|
||||
aTolV=BRep_Tool::Tolerance(aV);
|
||||
//
|
||||
UpdateVertex(nV, aTolV);
|
||||
}
|
||||
}//for (j=0; j<aNbC; ++j) {
|
||||
}//for (i=0; i<aNbFF; ++i) {
|
||||
//
|
||||
UpdateCommonBlocksWithSDVertices();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : EstimatePaveOnCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BOPAlgo_PaveFiller::EstimatePaveOnCurve
|
||||
(const Standard_Integer nV,
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_SectionAttribute.hxx>
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
#include <BOPCol_IndexedMapOfShape.hxx>
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
#include <BOPCol_Parallel.hxx>
|
||||
@@ -45,10 +46,14 @@
|
||||
#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>
|
||||
@@ -74,6 +79,7 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo {
|
||||
BOPAlgo_Algo() {
|
||||
myT1=0.;
|
||||
myT2=0.;
|
||||
myTol = 0.;
|
||||
}
|
||||
//
|
||||
virtual ~BOPAlgo_SplitEdge() {
|
||||
@@ -116,13 +122,27 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo {
|
||||
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:
|
||||
@@ -138,19 +158,26 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo {
|
||||
// <-
|
||||
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
|
||||
@@ -342,13 +369,17 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
|
||||
Standard_Boolean bCB, bV1, bV2;
|
||||
Standard_Integer i, nE, nV1, nV2, nSp, aNbPB, aNbVBSE, k;
|
||||
Standard_Real aT1, aT2;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItPB, aItPBCB;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
|
||||
Handle(BOPDS_PaveBlock) aPB;
|
||||
BOPDS_MapOfPaveBlock aMPB(100);
|
||||
TopoDS_Vertex aV1, aV2;
|
||||
TopoDS_Edge aE;
|
||||
BOPAlgo_VectorOfSplitEdge aVBSE;
|
||||
|
||||
//
|
||||
UpdateCommonBlocksWithSDVertices();
|
||||
//
|
||||
aNbPBP=aPBP.Extent();
|
||||
//
|
||||
for (i=0; i<aNbPBP; ++i) {
|
||||
BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
|
||||
@@ -359,17 +390,31 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
|
||||
aPB->Indices(nV1, nV2);
|
||||
bV1=myDS->IsNewShape(nV1);
|
||||
bV2=myDS->IsNewShape(nV2);
|
||||
bCB=myDS->IsCommonBlock(aPB);
|
||||
//
|
||||
if (!(bV1 || bV2)) {
|
||||
nE=aPB->OriginalEdge();
|
||||
aPB->SetEdge(nE);
|
||||
continue;
|
||||
if (!(bV1 || bV2)) { // no new vertices here
|
||||
if (!myNonDestructive || (myNonDestructive && !bCB)) {
|
||||
nE = aPB->OriginalEdge();
|
||||
aPB->SetEdge(nE);
|
||||
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) {
|
||||
@@ -398,6 +443,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
|
||||
if (bCB) {
|
||||
aBSE.SetCommonBlock(aCB);
|
||||
}
|
||||
aBSE.SetDS(myDS);
|
||||
aBSE.SetProgressIndicator(myProgressIndicator);
|
||||
}
|
||||
} // for (; aItPB.More(); aItPB.Next()) {
|
||||
@@ -405,7 +451,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
|
||||
//
|
||||
aNbVBSE=aVBSE.Extent();
|
||||
//======================================================
|
||||
BOPAlgo_SplitEdgeCnt::Perform(myRunParallel, aVBSE);
|
||||
BOPAlgo_SplitEdgeCnt::Perform(myRunParallel, aVBSE, myContext);
|
||||
//======================================================
|
||||
//
|
||||
BOPDS_ShapeInfo aSI;
|
||||
@@ -427,6 +473,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
|
||||
nSp=myDS->Append(aSI);
|
||||
//
|
||||
if (!aCBk.IsNull()) {
|
||||
myDS->UpdateEdgeTolerance(nSp, aBSE.Tolerance());
|
||||
aCBk->SetEdge(nSp);
|
||||
}
|
||||
else {
|
||||
@@ -434,6 +481,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: SplitEdge
|
||||
// purpose:
|
||||
@@ -466,6 +514,7 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
|
||||
//
|
||||
Bnd_Box& aBox=aSI.ChangeBox();
|
||||
BRepBndLib::Add(aSp, aBox);
|
||||
aBox.SetGap(aBox.GetGap() + Precision::Confusion());
|
||||
//
|
||||
nSp=myDS->Append(aSI);
|
||||
return nSp;
|
||||
@@ -659,6 +708,10 @@ void BOPAlgo_PaveFiller::RefineFaceInfoOn()
|
||||
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)) {
|
||||
@@ -715,6 +768,10 @@ void UpdateVertices(const TopoDS_Edge& aE,
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::Prepare()
|
||||
{
|
||||
if (myNonDestructive) {
|
||||
// do not allow storing pcurves in original edges if non-destructive mode is on
|
||||
return;
|
||||
}
|
||||
TopAbs_ShapeEnum aType[] = {
|
||||
TopAbs_VERTEX,
|
||||
TopAbs_EDGE,
|
||||
|
@@ -88,18 +88,17 @@ void BOPAlgo_PaveFiller::ProcessDE()
|
||||
// 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();
|
||||
@@ -330,8 +329,6 @@ void BOPAlgo_PaveFiller::ProcessDE()
|
||||
aPBD->AppendExtPave1(aPave);
|
||||
}
|
||||
}//for (; aItLPB.More(); aItLPB.Next()) {
|
||||
//
|
||||
myDS->UpdatePaveBlock(aPBD);
|
||||
}
|
||||
//=======================================================================
|
||||
// function: MakeSplitEdge1
|
||||
|
@@ -108,13 +108,12 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
|
||||
}
|
||||
//
|
||||
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);
|
||||
@@ -122,9 +121,9 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
|
||||
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;
|
||||
}
|
||||
//
|
||||
|
@@ -21,14 +21,18 @@
|
||||
#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;
|
||||
@@ -107,10 +111,10 @@
|
||||
//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);
|
||||
@@ -135,10 +139,10 @@
|
||||
//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);
|
||||
@@ -163,10 +167,10 @@
|
||||
//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);
|
||||
@@ -182,9 +186,9 @@
|
||||
//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;
|
||||
@@ -263,9 +267,9 @@
|
||||
//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;
|
||||
//
|
||||
@@ -306,9 +310,9 @@
|
||||
//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;
|
||||
@@ -327,11 +331,123 @@
|
||||
}
|
||||
//
|
||||
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;
|
||||
}
|
||||
|
@@ -29,6 +29,8 @@
|
||||
#include <BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx>
|
||||
|
||||
class BOPDS_PaveBlock;
|
||||
class BOPDS_CommonBlock;
|
||||
class IntTools_Context;
|
||||
|
||||
class BOPAlgo_Tools
|
||||
{
|
||||
@@ -51,6 +53,11 @@ public:
|
||||
|
||||
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
|
||||
|
@@ -160,8 +160,6 @@ void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
|
||||
const BOPCol_ListOfShape& myEdges=aCB.Shapes();
|
||||
//
|
||||
// 1.Filling mySmartMap
|
||||
BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane(myEdges, myFace);
|
||||
//
|
||||
aIt.Initialize(myEdges);
|
||||
for(; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Edge& aE=(*(TopoDS_Edge *)&aIt.Value());
|
||||
|
@@ -42,6 +42,7 @@ BOPAlgo_PaveFiller_7.cxx
|
||||
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
|
||||
@@ -64,4 +65,4 @@ BOPAlgo_WireSplitter.hxx
|
||||
BOPAlgo_WireSplitter.lxx
|
||||
BOPAlgo_WireSplitter_1.cxx
|
||||
BOPAlgo_CellsBuilder.cxx
|
||||
BOPAlgo_CellsBuilder.hxx
|
||||
BOPAlgo_CellsBuilder.hxx
|
||||
|
Reference in New Issue
Block a user