mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0026738: Make Boolean operations safely treating arguments when running with fuzzy option
When fuzzy option is in force prevent increasing tolerance of input shapes. Instead pass increased by fuzzy value the tolerances of sub-shapes everywhere where it is needed by intersection algorithms. The following changes in API have been made: - The methods SetFuzzyValue and FuzzyValue have been moved from the classes BOPAlgo_ArgumentAnalyzer, BOPAlgo_Builder, and BOPAlgo_PaveFiller to the base class BOPAlgo_Algo. - The public method BOPDS_DS::VerticesOnIn has been renamed to SubShapesOnIn, and the new output parameter theCommonPB has been added. - In BOPTools_AlgoTools, a new argument "theFuzzyValue" has been added in the methods ComputeVV and AreFacesSameDomain. - In IntTools_Context, a new argument "theFuzzyValue" has been added in the methods ComputeVE and ComputeVF. - The methods SetFuzzyValue and FuzzyValue have been added in the classes IntTools_EdgeEdge, IntTools_FaceFace. - In the class IntTools_EdgeFace, the methods SetTolE, SetTolF, TolE, TolF have been removed, and the methods SetFuzzyValue, FuzzyValue have been added. - The new argument "theTol" has been added in the method IntTools_WLineTool::DecompositionOfWLine. Some improvements in algorithms have been made during fighting with regressions: - Correct initialization of pave blocks for degenerated edges. - In BOPAlgo_PaveFiller::MakeBlocks(), filter out paves on intersection curve that were put on the curve accidentally due to wide range of E-F intersection vertex. - In the method IntTools_Tools::ComputeTolerance the margin added to the computed tolerance has been increased up to 0.001%. - The method BOPAlgo_PaveFiller::PutPaveOnCurve has been corrected in order to use the original vertex tolerance instead of the value increased during putting it on other curves. - The new method BOPDS_PaveBlock::RemoveExtPave has been added. - The vertex tolerance computation in BOPTools_AlgoTools::CorrectCurveOnSurface has been improved, taking into account intersection segments between p-curves (to avoid regression on "bugs modalg_6 bug22794"). - Improve IsExistingPaveBlock to make more stable catching of coincidence of common block with section curve (against regression "bugs modalg_4 bug697_2" on Linux). Test case for the bug has been added. The following test cases have been updated as improvements: boolean gdml_private ZH2 ZI7 ZJ7 boolean volumemaker C4 The test case bugs/modalg_4/pro19653 has been corrected to make it stable. See comment inside the script for details. The test case bugs/modalg_6/bug25880 has been corrected to suppress wrong bfuse commands. The test bugs/modalg_6/bug26954_3 has been corrected to compare the result with more precise reference value. The "faulty" TODO in boolean/volumemaker/A8 has been made actual for Linux as well. //Eliminate compilation error on Linux.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include <BOPAlgo_Algo.hxx>
|
||||
#include <Message_ProgressIndicator.hxx>
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_ProgramError.hxx>
|
||||
|
||||
@@ -55,7 +56,8 @@ BOPAlgo_Algo::BOPAlgo_Algo()
|
||||
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
|
||||
myErrorStatus(1),
|
||||
myWarningStatus(0),
|
||||
myRunParallel(myGlobalRunParallel)
|
||||
myRunParallel(myGlobalRunParallel),
|
||||
myFuzzyValue(Precision::Confusion())
|
||||
{}
|
||||
//=======================================================================
|
||||
// function:
|
||||
@@ -67,7 +69,8 @@ BOPAlgo_Algo::BOPAlgo_Algo
|
||||
myAllocator(theAllocator),
|
||||
myErrorStatus(1),
|
||||
myWarningStatus(0),
|
||||
myRunParallel(myGlobalRunParallel)
|
||||
myRunParallel(myGlobalRunParallel),
|
||||
myFuzzyValue(Precision::Confusion())
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
@@ -134,6 +137,22 @@ Standard_Boolean BOPAlgo_Algo::RunParallel()const
|
||||
return myRunParallel;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetFuzzyValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_Algo::SetFuzzyValue(const Standard_Real theFuzz)
|
||||
{
|
||||
myFuzzyValue = Max(theFuzz, Precision::Confusion());
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FuzzyValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real BOPAlgo_Algo::FuzzyValue() const
|
||||
{
|
||||
return myFuzzyValue;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetProgressIndicator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
@@ -55,6 +55,12 @@ public:
|
||||
|
||||
//! Returns the flag of parallel processing
|
||||
Standard_EXPORT Standard_Boolean RunParallel() const;
|
||||
|
||||
//! Sets the additional tolerance
|
||||
Standard_EXPORT void SetFuzzyValue (const Standard_Real theFuzz);
|
||||
|
||||
//! Returns the additional tolerance
|
||||
Standard_EXPORT Standard_Real FuzzyValue() const;
|
||||
|
||||
//! Set the Progress Indicator object.
|
||||
Standard_EXPORT void SetProgressIndicator (const Handle(Message_ProgressIndicator)& theObj);
|
||||
@@ -83,6 +89,7 @@ Standard_EXPORT virtual ~BOPAlgo_Algo();
|
||||
Standard_Integer myErrorStatus;
|
||||
Standard_Integer myWarningStatus;
|
||||
Standard_Boolean myRunParallel;
|
||||
Standard_Real myFuzzyValue;
|
||||
Handle(Message_ProgressIndicator) myProgressIndicator;
|
||||
|
||||
|
||||
|
@@ -68,8 +68,7 @@ myMergeEdgeMode(Standard_False),
|
||||
myContinuityMode(Standard_False),
|
||||
myCurveOnSurfaceMode(Standard_False),
|
||||
myEmpty1(Standard_False),
|
||||
myEmpty2(Standard_False),
|
||||
myFuzzyValue(0.)
|
||||
myEmpty2(Standard_False)
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -79,7 +78,6 @@ myFuzzyValue(0.)
|
||||
BOPAlgo_ArgumentAnalyzer::~BOPAlgo_ArgumentAnalyzer()
|
||||
{
|
||||
myResult.Clear();
|
||||
myToleranceMap.Clear();
|
||||
}
|
||||
|
||||
// ================================================================================
|
||||
@@ -167,26 +165,21 @@ void BOPAlgo_ArgumentAnalyzer::Perform()
|
||||
//
|
||||
UserBreak();
|
||||
//
|
||||
// 2. Update Tolerances according to myFuzzyValue
|
||||
UpdateTolerances();
|
||||
//
|
||||
UserBreak();
|
||||
//
|
||||
// 3. Test types
|
||||
// 2. Test types
|
||||
if(myArgumentTypeMode) {
|
||||
TestTypes();
|
||||
}
|
||||
//
|
||||
UserBreak();
|
||||
//
|
||||
// 4. Test self-interference
|
||||
// 3. Test self-interference
|
||||
if(mySelfInterMode) {
|
||||
TestSelfInterferences();
|
||||
}
|
||||
//
|
||||
UserBreak();
|
||||
//
|
||||
// 5. Test small edges
|
||||
// 4. Test small edges
|
||||
if(mySmallEdgeMode) {
|
||||
if(!(!myResult.IsEmpty() && myStopOnFirst))
|
||||
TestSmallEdge();
|
||||
@@ -194,7 +187,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform()
|
||||
//
|
||||
UserBreak();
|
||||
//
|
||||
// 6. Test possibility to rebuild faces
|
||||
// 5. Test possibility to rebuild faces
|
||||
if(myRebuildFaceMode) {
|
||||
if(!(!myResult.IsEmpty() && myStopOnFirst))
|
||||
TestRebuildFace();
|
||||
@@ -202,7 +195,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform()
|
||||
//
|
||||
UserBreak();
|
||||
//
|
||||
// 7. Test tangent
|
||||
// 6. Test tangent
|
||||
if(myTangentMode) {
|
||||
if(!(!myResult.IsEmpty() && myStopOnFirst))
|
||||
TestTangent();
|
||||
@@ -210,7 +203,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform()
|
||||
//
|
||||
UserBreak();
|
||||
//
|
||||
// 8. Test merge vertices
|
||||
// 7. Test merge vertices
|
||||
if(myMergeVertexMode) {
|
||||
if(!(!myResult.IsEmpty() && myStopOnFirst))
|
||||
TestMergeVertex();
|
||||
@@ -218,7 +211,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform()
|
||||
//
|
||||
UserBreak();
|
||||
//
|
||||
// 9. Test merge edges
|
||||
// 8. Test merge edges
|
||||
if(myMergeEdgeMode) {
|
||||
if(!(!myResult.IsEmpty() && myStopOnFirst))
|
||||
TestMergeEdge();
|
||||
@@ -226,7 +219,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform()
|
||||
//
|
||||
UserBreak();
|
||||
//
|
||||
// 10. Test shapes continuity
|
||||
// 9. Test shapes continuity
|
||||
if(myContinuityMode) {
|
||||
if(!(!myResult.IsEmpty() && myStopOnFirst))
|
||||
TestContinuity();
|
||||
@@ -234,7 +227,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform()
|
||||
//
|
||||
UserBreak();
|
||||
//
|
||||
// 11. Test validity of the curves on the surfaces
|
||||
// 10. Test validity of the curves on the surfaces
|
||||
if(myCurveOnSurfaceMode) {
|
||||
if(!(!myResult.IsEmpty() && myStopOnFirst))
|
||||
TestCurveOnSurface();
|
||||
@@ -245,8 +238,6 @@ void BOPAlgo_ArgumentAnalyzer::Perform()
|
||||
aResult.SetCheckStatus(BOPAlgo_CheckUnknown);
|
||||
myResult.Append(aResult);
|
||||
}
|
||||
//
|
||||
SetDefaultTolerances();
|
||||
}
|
||||
|
||||
// ================================================================================
|
||||
@@ -369,6 +360,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
|
||||
aChecker.SetArguments(anArgs);
|
||||
aChecker.SetNonDestructive(Standard_True);
|
||||
aChecker.SetRunParallel(myRunParallel);
|
||||
aChecker.SetFuzzyValue(myFuzzyValue);
|
||||
aChecker.SetProgressIndicator(myProgressIndicator);
|
||||
//
|
||||
aChecker.Perform();
|
||||
@@ -913,122 +905,3 @@ void BOPAlgo_ArgumentAnalyzer::TestCurveOnSurface()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================================
|
||||
// function: UpdateTolerances
|
||||
// purpose:
|
||||
// ================================================================================
|
||||
void BOPAlgo_ArgumentAnalyzer::UpdateTolerances()
|
||||
{
|
||||
if (myFuzzyValue == 0.) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BOPCol_MapOfShape aMapShapes;
|
||||
//
|
||||
if (!myShape1.IsNull()) {
|
||||
BOPTools::MapShapes(myShape1, aMapShapes);
|
||||
}
|
||||
if (!myShape2.IsNull()) {
|
||||
BOPTools::MapShapes(myShape2, aMapShapes);
|
||||
}
|
||||
//
|
||||
if (aMapShapes.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Real aTol, aFuzz;
|
||||
TopAbs_ShapeEnum aType;
|
||||
BOPCol_MapIteratorOfMapOfShape aIt;
|
||||
//
|
||||
aFuzz = myFuzzyValue / 2.;
|
||||
aIt.Initialize(aMapShapes);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Value();
|
||||
aType = aS.ShapeType();
|
||||
//
|
||||
switch (aType) {
|
||||
case TopAbs_VERTEX: {
|
||||
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&aS;
|
||||
const Handle(BRep_TVertex)& TV =
|
||||
*((Handle(BRep_TVertex)*)&aV.TShape());
|
||||
aTol = TV->Tolerance();
|
||||
myToleranceMap.Bind(aS, aTol);
|
||||
TV->Tolerance(aTol + aFuzz);
|
||||
break;
|
||||
}
|
||||
case TopAbs_EDGE: {
|
||||
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aS;
|
||||
const Handle(BRep_TEdge)& TE =
|
||||
*((Handle(BRep_TEdge)*)&aE.TShape());
|
||||
aTol = TE->Tolerance();
|
||||
myToleranceMap.Bind(aS, aTol);
|
||||
TE->Tolerance(aTol + aFuzz);
|
||||
break;
|
||||
}
|
||||
case TopAbs_FACE: {
|
||||
const TopoDS_Face& aF = *(TopoDS_Face*)&aS;
|
||||
const Handle(BRep_TFace)& TF =
|
||||
*((Handle(BRep_TFace)*)&aF.TShape());
|
||||
aTol = TF->Tolerance();
|
||||
myToleranceMap.Bind(aS, aTol);
|
||||
TF->Tolerance(aTol + aFuzz);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
} // switch (aType) {
|
||||
} // for (; aIt.More(); aIt.Next()) {
|
||||
}
|
||||
|
||||
// ================================================================================
|
||||
// function: SetDefaultTolerances
|
||||
// purpose:
|
||||
// ================================================================================
|
||||
void BOPAlgo_ArgumentAnalyzer::SetDefaultTolerances()
|
||||
{
|
||||
if (myFuzzyValue == 0.) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (myToleranceMap.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Real aTol;
|
||||
TopAbs_ShapeEnum aType;
|
||||
BOPCol_DataMapIteratorOfDataMapOfShapeReal aIt;
|
||||
//
|
||||
aIt.Initialize(myToleranceMap);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Key();
|
||||
aTol = aIt.Value();
|
||||
aType = aS.ShapeType();
|
||||
//
|
||||
switch (aType) {
|
||||
case TopAbs_VERTEX: {
|
||||
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&aS;
|
||||
const Handle(BRep_TVertex)& TV =
|
||||
*((Handle(BRep_TVertex)*)&aV.TShape());
|
||||
TV->Tolerance(aTol);
|
||||
break;
|
||||
}
|
||||
case TopAbs_EDGE: {
|
||||
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aS;
|
||||
const Handle(BRep_TEdge)& TE =
|
||||
*((Handle(BRep_TEdge)*)&aE.TShape());
|
||||
TE->Tolerance(aTol);
|
||||
break;
|
||||
}
|
||||
case TopAbs_FACE: {
|
||||
const TopoDS_Face& aF = *(TopoDS_Face*)&aS;
|
||||
const Handle(BRep_TFace)& TF =
|
||||
*((Handle(BRep_TFace)*)&aF.TShape());
|
||||
TF->Tolerance(aTol);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
} // switch (aType) {
|
||||
} // for (; aIt.More(); aIt.Next()) {
|
||||
}
|
||||
|
@@ -106,14 +106,6 @@ Standard_EXPORT virtual ~BOPAlgo_ArgumentAnalyzer();
|
||||
//! returns a result of test
|
||||
Standard_EXPORT const BOPAlgo_ListOfCheckResult& GetCheckResult() const;
|
||||
|
||||
//! Sets the additional tolerance
|
||||
void SetFuzzyValue (const Standard_Real theFuzz);
|
||||
|
||||
//! Returns the additional tolerance
|
||||
Standard_Real FuzzyValue() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@@ -141,19 +133,10 @@ protected:
|
||||
|
||||
Standard_EXPORT void TestCurveOnSurface();
|
||||
|
||||
//! Updates the shapes tolerance values.
|
||||
Standard_EXPORT void UpdateTolerances();
|
||||
|
||||
//! Reverts the tolerance values for all entities to default values.
|
||||
Standard_EXPORT void SetDefaultTolerances();
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TopoDS_Shape myShape1;
|
||||
TopoDS_Shape myShape2;
|
||||
Standard_Boolean myStopOnFirst;
|
||||
@@ -170,9 +153,6 @@ private:
|
||||
Standard_Boolean myEmpty1;
|
||||
Standard_Boolean myEmpty2;
|
||||
BOPAlgo_ListOfCheckResult myResult;
|
||||
Standard_Real myFuzzyValue;
|
||||
BOPCol_DataMapOfShapeReal myToleranceMap;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -180,7 +160,4 @@ private:
|
||||
#include <BOPAlgo_ArgumentAnalyzer.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BOPAlgo_ArgumentAnalyzer_HeaderFile
|
||||
|
@@ -61,22 +61,6 @@ inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::CurveOnSurfaceMode()
|
||||
{
|
||||
return myCurveOnSurfaceMode;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetFuzzyValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void BOPAlgo_ArgumentAnalyzer::SetFuzzyValue(const Standard_Real theFuzz)
|
||||
{
|
||||
myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FuzzyValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Real BOPAlgo_ArgumentAnalyzer::FuzzyValue() const
|
||||
{
|
||||
return myFuzzyValue;
|
||||
}
|
||||
// inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::MergeFaceMode()
|
||||
// {
|
||||
// return myMergeFaceMode;
|
||||
|
@@ -394,6 +394,8 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
|
||||
myPaveFiller=(BOPAlgo_PaveFiller*)&theFiller;
|
||||
myDS=myPaveFiller->PDS();
|
||||
myContext=myPaveFiller->Context();
|
||||
myFuzzyValue = myPaveFiller->FuzzyValue();
|
||||
myNonDestructive = myPaveFiller->NonDestructive();
|
||||
//
|
||||
// 1. CheckData
|
||||
CheckData();
|
||||
|
@@ -51,7 +51,6 @@ BOPAlgo_Builder::BOPAlgo_Builder()
|
||||
myShapesSD(100, myAllocator),
|
||||
mySplits(100, myAllocator),
|
||||
myOrigins(100, myAllocator),
|
||||
myFuzzyValue(0.),
|
||||
myNonDestructive(Standard_False)
|
||||
{
|
||||
}
|
||||
@@ -72,7 +71,6 @@ BOPAlgo_Builder::BOPAlgo_Builder
|
||||
myShapesSD(100, myAllocator),
|
||||
mySplits(100, myAllocator),
|
||||
myOrigins(100, myAllocator),
|
||||
myFuzzyValue(0.),
|
||||
myNonDestructive(Standard_False)
|
||||
{
|
||||
}
|
||||
@@ -186,22 +184,6 @@ BOPDS_PDS BOPAlgo_Builder::PDS()
|
||||
return myDS;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetFuzzyValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_Builder::SetFuzzyValue(const Standard_Real theFuzz)
|
||||
{
|
||||
myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FuzzyValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real BOPAlgo_Builder::FuzzyValue() const
|
||||
{
|
||||
return myFuzzyValue;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetNonDestructive
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
@@ -329,6 +311,8 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
|
||||
myPaveFiller=(BOPAlgo_PaveFiller*)&theFiller;
|
||||
myDS=myPaveFiller->PDS();
|
||||
myContext=myPaveFiller->Context();
|
||||
myFuzzyValue = myPaveFiller->FuzzyValue();
|
||||
myNonDestructive = myPaveFiller->NonDestructive();
|
||||
//
|
||||
// 1. CheckData
|
||||
CheckData();
|
||||
|
@@ -93,12 +93,7 @@ Standard_EXPORT virtual ~BOPAlgo_Builder();
|
||||
//! Returns mySplits.
|
||||
Standard_EXPORT const BOPCol_DataMapOfShapeListOfShape& Splits() const;
|
||||
|
||||
//! Sets the additional tolerance
|
||||
Standard_EXPORT void SetFuzzyValue (const Standard_Real theFuzz);
|
||||
|
||||
//! 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.
|
||||
@@ -115,7 +110,6 @@ Standard_EXPORT virtual ~BOPAlgo_Builder();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! Prepare information for history support
|
||||
Standard_EXPORT virtual void PrepareHistory() Standard_OVERRIDE;
|
||||
|
||||
@@ -172,21 +166,11 @@ protected:
|
||||
BOPCol_DataMapOfShapeShape myShapesSD;
|
||||
BOPCol_DataMapOfShapeListOfShape mySplits;
|
||||
BOPCol_DataMapOfShapeShape myOrigins;
|
||||
Standard_Real myFuzzyValue;
|
||||
Standard_Boolean myNonDestructive;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BOPAlgo_Builder_HeaderFile
|
||||
|
@@ -56,13 +56,6 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
static
|
||||
Standard_Boolean HasPaveBlocksOnIn(const BOPDS_FaceInfo& aFI1,
|
||||
@@ -128,7 +121,7 @@ class BOPAlgo_PairOfShapeBoolean : public BOPAlgo_Algo {
|
||||
//
|
||||
const TopoDS_Face& aFj=*((TopoDS_Face*)&myShape1);
|
||||
const TopoDS_Face& aFk=*((TopoDS_Face*)&myShape2);
|
||||
myFlag=BOPTools_AlgoTools::AreFacesSameDomain(aFj, aFk, myContext);
|
||||
myFlag=BOPTools_AlgoTools::AreFacesSameDomain(aFj, aFk, myContext, myFuzzyValue);
|
||||
}
|
||||
//
|
||||
protected:
|
||||
@@ -214,7 +207,7 @@ class BOPAlgo_VFI : public BOPAlgo_Algo {
|
||||
Standard_Real aT1, aT2, dummy;
|
||||
//
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
myFlag = myContext->ComputeVF(myV, myF, aT1, aT2, dummy);
|
||||
myFlag = myContext->ComputeVF(myV, myF, aT1, aT2, dummy, myFuzzyValue);
|
||||
}
|
||||
//
|
||||
protected:
|
||||
@@ -625,6 +618,7 @@ void BOPAlgo_Builder::FillSameDomainFaces()
|
||||
BOPAlgo_PairOfShapeBoolean& aPSB=aVPSB.Append1();
|
||||
aPSB.Shape1()=aFj;
|
||||
aPSB.Shape2()=aFk;
|
||||
aPSB.SetFuzzyValue(myFuzzyValue);
|
||||
aPSB.SetProgressIndicator(myProgressIndicator);
|
||||
}
|
||||
}
|
||||
@@ -754,6 +748,7 @@ void BOPAlgo_Builder::FillImagesFaces1()
|
||||
BOPAlgo_VFI& aVFI=aVVFI.Append1();
|
||||
aVFI.SetVertex(aVx);
|
||||
aVFI.SetFace(aFy);
|
||||
aVFI.SetFuzzyValue(myFuzzyValue);
|
||||
aVFI.SetProgressIndicator(myProgressIndicator);
|
||||
}
|
||||
}
|
||||
|
@@ -82,8 +82,7 @@ void BOPAlgo_CheckerSI::Init()
|
||||
// 1. myDS
|
||||
myDS=new BOPDS_DS(myAllocator);
|
||||
myDS->SetArguments(myArguments);
|
||||
myDS->SetFuzzyValue(myFuzzyValue);
|
||||
myDS->Init();
|
||||
myDS->Init(myFuzzyValue);
|
||||
//
|
||||
// 2.myIterator
|
||||
BOPDS_PIteratorSI theIterSI=new BOPDS_IteratorSI(myAllocator);
|
||||
@@ -256,7 +255,7 @@ void BOPAlgo_CheckerSI::PostTreat()
|
||||
const TopoDS_Face& aF1=*((TopoDS_Face*)&myDS->Shape(n1));
|
||||
const TopoDS_Face& aF2=*((TopoDS_Face*)&myDS->Shape(n2));
|
||||
bFlag=BOPTools_AlgoTools::AreFacesSameDomain
|
||||
(aF1, aF2, myContext);
|
||||
(aF1, aF2, myContext, myFuzzyValue);
|
||||
if (bFlag) {
|
||||
++iFound;
|
||||
}
|
||||
|
@@ -37,8 +37,7 @@
|
||||
//=======================================================================
|
||||
BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
|
||||
:
|
||||
BOPAlgo_Algo(),
|
||||
myFuzzyValue(0.)
|
||||
BOPAlgo_Algo()
|
||||
{
|
||||
myDS=NULL;
|
||||
myIterator=NULL;
|
||||
@@ -52,8 +51,7 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
|
||||
BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
|
||||
(const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
:
|
||||
BOPAlgo_Algo(theAllocator),
|
||||
myFuzzyValue(0.)
|
||||
BOPAlgo_Algo(theAllocator)
|
||||
{
|
||||
myDS=NULL;
|
||||
myIterator=NULL;
|
||||
@@ -165,22 +163,6 @@ const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const
|
||||
return myArguments;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetFuzzyValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::SetFuzzyValue(const Standard_Real theFuzz)
|
||||
{
|
||||
myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FuzzyValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real BOPAlgo_PaveFiller::FuzzyValue() const
|
||||
{
|
||||
return myFuzzyValue;
|
||||
}
|
||||
//=======================================================================
|
||||
// function: Init
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
@@ -199,8 +181,7 @@ void BOPAlgo_PaveFiller::Init()
|
||||
// 1.myDS
|
||||
myDS=new BOPDS_DS(myAllocator);
|
||||
myDS->SetArguments(myArguments);
|
||||
myDS->SetFuzzyValue(myFuzzyValue);
|
||||
myDS->Init();
|
||||
myDS->Init(myFuzzyValue);
|
||||
//
|
||||
// 2.myIterator
|
||||
myIterator=new BOPDS_Iterator(myAllocator);
|
||||
@@ -232,8 +213,6 @@ void BOPAlgo_PaveFiller::Perform()
|
||||
catch (Standard_Failure) {
|
||||
myErrorStatus=11;
|
||||
}
|
||||
//
|
||||
myDS->SetDefaultTolerances();
|
||||
}
|
||||
//=======================================================================
|
||||
// function: PerformInternal
|
||||
|
@@ -45,6 +45,7 @@
|
||||
#include <IntSurf_ListOfPntOn2S.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
|
||||
#include <BOPDS_MapOfPaveBlock.hxx>
|
||||
#include <BOPDS_VectorOfCurve.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeInteger.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
class IntTools_Context;
|
||||
@@ -98,14 +99,7 @@ public:
|
||||
|
||||
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
|
||||
|
||||
//! Sets the additional tolerance
|
||||
Standard_EXPORT void SetFuzzyValue (const Standard_Real theFuzz);
|
||||
|
||||
//! Returns the additional tolerance
|
||||
Standard_EXPORT Standard_Real FuzzyValue() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@@ -155,13 +149,17 @@ protected:
|
||||
|
||||
Standard_EXPORT void TreatVerticesEE();
|
||||
|
||||
Standard_EXPORT void MakeSDVerticesFF(const BOPCol_DataMapOfIntegerListOfInteger& aDMVLV,
|
||||
BOPCol_DataMapOfIntegerInteger& theDMNewSD);
|
||||
|
||||
Standard_EXPORT void MakeSplitEdges();
|
||||
|
||||
Standard_EXPORT void MakeBlocks();
|
||||
|
||||
Standard_EXPORT void MakePCurves();
|
||||
|
||||
Standard_EXPORT void MakeSDVertices(const BOPCol_ListOfInteger& theVertIndices);
|
||||
Standard_EXPORT Standard_Integer MakeSDVertices(const BOPCol_ListOfInteger& theVertIndices,
|
||||
const Standard_Boolean theAddInterfs = 1);
|
||||
|
||||
Standard_EXPORT void ProcessDE();
|
||||
|
||||
@@ -181,8 +179,18 @@ protected:
|
||||
|
||||
|
||||
//! Checks and puts paves from <theMVOn> on the curve <theNC>.
|
||||
Standard_EXPORT void PutPavesOnCurve (const BOPCol_MapOfInteger& theMVOn, const Standard_Real theTolR3D, BOPDS_Curve& theNC, const Standard_Integer nF1, const Standard_Integer nF2, const BOPCol_MapOfInteger& theMI, const BOPCol_MapOfInteger& theMVEF, BOPCol_DataMapOfIntegerReal& theMVTol);
|
||||
|
||||
Standard_EXPORT void PutPavesOnCurve (const BOPCol_MapOfInteger& theMVOn,
|
||||
const Standard_Real theTolR3D,
|
||||
BOPDS_Curve& theNC,
|
||||
const Standard_Integer nF1,
|
||||
const Standard_Integer nF2,
|
||||
const BOPCol_MapOfInteger& theMI,
|
||||
const BOPCol_MapOfInteger& theMVEF,
|
||||
BOPCol_DataMapOfIntegerReal& theMVTol,
|
||||
BOPCol_DataMapOfIntegerListOfInteger& aDMVLV);
|
||||
|
||||
Standard_EXPORT void FilterPavesOnCurves(const BOPDS_VectorOfCurve& theVNC,
|
||||
const Standard_Real theTolR3D);
|
||||
|
||||
//! Depending on the parameter aType it checks whether
|
||||
//! the vertex nV was created in EE or EF intersections.
|
||||
@@ -199,6 +207,7 @@ protected:
|
||||
Standard_EXPORT Standard_Boolean IsExistingPaveBlock
|
||||
(const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC,
|
||||
const Standard_Real theTolR3D, const BOPDS_IndexedMapOfPaveBlock& theMPB,
|
||||
const BOPDS_MapOfPaveBlock& theMPBCommon,
|
||||
Handle(BOPDS_PaveBlock)& thePBOut, Standard_Real& theTolNew);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsExistingPaveBlock (const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC, const BOPCol_ListOfInteger& theLSE);
|
||||
@@ -208,7 +217,7 @@ protected:
|
||||
Standard_EXPORT Standard_Integer PostTreatFF (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
|
||||
BOPCol_DataMapOfShapeInteger& theMVI,
|
||||
BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDMExEdges,
|
||||
BOPCol_DataMapOfIntegerInteger& theDMI,
|
||||
BOPCol_DataMapOfIntegerInteger& theDMNewSD,
|
||||
const BOPCol_IndexedMapOfShape& theMicroEdges,
|
||||
const BOPCol_BaseAllocator& theAllocator);
|
||||
|
||||
@@ -222,11 +231,21 @@ protected:
|
||||
|
||||
|
||||
//! Checks and puts paves created in EF intersections on the curve <theNC>.
|
||||
Standard_EXPORT void PutEFPavesOnCurve (BOPDS_Curve& theNC, const BOPCol_MapOfInteger& theMI, const BOPCol_MapOfInteger& theMVEF, BOPCol_DataMapOfIntegerReal& theMVTol);
|
||||
Standard_EXPORT void PutEFPavesOnCurve (BOPDS_Curve& theNC,
|
||||
const BOPCol_MapOfInteger& theMI,
|
||||
const BOPCol_MapOfInteger& theMVEF,
|
||||
BOPCol_DataMapOfIntegerReal& theMVTol,
|
||||
BOPCol_DataMapOfIntegerListOfInteger& aDMVLV);
|
||||
|
||||
|
||||
//! Puts stick paves on the curve <theNC>
|
||||
Standard_EXPORT void PutStickPavesOnCurve (const TopoDS_Face& aF1, const TopoDS_Face& aF2, const BOPCol_MapOfInteger& theMI, BOPDS_Curve& theNC, const BOPCol_MapOfInteger& theMVStick, BOPCol_DataMapOfIntegerReal& theMVTol);
|
||||
Standard_EXPORT void PutStickPavesOnCurve (const TopoDS_Face& aF1,
|
||||
const TopoDS_Face& aF2,
|
||||
const BOPCol_MapOfInteger& theMI,
|
||||
BOPDS_Curve& theNC,
|
||||
const BOPCol_MapOfInteger& theMVStick,
|
||||
BOPCol_DataMapOfIntegerReal& theMVTol,
|
||||
BOPCol_DataMapOfIntegerListOfInteger& aDMVLV);
|
||||
|
||||
|
||||
//! Collects indices of vertices created in all intersections between
|
||||
@@ -252,7 +271,13 @@ protected:
|
||||
//! extended tolerance:
|
||||
//! 0 - do not perform the check;
|
||||
//! other - perform the check (aType goes to ExtendedTolerance).
|
||||
Standard_EXPORT void PutPaveOnCurve (const Standard_Integer nV, const Standard_Real theTolR3D, BOPDS_Curve& theNC, const BOPCol_MapOfInteger& theMI, BOPCol_DataMapOfIntegerReal& theMVTol, const Standard_Integer aType = 0);
|
||||
Standard_EXPORT void PutPaveOnCurve (const Standard_Integer nV,
|
||||
const Standard_Real theTolR3D,
|
||||
const BOPDS_Curve& theNC,
|
||||
const BOPCol_MapOfInteger& theMI,
|
||||
BOPCol_DataMapOfIntegerReal& theMVTol,
|
||||
BOPCol_DataMapOfIntegerListOfInteger& aDMVLV,
|
||||
const Standard_Integer aType = 0);
|
||||
|
||||
|
||||
//! Adds the existing edges from the map <theMPBOnIn> which interfere
|
||||
@@ -309,8 +334,8 @@ protected:
|
||||
|
||||
|
||||
//! Updates pave blocks which have the paves with indices contained
|
||||
//! in the map <theDMI>.
|
||||
Standard_EXPORT void UpdatePaveBlocks (const BOPCol_DataMapOfIntegerInteger& theDMI);
|
||||
//! in the map <aDMNewSD>.
|
||||
Standard_EXPORT void UpdatePaveBlocks(const BOPCol_DataMapOfIntegerInteger& aDMNewSD);
|
||||
|
||||
//! Updates tolerance vertex nV due to V/E interference.
|
||||
//! It always creates new vertex if nV is from arguments.
|
||||
@@ -368,23 +393,12 @@ protected:
|
||||
BOPDS_PIterator myIterator;
|
||||
Handle(IntTools_Context) myContext;
|
||||
BOPAlgo_SectionAttribute mySectionAttribute;
|
||||
Standard_Real myFuzzyValue;
|
||||
Standard_Boolean myNonDestructive;
|
||||
Standard_Boolean myIsPrimary;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BOPAlgo_PaveFiller_HeaderFile
|
||||
|
@@ -76,7 +76,7 @@ void BOPAlgo_PaveFiller::PerformVV()
|
||||
const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(n1)));
|
||||
const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(n2)));
|
||||
//
|
||||
iFlag=BOPTools_AlgoTools::ComputeVV(aV1, aV2);
|
||||
iFlag=BOPTools_AlgoTools::ComputeVV(aV1, aV2, myFuzzyValue);
|
||||
if (!iFlag) {
|
||||
BOPAlgo_Tools::FillMap(n1, n2, aMILI, aAllocator);
|
||||
}
|
||||
@@ -111,59 +111,75 @@ void BOPAlgo_PaveFiller::PerformVV()
|
||||
// function: PerformVV
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::MakeSDVertices(const BOPCol_ListOfInteger& theVertIndices)
|
||||
Standard_Integer BOPAlgo_PaveFiller::MakeSDVertices
|
||||
(const BOPCol_ListOfInteger& theVertIndices,
|
||||
const Standard_Boolean theAddInterfs)
|
||||
{
|
||||
TopoDS_Vertex aVSD, aVn;
|
||||
Standard_Integer nSD = -1;
|
||||
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));
|
||||
Standard_Integer nX = aItLI.Value(), nSD1;
|
||||
if (myDS->HasShapeSD(nX, nSD1)) {
|
||||
const TopoDS_Shape& aVSD1 = myDS->Shape(nSD1);
|
||||
if (nSD == -1) {
|
||||
aVSD = TopoDS::Vertex(aVSD1);
|
||||
nSD = nSD1;
|
||||
}
|
||||
else {
|
||||
aLV.Append(aVSD1);
|
||||
}
|
||||
}
|
||||
const TopoDS_Shape& aV = myDS->Shape(nX);
|
||||
aLV.Append(aV);
|
||||
}
|
||||
BOPTools_AlgoTools::MakeVertex(aLV, aVn);
|
||||
if (!aVSD.IsNull()) {
|
||||
Standard_Integer nV;
|
||||
if (nSD != -1) {
|
||||
// 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));
|
||||
aVn = aVSD;
|
||||
nV = nSD;
|
||||
}
|
||||
//
|
||||
// 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);
|
||||
else {
|
||||
// Append new vertex to the DS
|
||||
BOPDS_ShapeInfo aSIn;
|
||||
aSIn.SetShapeType(TopAbs_VERTEX);
|
||||
aSIn.SetShape(aVn);
|
||||
nV = myDS->Append(aSIn);
|
||||
}
|
||||
BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nV);
|
||||
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());
|
||||
if (theAddInterfs)
|
||||
aVVs.SetIncrement(theVertIndices.Extent());
|
||||
//
|
||||
aItLI.Initialize(theVertIndices);
|
||||
for (; aItLI.More(); aItLI.Next()) {
|
||||
Standard_Integer n1 = aItLI.Value();
|
||||
myDS->AddShapeSD(n1, n);
|
||||
myDS->AddShapeSD(n1, nV);
|
||||
//
|
||||
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);
|
||||
if (theAddInterfs) {
|
||||
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(nV);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nV;
|
||||
}
|
||||
|
@@ -51,26 +51,22 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
|
||||
|
||||
BOPAlgo_VertexEdge() :
|
||||
BOPAlgo_Algo(),
|
||||
myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.), myTolVNew(-1.) {
|
||||
myIV(-1), myIE(-1), myFlag(-1), myT(-1.), myTolVNew(-1.) {
|
||||
};
|
||||
//
|
||||
virtual ~BOPAlgo_VertexEdge(){
|
||||
};
|
||||
//
|
||||
void SetIndices(const Standard_Integer nV,
|
||||
const Standard_Integer nE,
|
||||
const Standard_Integer nVx) {
|
||||
const Standard_Integer nE) {
|
||||
myIV=nV;
|
||||
myIE=nE;
|
||||
myIVx=nVx;
|
||||
}
|
||||
//
|
||||
void Indices(Standard_Integer& nV,
|
||||
Standard_Integer& nE,
|
||||
Standard_Integer& nVx) const {
|
||||
Standard_Integer& nE) const {
|
||||
nV=myIV;
|
||||
nE=myIE;
|
||||
nVx=myIVx;
|
||||
}
|
||||
//
|
||||
void SetVertex(const TopoDS_Vertex& aV) {
|
||||
@@ -111,13 +107,12 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew);
|
||||
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew, myFuzzyValue);
|
||||
};
|
||||
//
|
||||
protected:
|
||||
Standard_Integer myIV;
|
||||
Standard_Integer myIE;
|
||||
Standard_Integer myIVx;
|
||||
Standard_Integer myFlag;
|
||||
Standard_Real myT;
|
||||
Standard_Real myTolVNew;
|
||||
@@ -213,9 +208,10 @@ void BOPAlgo_PaveFiller::PerformVE()
|
||||
//
|
||||
BOPAlgo_VertexEdge& aVESolver=aVVE.Append1();
|
||||
//
|
||||
aVESolver.SetIndices(nV, nE, nVx);
|
||||
aVESolver.SetIndices(nV, nE);
|
||||
aVESolver.SetVertex(aV);
|
||||
aVESolver.SetEdge(aE);
|
||||
aVESolver.SetFuzzyValue(myFuzzyValue);
|
||||
aVESolver.SetProgressIndicator(myProgressIndicator);
|
||||
//
|
||||
}// for (; myIterator->More(); myIterator->Next()) {
|
||||
@@ -229,7 +225,7 @@ void BOPAlgo_PaveFiller::PerformVE()
|
||||
const BOPAlgo_VertexEdge& aVESolver=aVVE(k);
|
||||
iFlag=aVESolver.Flag();
|
||||
if (!iFlag) {
|
||||
aVESolver.Indices(nV, nE, nVx);
|
||||
aVESolver.Indices(nV, nE);
|
||||
aT=aVESolver.Parameter();
|
||||
//
|
||||
// check if vertex hits beyond shrunk range, in such case create V-V interf
|
||||
|
@@ -45,7 +45,6 @@
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <IntTools_CommonPrt.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
@@ -99,6 +98,10 @@ class BOPAlgo_EdgeEdge :
|
||||
return myPB2;
|
||||
}
|
||||
//
|
||||
void SetFuzzyValue(const Standard_Real theFuzz) {
|
||||
IntTools_EdgeEdge::SetFuzzyValue(theFuzz);
|
||||
}
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
IntTools_EdgeEdge::Perform();
|
||||
@@ -126,10 +129,23 @@ typedef BOPCol_Cnt
|
||||
//class : BOPAlgo_TNV
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class BOPAlgo_TNV;
|
||||
typedef BOPCol_NCVector
|
||||
<BOPAlgo_TNV> BOPAlgo_VectorOfTNV;
|
||||
//
|
||||
typedef BOPCol_Functor
|
||||
<BOPAlgo_TNV,
|
||||
BOPAlgo_VectorOfTNV> BOPAlgo_TNVFunctor;
|
||||
//
|
||||
typedef BOPCol_Cnt
|
||||
<BOPAlgo_TNVFunctor,
|
||||
BOPAlgo_VectorOfTNV> BOPAlgo_TNVCnt;
|
||||
//=======================================================================
|
||||
class BOPAlgo_TNV : public BOPCol_BoxBndTreeSelector{
|
||||
public:
|
||||
BOPAlgo_TNV()
|
||||
: BOPCol_BoxBndTreeSelector(), myTree(NULL) {
|
||||
: BOPCol_BoxBndTreeSelector(),
|
||||
myTol (0.), myFuzzyValue(0.), myTree(NULL), myVecTNV(NULL) {
|
||||
};
|
||||
//
|
||||
~BOPAlgo_TNV(){
|
||||
@@ -137,6 +153,7 @@ class BOPAlgo_TNV : public BOPCol_BoxBndTreeSelector{
|
||||
//
|
||||
void SetVertex(const TopoDS_Vertex& aV) {
|
||||
myV=aV;
|
||||
myPnt = BRep_Tool::Pnt(myV);
|
||||
}
|
||||
//
|
||||
const TopoDS_Vertex& Vertex()const {
|
||||
@@ -147,26 +164,50 @@ class BOPAlgo_TNV : public BOPCol_BoxBndTreeSelector{
|
||||
myTree=&aTree;
|
||||
}
|
||||
//
|
||||
void SetTolerance(const Standard_Real theTol) {
|
||||
myTol = theTol;
|
||||
}
|
||||
//
|
||||
Standard_Real Tolerance() const {
|
||||
return myTol;
|
||||
}
|
||||
//
|
||||
const gp_Pnt& Pnt() const {
|
||||
return myPnt;
|
||||
}
|
||||
//
|
||||
void SetFuzzyValue(const Standard_Real theFuzzyValue) {
|
||||
myFuzzyValue = theFuzzyValue;
|
||||
}
|
||||
//
|
||||
void SetVectorOfTNV(const BOPAlgo_VectorOfTNV& theVec) {
|
||||
myVecTNV = &theVec;
|
||||
}
|
||||
//
|
||||
virtual Standard_Boolean Accept(const Standard_Integer& theIndex)
|
||||
{
|
||||
const BOPAlgo_TNV& aTNV = myVecTNV->Value(theIndex - 1);
|
||||
Standard_Real aTolSum2 = myTol + aTNV.Tolerance() + myFuzzyValue;
|
||||
aTolSum2 *= aTolSum2;
|
||||
Standard_Real aD2 = myPnt.SquareDistance(aTNV.Pnt());
|
||||
if (aD2 < aTolSum2)
|
||||
return BOPCol_BoxBndTreeSelector::Accept(theIndex);
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
void Perform() {
|
||||
myTree->Select(*this);
|
||||
}
|
||||
//
|
||||
protected:
|
||||
Standard_Real myTol;
|
||||
Standard_Real myFuzzyValue;
|
||||
gp_Pnt myPnt;
|
||||
TopoDS_Vertex myV;
|
||||
BOPCol_BoxBndTree *myTree;
|
||||
const BOPAlgo_VectorOfTNV *myVecTNV;
|
||||
};
|
||||
//
|
||||
//=======================================================================
|
||||
typedef BOPCol_NCVector
|
||||
<BOPAlgo_TNV> BOPAlgo_VectorOfTNV;
|
||||
//
|
||||
typedef BOPCol_Functor
|
||||
<BOPAlgo_TNV,
|
||||
BOPAlgo_VectorOfTNV> BOPAlgo_TNVFunctor;
|
||||
//
|
||||
typedef BOPCol_Cnt
|
||||
<BOPAlgo_TNVFunctor,
|
||||
BOPAlgo_VectorOfTNV> BOPAlgo_TNVCnt;
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_PVE
|
||||
@@ -233,9 +274,13 @@ class BOPAlgo_PVE {
|
||||
return myContext;
|
||||
}
|
||||
//
|
||||
void SetFuzzyValue(const Standard_Real theValue) {
|
||||
myFuzzyValue = theValue;
|
||||
}
|
||||
//
|
||||
void Perform() {
|
||||
Standard_Real dummy;
|
||||
myFlag = myContext->ComputeVE(myV, myE, myT, dummy);
|
||||
myFlag = myContext->ComputeVE(myV, myE, myT, dummy, myFuzzyValue);
|
||||
};
|
||||
//
|
||||
protected:
|
||||
@@ -243,6 +288,7 @@ class BOPAlgo_PVE {
|
||||
Standard_Integer myIE;
|
||||
Standard_Integer myFlag;
|
||||
Standard_Real myT;
|
||||
Standard_Real myFuzzyValue;
|
||||
TopoDS_Vertex myV;
|
||||
TopoDS_Edge myE;
|
||||
Handle(BOPDS_PaveBlock) myPB;
|
||||
@@ -362,6 +408,7 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
//
|
||||
anEdgeEdge.SetEdge1(aE1, aT11, aT12);
|
||||
anEdgeEdge.SetEdge2(aE2, aT21, aT22);
|
||||
anEdgeEdge.SetFuzzyValue(myFuzzyValue);
|
||||
anEdgeEdge.SetProgressIndicator(myProgressIndicator);
|
||||
}//for (; aIt2.More(); aIt2.Next()) {
|
||||
}//for (; aIt1.More(); aIt1.Next()) {
|
||||
@@ -610,7 +657,7 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
}
|
||||
else {
|
||||
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
|
||||
myDS->UpdateCommonBlock(aCB);
|
||||
myDS->UpdateCommonBlock(aCB, myFuzzyValue);
|
||||
}
|
||||
}
|
||||
//
|
||||
@@ -728,6 +775,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
|
||||
aPVE.SetIndices(nVx, nE);
|
||||
aPVE.SetVertex(aVx);
|
||||
aPVE.SetEdge(aE);
|
||||
aPVE.SetFuzzyValue(myFuzzyValue);
|
||||
aPVE.SetPaveBlock(aPB);
|
||||
}
|
||||
}
|
||||
@@ -761,7 +809,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
|
||||
}
|
||||
else {
|
||||
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
|
||||
myDS->UpdateCommonBlock(aCB);
|
||||
myDS->UpdateCommonBlock(aCB, myFuzzyValue);
|
||||
}
|
||||
}//for (; aItMPBLI.More(); aItMPBLI.Next()) {
|
||||
//
|
||||
@@ -788,7 +836,7 @@ void BOPAlgo_PaveFiller::TreatNewVertices
|
||||
Bnd_Box> aTreeFiller(aBBTree);
|
||||
BOPAlgo_VectorOfTNV aVTNV;
|
||||
//
|
||||
Standard_Real aTolAdd = Precision::Confusion() / 2.;
|
||||
Standard_Real aTolAdd = myFuzzyValue / 2.;
|
||||
aNbV = theMVCPB.Extent();
|
||||
for (i=1; i<=aNbV; ++i) {
|
||||
const TopoDS_Vertex& aV = *((TopoDS_Vertex*)&theMVCPB.FindKey(i));
|
||||
@@ -804,6 +852,9 @@ void BOPAlgo_PaveFiller::TreatNewVertices
|
||||
aTNV.SetTree(aBBTree);
|
||||
aTNV.SetBox(aBox);
|
||||
aTNV.SetVertex(aV);
|
||||
aTNV.SetTolerance(aTol);
|
||||
aTNV.SetFuzzyValue(myFuzzyValue);
|
||||
aTNV.SetVectorOfTNV(aVTNV);
|
||||
}
|
||||
//
|
||||
aTreeFiller.Fill();
|
||||
@@ -948,7 +999,7 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
|
||||
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nVx);
|
||||
const TopoDS_Edge& aE = *(TopoDS_Edge*) &myDS->Shape(nE);
|
||||
//
|
||||
iFlag = myContext->ComputeVE(aV, aE, aT, aTolVNew);
|
||||
iFlag = myContext->ComputeVE(aV, aE, aT, aTolVNew, myFuzzyValue);
|
||||
if (iFlag == 0 || iFlag == -4) {
|
||||
BOPDS_Pave aPave;
|
||||
//
|
||||
|
@@ -38,11 +38,6 @@
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_VertexFace
|
||||
//purpose :
|
||||
@@ -53,7 +48,7 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
|
||||
|
||||
BOPAlgo_VertexFace() :
|
||||
BOPAlgo_Algo(),
|
||||
myIV(-1), myIF(-1), myIVx(-1),
|
||||
myIV(-1), myIF(-1),
|
||||
myFlag(-1), myT1(-1.), myT2(-1.), myTolVNew(-1.) {
|
||||
}
|
||||
//
|
||||
@@ -61,19 +56,15 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
|
||||
}
|
||||
//
|
||||
void SetIndices(const Standard_Integer nV,
|
||||
const Standard_Integer nF,
|
||||
const Standard_Integer nVx) {
|
||||
const Standard_Integer nF) {
|
||||
myIV=nV;
|
||||
myIF=nF;
|
||||
myIVx=nVx;
|
||||
}
|
||||
//
|
||||
void Indices(Standard_Integer& nV,
|
||||
Standard_Integer& nF,
|
||||
Standard_Integer& nVx) const {
|
||||
Standard_Integer& nF) const {
|
||||
nV=myIV;
|
||||
nF=myIF;
|
||||
nVx=myIVx;
|
||||
}
|
||||
//
|
||||
void SetVertex(const TopoDS_Vertex& aV) {
|
||||
@@ -116,13 +107,12 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew);
|
||||
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew, myFuzzyValue);
|
||||
}
|
||||
//
|
||||
protected:
|
||||
Standard_Integer myIV;
|
||||
Standard_Integer myIF;
|
||||
Standard_Integer myIVx;
|
||||
Standard_Integer myFlag;
|
||||
Standard_Real myT1;
|
||||
Standard_Real myT2;
|
||||
@@ -186,10 +176,6 @@ void BOPAlgo_PaveFiller::PerformVF()
|
||||
nVx=nVSD;
|
||||
}
|
||||
//
|
||||
if (myDS->HasInterf(nVx, nF)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
myDS->ChangeFaceInfo(nF);// !
|
||||
//
|
||||
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
|
||||
@@ -197,9 +183,10 @@ void BOPAlgo_PaveFiller::PerformVF()
|
||||
//
|
||||
BOPAlgo_VertexFace& aVertexFace=aVVF.Append1();
|
||||
//
|
||||
aVertexFace.SetIndices(nV, nF, nVx);
|
||||
aVertexFace.SetIndices(nV, nF);
|
||||
aVertexFace.SetVertex(aV);
|
||||
aVertexFace.SetFace(aF);
|
||||
aVertexFace.SetFuzzyValue(myFuzzyValue);
|
||||
aVertexFace.SetProgressIndicator(myProgressIndicator);
|
||||
}//for (; myIterator->More(); myIterator->Next()) {
|
||||
//
|
||||
@@ -216,18 +203,18 @@ void BOPAlgo_PaveFiller::PerformVF()
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aVertexFace.Indices(nV, nF, nVx);
|
||||
aVertexFace.Indices(nV, nF);
|
||||
aVertexFace.Parameters(aT1, aT2);
|
||||
// 1
|
||||
BOPDS_InterfVF& aVF=aVFs.Append1();
|
||||
aVF.SetIndices(nVx, nF);
|
||||
aVF.SetIndices(nV, nF);
|
||||
aVF.SetUV(aT1, aT2);
|
||||
// 2
|
||||
myDS->AddInterf(nVx, nF);
|
||||
myDS->AddInterf(nV, nF);
|
||||
//
|
||||
// 3 update vertex V/F if necessary
|
||||
Standard_Real aTolVNew = aVertexFace.VertexNewTolerance();
|
||||
nVx=UpdateVertex(nVx, aTolVNew);
|
||||
nVx=UpdateVertex(nV, aTolVNew);
|
||||
//
|
||||
// 4
|
||||
if (myDS->IsNewShape(nVx)) {
|
||||
@@ -315,7 +302,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, dummy);
|
||||
iFlag = myContext->ComputeVF(aV, aF, aT1, aT2, dummy, myFuzzyValue);
|
||||
if (!iFlag) {
|
||||
// 1
|
||||
BOPDS_InterfVF& aVF=aVFs.Append1();
|
||||
|
@@ -103,6 +103,10 @@ class BOPAlgo_EdgeFace :
|
||||
return myPB;
|
||||
}
|
||||
//
|
||||
void SetFuzzyValue(const Standard_Real theFuzz) {
|
||||
IntTools_EdgeFace::SetFuzzyValue(theFuzz);
|
||||
}
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
IntTools_EdgeFace::Perform();
|
||||
@@ -227,8 +231,7 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
//
|
||||
aEdgeFace.SetEdge (aE);
|
||||
aEdgeFace.SetFace (aF);
|
||||
aEdgeFace.SetTolE (aTolE);
|
||||
aEdgeFace.SetTolF (aTolF);
|
||||
aEdgeFace.SetFuzzyValue(myFuzzyValue);
|
||||
aEdgeFace.SetDiscretize (aDiscretize);
|
||||
aEdgeFace.SetDeflection (aDeflection);
|
||||
aEdgeFace.UseQuickCoincidenceCheck(bExpressCompute);
|
||||
@@ -263,8 +266,8 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
const TopoDS_Edge& aE=aEdgeFace.Edge();
|
||||
const TopoDS_Face& aF=aEdgeFace.Face();
|
||||
//
|
||||
aTolE=aEdgeFace.TolE();
|
||||
aTolF=aEdgeFace.TolF();
|
||||
aTolE=BRep_Tool::Tolerance(aE);
|
||||
aTolF=BRep_Tool::Tolerance(aF);
|
||||
const IntTools_Range& anewSR=aEdgeFace.NewSR();
|
||||
Handle(BOPDS_PaveBlock)& aPB=aEdgeFace.PaveBlock();
|
||||
//
|
||||
@@ -607,7 +610,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
|
||||
nVx=aItLI.Value();
|
||||
const TopoDS_Vertex& aVx=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
|
||||
//
|
||||
iFlag=myContext->ComputeVE (aVx, aE, aT, dummy);
|
||||
iFlag=myContext->ComputeVE (aVx, aE, aT, dummy, myFuzzyValue);
|
||||
if (!iFlag) {
|
||||
aPave.SetIndex(nVx);
|
||||
aPave.SetParameter(aT);
|
||||
@@ -625,7 +628,7 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
|
||||
}
|
||||
else {
|
||||
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
|
||||
myDS->UpdateCommonBlock(aCB);
|
||||
myDS->UpdateCommonBlock(aCB, myFuzzyValue);
|
||||
}
|
||||
}//for (; aItMPBLI.More(); aItMPBLI.Next()) {
|
||||
//
|
||||
@@ -707,7 +710,7 @@ Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF
|
||||
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
|
||||
const TopoDS_Face& aF = *(TopoDS_Face*) &myDS->Shape(nF);
|
||||
//
|
||||
iFlag = myContext->ComputeVF(aV, aF, U, V, aTolVNew);
|
||||
iFlag = myContext->ComputeVF(aV, aF, U, V, aTolVNew, myFuzzyValue);
|
||||
if (iFlag == 0 || iFlag == -2) {
|
||||
bRet=!bRet;
|
||||
//
|
||||
|
@@ -19,7 +19,6 @@
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_SectionAttribute.hxx>
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerReal.hxx>
|
||||
#include <BOPCol_DataMapOfShapeInteger.hxx>
|
||||
#include <BOPCol_ListOfInteger.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
@@ -139,6 +138,10 @@ class BOPAlgo_FaceFace :
|
||||
return myTolFF;
|
||||
}
|
||||
//
|
||||
void SetFuzzyValue(const Standard_Real theFuzz) {
|
||||
IntTools_FaceFace::SetFuzzyValue(theFuzz);
|
||||
}
|
||||
//
|
||||
virtual void Perform() {
|
||||
BOPAlgo_Algo::UserBreak();
|
||||
IntTools_FaceFace::Perform(myF1, myF2);
|
||||
@@ -249,6 +252,7 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
}
|
||||
//
|
||||
aFaceFace.SetParameters(bApp, bCompC2D1, bCompC2D2, aApproxTol);
|
||||
aFaceFace.SetFuzzyValue(myFuzzyValue);
|
||||
aFaceFace.SetProgressIndicator(myProgressIndicator);
|
||||
}//for (; myIterator->More(); myIterator->Next()) {
|
||||
//
|
||||
@@ -369,7 +373,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
Standard_Boolean bExist, bValid2D;
|
||||
Standard_Integer i, nF1, nF2, aNbC, aNbP, j;
|
||||
Standard_Integer nV1, nV2;
|
||||
Standard_Real aTolR3D, aT1, aT2, aTol;
|
||||
Standard_Real aTolR3D, aT1, aT2;
|
||||
Handle(NCollection_BaseAllocator) aAllocator;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
|
||||
TopoDS_Edge aES;
|
||||
@@ -384,13 +388,14 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
aMVStick(100,aAllocator), aMVEF(100, aAllocator),
|
||||
aMI(100, aAllocator), aMVBounds(100, aAllocator);
|
||||
BOPDS_IndexedMapOfPaveBlock aMPBOnIn(100, aAllocator);
|
||||
BOPDS_MapOfPaveBlock aMPBAdd(100, aAllocator);
|
||||
BOPDS_MapOfPaveBlock aMPBAdd(100, aAllocator), aMPBCommon;
|
||||
BOPDS_ListOfPaveBlock aLPB(aAllocator);
|
||||
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMSCPB(100, aAllocator);
|
||||
BOPCol_DataMapOfShapeInteger aMVI(100, aAllocator);
|
||||
BOPDS_DataMapOfPaveBlockListOfPaveBlock aDMExEdges(100, aAllocator);
|
||||
BOPCol_DataMapOfIntegerReal aMVTol(100, aAllocator);
|
||||
BOPCol_DataMapOfIntegerInteger aDMI(100, aAllocator);
|
||||
BOPCol_DataMapOfIntegerInteger aDMNewSD(100, aAllocator);
|
||||
BOPCol_DataMapOfIntegerListOfInteger aDMVLV;
|
||||
BOPCol_DataMapOfIntegerListOfInteger aDMBV(100, aAllocator);
|
||||
BOPCol_DataMapIteratorOfDataMapOfIntegerReal aItMV;
|
||||
BOPCol_IndexedMapOfShape aMicroEdges(100, aAllocator);
|
||||
@@ -430,11 +435,12 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
//
|
||||
aMVOnIn.Clear();
|
||||
aMPBOnIn.Clear();
|
||||
aMPBCommon.Clear();
|
||||
aDMBV.Clear();
|
||||
aMVTol.Clear();
|
||||
aLSE.Clear();
|
||||
//
|
||||
myDS->VerticesOnIn(nF1, nF2, aMVOnIn, aMPBOnIn);
|
||||
myDS->SubShapesOnIn(nF1, nF2, aMVOnIn, aMPBOnIn, aMPBCommon);
|
||||
myDS->SharedEdges(nF1, nF2, aLSE, aAllocator);
|
||||
|
||||
// 1. Treat Points
|
||||
@@ -460,18 +466,27 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
aMVEF.Clear();
|
||||
GetStickVertices(nF1, nF2, aMVStick, aMVEF, aMI);
|
||||
//
|
||||
for (j=0; j<aNbC; ++j) {
|
||||
BOPDS_Curve& aNC=aVC.ChangeValue(j);
|
||||
const IntTools_Curve& aIC=aNC.Curve();
|
||||
for (j = 0; j < aNbC; ++j) {
|
||||
BOPDS_Curve& aNC = aVC.ChangeValue(j);
|
||||
// DEBt
|
||||
aNC.InitPaveBlock1();
|
||||
//
|
||||
PutPavesOnCurve(aMVOnIn, aTolR3D, aNC, nF1, nF2, aMI, aMVEF, aMVTol);
|
||||
PutPavesOnCurve(aMVOnIn, aTolR3D, aNC, nF1, nF2, aMI, aMVEF, aMVTol, aDMVLV);
|
||||
}
|
||||
|
||||
// if some E-F vertex was put on a curve due to large E-F intersection range,
|
||||
// and it also was put on another curve correctly then remove this vertex from
|
||||
// the first curve. Detect such case if the distance to curve exceeds aTolR3D.
|
||||
FilterPavesOnCurves(aVC, aTolR3D);
|
||||
|
||||
for (j = 0; j<aNbC; ++j) {
|
||||
BOPDS_Curve& aNC=aVC.ChangeValue(j);
|
||||
const IntTools_Curve& aIC=aNC.Curve();
|
||||
//
|
||||
PutStickPavesOnCurve(aF1, aF2, aMI, aNC, aMVStick, aMVTol);
|
||||
PutStickPavesOnCurve(aF1, aF2, aMI, aNC, aMVStick, aMVTol, aDMVLV);
|
||||
//904/F7
|
||||
if (aNbC == 1) {
|
||||
PutEFPavesOnCurve(aNC, aMI, aMVEF, aMVTol);
|
||||
PutEFPavesOnCurve(aNC, aMI, aMVEF, aMVTol, aDMVLV);
|
||||
}
|
||||
//
|
||||
if (aIC.HasBounds()) {
|
||||
@@ -488,7 +503,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
}
|
||||
}
|
||||
}//for (j=0; j<aNbC; ++j) {
|
||||
//
|
||||
|
||||
// Put closing pave if needed
|
||||
for (j=0; j<aNbC; ++j) {
|
||||
BOPDS_Curve& aNC=aVC.ChangeValue(j);
|
||||
@@ -549,7 +564,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
}
|
||||
//
|
||||
Standard_Real aTolNew;
|
||||
bExist=IsExistingPaveBlock(aPB, aNC, aTolR3D, aMPBOnIn, aPBOut, aTolNew);
|
||||
bExist=IsExistingPaveBlock(aPB, aNC, aTolR3D, aMPBOnIn, aMPBCommon, aPBOut, aTolNew);
|
||||
if (bExist) {
|
||||
if (aMPBAdd.Add(aPBOut)) {
|
||||
Standard_Boolean bInBothFaces = Standard_True;
|
||||
@@ -604,23 +619,35 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
//
|
||||
aLPBC.RemoveFirst();
|
||||
}//for (j=0; j<aNbC; ++j) {
|
||||
//
|
||||
//back to previous tolerance values for unused vertices
|
||||
//and forget about SD groups of such vertices
|
||||
aItMV.Initialize(aMVTol);
|
||||
for (; aItMV.More(); aItMV.Next()) {
|
||||
nV1 = aItMV.Key();
|
||||
aTol = aItMV.Value();
|
||||
Standard_Real aTol = aItMV.Value();
|
||||
//
|
||||
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV1);
|
||||
const Handle(BRep_TVertex)& TV =
|
||||
*((Handle(BRep_TVertex)*)&aV.TShape());
|
||||
TV->Tolerance(aTol);
|
||||
// reset bnd box
|
||||
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV1);
|
||||
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
|
||||
aBoxDS = Bnd_Box();
|
||||
BRepBndLib::Add(aV, aBoxDS);
|
||||
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
|
||||
//
|
||||
if (aDMVLV.IsBound(nV1))
|
||||
aDMVLV.UnBind(nV1);
|
||||
}
|
||||
//
|
||||
ProcessExistingPaveBlocks(i, aMPBOnIn, aDMBV, aMSCPB, aMVI, aMPBAdd);
|
||||
}//for (i=0; i<aNbFF; ++i) {
|
||||
//
|
||||
// post treatment
|
||||
myErrorStatus=PostTreatFF(aMSCPB, aMVI, aDMExEdges, aDMI, aMicroEdges, aAllocator);
|
||||
MakeSDVerticesFF(aDMVLV, aDMNewSD);
|
||||
myErrorStatus=PostTreatFF(aMSCPB, aMVI, aDMExEdges, aDMNewSD, aMicroEdges, aAllocator);
|
||||
if (myErrorStatus) {
|
||||
return;
|
||||
}
|
||||
@@ -628,9 +655,9 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
CorrectToleranceOfSE();
|
||||
//
|
||||
// update face info
|
||||
UpdateFaceInfo(aDMExEdges, aDMI);
|
||||
UpdateFaceInfo(aDMExEdges, aDMNewSD);
|
||||
//Update all pave blocks
|
||||
UpdatePaveBlocks(aDMI);
|
||||
UpdatePaveBlocks(aDMNewSD);
|
||||
//-----------------------------------------------------scope t
|
||||
aMF.Clear();
|
||||
aMVStick.Clear();
|
||||
@@ -638,7 +665,31 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
aMVOnIn.Clear();
|
||||
aDMExEdges.Clear();
|
||||
aMI.Clear();
|
||||
aDMI.Clear();
|
||||
aDMNewSD.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeSDVerticesFF
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::MakeSDVerticesFF
|
||||
(const BOPCol_DataMapOfIntegerListOfInteger& theDMVLV,
|
||||
BOPCol_DataMapOfIntegerInteger& theDMNewSD)
|
||||
{
|
||||
// Create a new SD vertex for each group of coinciding vertices
|
||||
// and put new substitutions to theDMNewSD.
|
||||
BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItG(theDMVLV);
|
||||
for (; aItG.More(); aItG.Next()) {
|
||||
const BOPCol_ListOfInteger& aList = aItG.Value();
|
||||
// make SD vertices w/o creation of interfs
|
||||
Standard_Integer nSD = MakeSDVertices(aList, Standard_False);
|
||||
// update theDMNewSD
|
||||
BOPCol_ListIteratorOfListOfInteger aItL(aList);
|
||||
for (; aItL.More(); aItL.Next()) {
|
||||
Standard_Integer nV = aItL.Value();
|
||||
theDMNewSD.Bind(nV, nSD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -649,7 +700,7 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
|
||||
BOPCol_DataMapOfShapeInteger& aMVI,
|
||||
BOPDS_DataMapOfPaveBlockListOfPaveBlock& aDMExEdges,
|
||||
BOPCol_DataMapOfIntegerInteger& aDMI,
|
||||
BOPCol_DataMapOfIntegerInteger& aDMNewSD,
|
||||
const BOPCol_IndexedMapOfShape& theMicroEdges,
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
{
|
||||
@@ -797,18 +848,18 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
if (!bIntersectionPoint) {
|
||||
// save SD connection
|
||||
nSx = aMVI.Find(aSx);
|
||||
aDMI.Bind(nSx, iV);
|
||||
aDMNewSD.Bind(nSx, iV);
|
||||
myDS->AddShapeSD(nSx, iV);
|
||||
}
|
||||
else {
|
||||
// update FF interference
|
||||
const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromKey(aSx);
|
||||
iX=aCPB.IndexInterf();
|
||||
iP=aCPB.Index();
|
||||
BOPDS_InterfFF& aFF=aFFs(iX);
|
||||
BOPDS_VectorOfPoint& aVNP=aFF.ChangePoints();
|
||||
BOPDS_Point& aNP=aVNP(iP);
|
||||
aNP.SetIndex(iV);
|
||||
const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromKey(aSx);
|
||||
iX=aCPB.IndexInterf();
|
||||
iP=aCPB.Index();
|
||||
BOPDS_InterfFF& aFF=aFFs(iX);
|
||||
BOPDS_VectorOfPoint& aVNP=aFF.ChangePoints();
|
||||
BOPDS_Point& aNP=aVNP(iP);
|
||||
aNP.SetIndex(iV);
|
||||
}
|
||||
}//if (aType==TopAbs_VERTEX) {
|
||||
//
|
||||
@@ -918,7 +969,7 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
|
||||
const BOPDS_Pave& aP1 = !j ? aPB1->Pave1() : aPB1->Pave2();
|
||||
if (aP1.Parameter() == aPave[j].Parameter() &&
|
||||
aP1.Index() != iV) {
|
||||
aDMI.Bind(aP1.Index(), iV);
|
||||
aDMNewSD.Bind(aP1.Index(), iV);
|
||||
myDS->AddShapeSD(aP1.Index(), iV);
|
||||
}
|
||||
//
|
||||
@@ -1120,10 +1171,12 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Integer nV, iFlag;
|
||||
Standard_Real aTolCheck;
|
||||
gp_Pnt aPV;
|
||||
Bnd_Box aBoxP;
|
||||
BOPCol_MapIteratorOfMapOfInteger aIt;
|
||||
//
|
||||
aTolCheck = theTolR3D + myFuzzyValue;
|
||||
bRet=Standard_True;
|
||||
//
|
||||
aBoxP.Add(aP);
|
||||
@@ -1137,7 +1190,7 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex
|
||||
const Bnd_Box& aBoxV=aSIV.Box();
|
||||
//
|
||||
if (!aBoxP.IsOut(aBoxV)) {
|
||||
iFlag=BOPTools_AlgoTools::ComputeVV(aV, aP, theTolR3D);
|
||||
iFlag=BOPTools_AlgoTools::ComputeVV(aV, aP, aTolCheck);
|
||||
if (!iFlag) {
|
||||
return bRet;
|
||||
}
|
||||
@@ -1160,7 +1213,7 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
return !bRet;
|
||||
}
|
||||
//
|
||||
Standard_Real aT1, aT2, aTm, aTx, aTol, aDist;
|
||||
Standard_Real aT1, aT2, aTm, aTx, aTolE, aTolCheck, aTol, aDist;
|
||||
Standard_Integer nE, iFlag, nV1, nV2;
|
||||
gp_Pnt aPm;
|
||||
Bnd_Box aBoxPm;
|
||||
@@ -1189,8 +1242,9 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
const Bnd_Box& aBoxE=aSIE.Box();
|
||||
if (!aBoxE.IsOut(aBoxPm)) {
|
||||
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape()));
|
||||
const Standard_Real aTol1 = Max(BRep_Tool::Tolerance(aE), aTol);
|
||||
iFlag=myContext->ComputePE(aPm, aTol1, aE, aTx, aDist);
|
||||
aTolE = BRep_Tool::Tolerance(aE);
|
||||
aTolCheck = Max(aTolE, aTol) + myFuzzyValue;
|
||||
iFlag = myContext->ComputePE(aPm, aTolCheck, aE, aTx, aDist);
|
||||
if (!iFlag) {
|
||||
return bRet;
|
||||
}
|
||||
@@ -1203,28 +1257,30 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
//function : IsExistingPaveBlock
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
(const Handle(BOPDS_PaveBlock)& thePB,
|
||||
const BOPDS_Curve& theNC,
|
||||
const Standard_Real theTolR3D,
|
||||
const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn,
|
||||
const BOPDS_MapOfPaveBlock& theMPBCommon,
|
||||
Handle(BOPDS_PaveBlock)& aPBOut,
|
||||
Standard_Real& theTolNew)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Real aT1, aT2, aTm, aTx;
|
||||
Standard_Real aT1, aT2, aTm, aTx, aTolCheck;
|
||||
Standard_Integer nSp, iFlag1, iFlag2, nV11, nV12, nV21, nV22, i, aNbPB;
|
||||
gp_Pnt aP1, aPm, aP2;
|
||||
Bnd_Box aBoxP1, aBoxPm, aBoxP2, aBoxTmp;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
aTolCheck = theTolR3D + myFuzzyValue;
|
||||
const IntTools_Curve& aIC=theNC.Curve();
|
||||
//
|
||||
thePB->Range(aT1, aT2);
|
||||
thePB->Indices(nV11, nV12);
|
||||
const Standard_Real aTolV11 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV11)));
|
||||
const Standard_Real aTolV12 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV12)));
|
||||
const Standard_Real aTolV1 = Max(aTolV11, aTolV12);
|
||||
const Standard_Real aTolV1 = Max(aTolV11, aTolV12) + myFuzzyValue;
|
||||
|
||||
//first point
|
||||
aIC.D0(aT1, aP1);
|
||||
@@ -1246,7 +1302,7 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
aPB->Indices(nV21, nV22);
|
||||
const Standard_Real aTolV21 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV21)));
|
||||
const Standard_Real aTolV22 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV22)));
|
||||
const Standard_Real aTolV2 = Max(aTolV21, aTolV22);
|
||||
const Standard_Real aTolV2 = Max(aTolV21, aTolV22) + myFuzzyValue;
|
||||
nSp=aPB->Edge();
|
||||
if (nSp < 0)
|
||||
continue;
|
||||
@@ -1261,9 +1317,16 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
if (iFlag1 && iFlag2) {
|
||||
Standard_Real aDist = 0.;
|
||||
|
||||
const Standard_Real aRealTol = myDS->IsCommonBlock(aPB) ?
|
||||
Max(aTolV1, aTolV2) : theTolR3D;
|
||||
|
||||
Standard_Real aRealTol = aTolCheck;
|
||||
if (myDS->IsCommonBlock(aPB))
|
||||
{
|
||||
aRealTol = Max(aRealTol, Max(aTolV1, aTolV2));
|
||||
if (theMPBCommon.Contains(aPB))
|
||||
// for an edge, which is a common block with a face,
|
||||
// increase the chance to coincide with section curve
|
||||
aRealTol *= 2.;
|
||||
}
|
||||
|
||||
aBoxTmp = aBoxPm;
|
||||
aBoxTmp.Enlarge(aRealTol);
|
||||
|
||||
@@ -1299,11 +1362,11 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
//function : PutBoundPaveOnCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PutBoundPaveOnCurve(const TopoDS_Face& aF1,
|
||||
const TopoDS_Face& aF2,
|
||||
const Standard_Real aTolR3D,
|
||||
BOPDS_Curve& aNC,
|
||||
BOPCol_ListOfInteger& aLVB)
|
||||
void BOPAlgo_PaveFiller::PutBoundPaveOnCurve(const TopoDS_Face& aF1,
|
||||
const TopoDS_Face& aF2,
|
||||
const Standard_Real aTolR3D,
|
||||
BOPDS_Curve& aNC,
|
||||
BOPCol_ListOfInteger& aLVB)
|
||||
{
|
||||
Standard_Boolean bVF;
|
||||
Standard_Integer nV, iFlag, nVn, j, aNbEP;
|
||||
@@ -1402,7 +1465,7 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
//function : PutPavesOnCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PutPavesOnCurve
|
||||
void BOPAlgo_PaveFiller::PutPavesOnCurve
|
||||
(const BOPCol_MapOfInteger& aMVOnIn,
|
||||
const Standard_Real aTolR3D,
|
||||
BOPDS_Curve& aNC,
|
||||
@@ -1410,7 +1473,8 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
const Standard_Integer nF2,
|
||||
const BOPCol_MapOfInteger& aMI,
|
||||
const BOPCol_MapOfInteger& aMVEF,
|
||||
BOPCol_DataMapOfIntegerReal& aMVTol)
|
||||
BOPCol_DataMapOfIntegerReal& aMVTol,
|
||||
BOPCol_DataMapOfIntegerListOfInteger& aDMVLV)
|
||||
{
|
||||
Standard_Boolean bInBothFaces;
|
||||
Standard_Integer nV;
|
||||
@@ -1422,7 +1486,7 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
aIt.Initialize(aMVEF);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
nV=aIt.Value();
|
||||
PutPaveOnCurve(nV, aTolR3D, aNC, aMI, aMVTol, 2);
|
||||
PutPaveOnCurve(nV, aTolR3D, aNC, aMI, aMVTol, aDMVLV, 2);
|
||||
}
|
||||
//Put all other vertices
|
||||
aIt.Initialize(aMVOnIn);
|
||||
@@ -1451,7 +1515,97 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
}
|
||||
}
|
||||
//
|
||||
PutPaveOnCurve(nV, aTolR3D, aNC, aMI, aMVTol, 1);
|
||||
PutPaveOnCurve(nV, aTolR3D, aNC, aMI, aMVTol, aDMVLV, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FilterPavesOnCurves
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
namespace {
|
||||
struct PaveBlockDist {
|
||||
Handle(BOPDS_PaveBlock) PB;
|
||||
Standard_Real Dist; // square distance from vertex to the paveblock
|
||||
Standard_Real SinAngle; // sinus of angle between projection vector
|
||||
// and tangent at projection point
|
||||
};
|
||||
}
|
||||
void BOPAlgo_PaveFiller::FilterPavesOnCurves(const BOPDS_VectorOfCurve& theVNC,
|
||||
const Standard_Real theTolR3D)
|
||||
{
|
||||
Standard_Real aSqTol = theTolR3D * theTolR3D;
|
||||
|
||||
// For each vertex found in ExtPaves of pave blocks of section curves
|
||||
// collect list of pave blocks with distance to the curve
|
||||
NCollection_IndexedDataMap<Standard_Integer,NCollection_List<PaveBlockDist> > aIDMVertPBs;
|
||||
Standard_Integer i;
|
||||
const Standard_Real anEps = gp::Resolution();
|
||||
for (i = 0; i < theVNC.Extent(); ++i)
|
||||
{
|
||||
const BOPDS_Curve& aNC = theVNC(i);
|
||||
const IntTools_Curve& aIC = aNC.Curve();
|
||||
GeomAdaptor_Curve aGAC(aIC.Curve());
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aNC.PaveBlocks().First();
|
||||
const BOPDS_ListOfPave& aPaves = aPB->ExtPaves();
|
||||
BOPDS_ListOfPave::Iterator itPaves(aPaves);
|
||||
for (; itPaves.More(); itPaves.Next())
|
||||
{
|
||||
const BOPDS_Pave& aPave = itPaves.Value();
|
||||
Standard_Integer nV = aPave.Index();
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV));
|
||||
// compute distance from vertex to the point on curve with vertex parameter
|
||||
gp_Pnt aPV = BRep_Tool::Pnt(aV);
|
||||
Standard_Real aPar = aPave.Parameter();
|
||||
gp_Pnt aPonC;
|
||||
gp_Vec aD1;
|
||||
aGAC.D1(aPar, aPonC, aD1);
|
||||
gp_Vec aProjVec(aPV, aPonC);
|
||||
Standard_Real aSqDist = aProjVec.SquareMagnitude();
|
||||
Standard_Real aSqD1Mod = aD1.SquareMagnitude();
|
||||
Standard_Real aSin = aProjVec.CrossSquareMagnitude(aD1);
|
||||
if (aSqDist > anEps && aSqD1Mod > anEps)
|
||||
aSin = sqrt(aSin / aSqDist / aSqD1Mod);
|
||||
NCollection_List<PaveBlockDist>* pList = aIDMVertPBs.ChangeSeek(nV);
|
||||
if (!pList)
|
||||
pList = &aIDMVertPBs.ChangeFromIndex(aIDMVertPBs.Add(nV, NCollection_List<PaveBlockDist>()));
|
||||
PaveBlockDist aPBD = { aPB, aSqDist, aSin };
|
||||
pList->Append(aPBD);
|
||||
}
|
||||
}
|
||||
|
||||
// Process each vertex
|
||||
const Standard_Real aSinAngleMin = 0.5; // angle below which projection is suspicious
|
||||
for (i = 1; i <= aIDMVertPBs.Extent(); i++)
|
||||
{
|
||||
Standard_Integer nV = aIDMVertPBs.FindKey(i);
|
||||
const NCollection_List<PaveBlockDist>& aList = aIDMVertPBs(i);
|
||||
// Find a pave with minimal distance
|
||||
Standard_Real aMinDist = RealLast();
|
||||
Handle(BOPDS_PaveBlock) aPBMinDist;
|
||||
NCollection_List<PaveBlockDist>::Iterator itL(aList);
|
||||
for (; itL.More(); itL.Next())
|
||||
{
|
||||
const PaveBlockDist& aPBD = itL.Value();
|
||||
if (aPBD.Dist < aMinDist)
|
||||
{
|
||||
aMinDist = aPBD.Dist;
|
||||
aPBMinDist = aPBD.PB;
|
||||
}
|
||||
}
|
||||
// Remove a vertex from a pave block if the distance is greater than the tolerance
|
||||
// and there are other pave blocks for which the distance is less than the current.
|
||||
// Do not remove a vertex if it is projected on the curve with quite large angle
|
||||
// (see test bugs modalg_6 bug27761).
|
||||
Standard_Real aCheckDist = 100. * Max(aSqTol, aMinDist);
|
||||
for (itL.Init(aList); itL.More(); itL.Next())
|
||||
{
|
||||
const PaveBlockDist& aPBD = itL.Value();
|
||||
if (aPBD.Dist > aCheckDist && aPBD.SinAngle < aSinAngleMin)
|
||||
{
|
||||
aPBD.PB->RemoveExtPave(nV);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1595,14 +1749,15 @@ void BOPAlgo_PaveFiller::GetEFPnts
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ProcessUnUsedVertices
|
||||
//function : PutEFPavesOnCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PutEFPavesOnCurve
|
||||
(BOPDS_Curve& aNC,
|
||||
const BOPCol_MapOfInteger& aMI,
|
||||
const BOPCol_MapOfInteger& aMVEF,
|
||||
BOPCol_DataMapOfIntegerReal& aMVTol)
|
||||
BOPCol_DataMapOfIntegerReal& aMVTol,
|
||||
BOPCol_DataMapOfIntegerListOfInteger& aDMVLV)
|
||||
{
|
||||
if (!aMVEF.Extent()) {
|
||||
return;
|
||||
@@ -1640,7 +1795,7 @@ void BOPAlgo_PaveFiller::GetEFPnts
|
||||
Standard_Integer aNbPoints = aProjPT.NbPoints();
|
||||
if (aNbPoints) {
|
||||
aDist = aProjPT.LowerDistance();
|
||||
PutPaveOnCurve(nV, aDist, aNC, aMI, aMVTol);
|
||||
PutPaveOnCurve(nV, aDist, aNC, aMI, aMVTol, aDMVLV);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1655,7 +1810,8 @@ void BOPAlgo_PaveFiller::GetEFPnts
|
||||
const BOPCol_MapOfInteger& aMI,
|
||||
BOPDS_Curve& aNC,
|
||||
const BOPCol_MapOfInteger& aMVStick,
|
||||
BOPCol_DataMapOfIntegerReal& aMVTol)
|
||||
BOPCol_DataMapOfIntegerReal& aMVTol,
|
||||
BOPCol_DataMapOfIntegerListOfInteger& aDMVLV)
|
||||
{
|
||||
BOPCol_MapOfInteger aMV;
|
||||
aMV.Assign(aMVStick);
|
||||
@@ -1718,7 +1874,7 @@ void BOPAlgo_PaveFiller::GetEFPnts
|
||||
// The intersection curve aIC is vanishing curve (the crease)
|
||||
aD=sqrt(aD2);
|
||||
//
|
||||
PutPaveOnCurve(nV, aD, aNC, aMI, aMVTol);
|
||||
PutPaveOnCurve(nV, aD, aNC, aMI, aMVTol, aDMVLV);
|
||||
}
|
||||
}//for (jVU=1; jVU=aNbVU; ++jVU) {
|
||||
}
|
||||
@@ -1832,49 +1988,59 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
//function : PutPaveOnCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PutPaveOnCurve
|
||||
void BOPAlgo_PaveFiller::PutPaveOnCurve
|
||||
(const Standard_Integer nV,
|
||||
const Standard_Real aTolR3D,
|
||||
BOPDS_Curve& aNC,
|
||||
const BOPDS_Curve& aNC,
|
||||
const BOPCol_MapOfInteger& aMI,
|
||||
BOPCol_DataMapOfIntegerReal& aMVTol,
|
||||
BOPCol_DataMapOfIntegerListOfInteger& aDMVLV,
|
||||
const Standard_Integer iCheckExtend)
|
||||
{
|
||||
Standard_Boolean bIsVertexOnLine;
|
||||
Standard_Real aT, aTolV;
|
||||
Standard_Real aT;
|
||||
//
|
||||
const TopoDS_Vertex& aV = (*(TopoDS_Vertex *)(&myDS->Shape(nV)));
|
||||
Handle(BOPDS_PaveBlock)& aPB=aNC.ChangePaveBlock1();
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aNC.PaveBlocks().First();
|
||||
const IntTools_Curve& aIC = aNC.Curve();
|
||||
//
|
||||
bIsVertexOnLine=myContext->IsVertexOnLine(aV, aIC, aTolR3D, aT);
|
||||
Standard_Real aTolV = (aMVTol.IsBound(nV) ? aMVTol(nV) : BRep_Tool::Tolerance(aV));
|
||||
|
||||
bIsVertexOnLine = myContext->IsVertexOnLine(aV, aTolV, aIC, aTolR3D + myFuzzyValue, aT);
|
||||
if (!bIsVertexOnLine && iCheckExtend) {
|
||||
aTolV = BRep_Tool::Tolerance(aV);
|
||||
//
|
||||
ExtendedTolerance(nV, aMI, aTolV, iCheckExtend);
|
||||
bIsVertexOnLine=myContext->IsVertexOnLine(aV, aTolV, aIC, aTolR3D, aT);
|
||||
bIsVertexOnLine = myContext->IsVertexOnLine(aV, aTolV, aIC, aTolR3D + myFuzzyValue, aT);
|
||||
}
|
||||
//
|
||||
if (bIsVertexOnLine) {
|
||||
// check if aPB contains the parameter aT
|
||||
Standard_Boolean bExist;
|
||||
Standard_Integer nVToUpdate;
|
||||
Standard_Real aPTol, aDist, aTolVNew, aTolV2, aDTol;
|
||||
TopoDS_Vertex aVToUpdate;
|
||||
gp_Pnt aP1, aP2;
|
||||
Standard_Integer nVUsed;
|
||||
Standard_Real aPTol, aDTol;
|
||||
//
|
||||
aTolV2 = 0.;
|
||||
aDTol = 1.e-12;
|
||||
//
|
||||
GeomAdaptor_Curve aGAC(aIC.Curve());
|
||||
aPTol = aGAC.Resolution(aTolR3D);
|
||||
//
|
||||
bExist = aPB->ContainsParameter(aT, aPTol, nVToUpdate);
|
||||
bExist = aPB->ContainsParameter(aT, aPTol, nVUsed);
|
||||
if (bExist) {
|
||||
// use existing pave
|
||||
aP1 = BRep_Tool::Pnt(aV);
|
||||
aTolV2 = BRep_Tool::Tolerance(aV);
|
||||
aVToUpdate = (*(TopoDS_Vertex *)(&myDS->Shape(nVToUpdate)));
|
||||
BOPCol_ListOfInteger* pList = aDMVLV.ChangeSeek(nVUsed);
|
||||
if (!pList) {
|
||||
pList = aDMVLV.Bound(nVUsed, BOPCol_ListOfInteger());
|
||||
pList->Append(nVUsed);
|
||||
if (!aMVTol.IsBound(nVUsed)) {
|
||||
const TopoDS_Vertex& aVUsed = (*(TopoDS_Vertex *)(&myDS->Shape(nVUsed)));
|
||||
aTolV = BRep_Tool::Tolerance(aVUsed);
|
||||
aMVTol.Bind(nVUsed, aTolV);
|
||||
}
|
||||
}
|
||||
pList->Append(nV);
|
||||
if (!aMVTol.IsBound(nV)) {
|
||||
aTolV = BRep_Tool::Tolerance(aV);
|
||||
aMVTol.Bind(nV, aTolV);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// add new pave
|
||||
@@ -1883,34 +2049,28 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
|
||||
aPave.SetParameter(aT);
|
||||
aPB->AppendExtPave(aPave);
|
||||
//
|
||||
aP1 = aGAC.Value(aT);
|
||||
nVToUpdate = nV;
|
||||
aVToUpdate = aV;
|
||||
}
|
||||
//
|
||||
aTolV = BRep_Tool::Tolerance(aVToUpdate);
|
||||
aP2 = BRep_Tool::Pnt(aVToUpdate);
|
||||
aDist = aP1.Distance(aP2);
|
||||
aTolVNew = Max(aDist - aTolV2, aTolR3D);
|
||||
//
|
||||
if (aTolVNew > aTolV) {
|
||||
BRep_Builder aBB;
|
||||
aBB.UpdateVertex(aVToUpdate, aTolVNew+aDTol);
|
||||
//
|
||||
if (!aMVTol.IsBound(nVToUpdate)) {
|
||||
aMVTol.Bind(nVToUpdate, aTolV);
|
||||
gp_Pnt aP1 = aGAC.Value(aT);
|
||||
aTolV = BRep_Tool::Tolerance(aV);
|
||||
gp_Pnt aP2 = BRep_Tool::Pnt(aV);
|
||||
Standard_Real aDist = aP1.Distance(aP2);
|
||||
if (aDist > aTolV) {
|
||||
BRep_Builder().UpdateVertex(aV, aDist + aDTol);
|
||||
//
|
||||
if (!aMVTol.IsBound(nV)) {
|
||||
aMVTol.Bind(nV, aTolV);
|
||||
}
|
||||
//
|
||||
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
|
||||
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
|
||||
BRepBndLib::Add(aV, aBoxDS);
|
||||
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
|
||||
}
|
||||
//
|
||||
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVToUpdate);
|
||||
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
|
||||
BRepBndLib::Add(aVToUpdate, aBoxDS);
|
||||
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ProcessOldPaveBlocks
|
||||
//function : ProcessExistingPaveBlocks
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
|
||||
@@ -1977,7 +2137,7 @@ void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
|
||||
//
|
||||
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aSIE.Shape();
|
||||
//
|
||||
iFlag = myContext->ComputeVE(aV, aE, aT, dummy);
|
||||
iFlag = myContext->ComputeVE(aV, aE, aT, dummy, myFuzzyValue);
|
||||
if (!iFlag) {
|
||||
aMPB.Add(aPB);
|
||||
PreparePostTreatFF(theInt, iC, aPB, aMSCPB, aMVI, aLPBC);
|
||||
@@ -2096,24 +2256,20 @@ void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
|
||||
// with the opposite face.
|
||||
// In case of coincidence create common blocks
|
||||
Standard_Integer nF;
|
||||
Standard_Real aTolE, aTolF;
|
||||
//
|
||||
nF = bIn1 ? nF2 : nF1;
|
||||
const TopoDS_Face& aF = *(TopoDS_Face*)&myDS->Shape(nF);
|
||||
BOPDS_IndexedMapOfPaveBlock& aMPBIn = bIn1 ? aMPBIn2 : aMPBIn1;
|
||||
aTolF = BRep_Tool::Tolerance(aF);
|
||||
//
|
||||
aIt.Initialize(aLPB);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
Handle(BOPDS_PaveBlock)& aPBChangeValue = aIt.ChangeValue();
|
||||
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(aPBChangeValue->Edge());
|
||||
aTolE = BRep_Tool::Tolerance(aE);
|
||||
//
|
||||
IntTools_EdgeFace anEF;
|
||||
anEF.SetEdge(aE);
|
||||
anEF.SetFace(aF);
|
||||
anEF.SetTolE(aTolE);
|
||||
anEF.SetTolF(aTolF);
|
||||
anEF.SetFuzzyValue(myFuzzyValue);
|
||||
anEF.SetRange(aPBChangeValue->Pave1().Parameter(), aPBChangeValue->Pave2().Parameter());
|
||||
anEF.SetContext(myContext);
|
||||
anEF.Perform();
|
||||
@@ -2267,9 +2423,9 @@ Standard_Boolean BOPAlgo_PaveFiller::CheckPlanes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::UpdatePaveBlocks
|
||||
(const BOPCol_DataMapOfIntegerInteger& aDMI)
|
||||
(const BOPCol_DataMapOfIntegerInteger& aDMNewSD)
|
||||
{
|
||||
if (aDMI.IsEmpty()) {
|
||||
if (aDMNewSD.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
@@ -2302,10 +2458,10 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
|
||||
Standard_Boolean wasRegularEdge = (nV[0] != nV[1]);
|
||||
//
|
||||
for (j = 0; j < 2; ++j) {
|
||||
if (aDMI.IsBound(nV[j])) {
|
||||
if (aDMNewSD.IsBound(nV[j])) {
|
||||
BOPDS_Pave aPave;
|
||||
//
|
||||
nV[j] = aDMI.Find(nV[j]);
|
||||
nV[j] = aDMNewSD.Find(nV[j]);
|
||||
aPave.SetIndex(nV[j]);
|
||||
aPave.SetParameter(aT[j]);
|
||||
//
|
||||
@@ -2594,20 +2750,20 @@ void BOPAlgo_PaveFiller::CorrectToleranceOfSE()
|
||||
Standard_Real aTolR3D = aFF.TolR3D();
|
||||
Standard_Real aTolReal = aFF.TolReal();
|
||||
Standard_Boolean bToReduce = aTolReal < aTolR3D;
|
||||
// tolerance of intersection has been increased, so process this intersection
|
||||
// tolerance of intersection has been increased, so process this intersection
|
||||
BOPDS_VectorOfCurve& aVNC = aFF.ChangeCurves();
|
||||
Standard_Integer aNbC = aVNC.Extent(), k;
|
||||
for (k = 0; k < aNbC; ++k) {
|
||||
Standard_Integer aNbC = aVNC.Extent(), k;
|
||||
for (k = 0; k < aNbC; ++k) {
|
||||
BOPDS_Curve& aNC = aVNC(k);
|
||||
BOPDS_ListOfPaveBlock& aLPB = aNC.ChangePaveBlocks();
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB);
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB);
|
||||
for (; aItLPB.More(); ) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
|
||||
Standard_Integer nE;
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
|
||||
Standard_Integer nE;
|
||||
if (!aPB->HasEdge(nE)) {
|
||||
aLPB.Remove(aItLPB);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bIsReduced = Standard_False;
|
||||
if (bToReduce && (aPB->OriginalEdge() < 0)) {
|
||||
@@ -2620,13 +2776,13 @@ void BOPAlgo_PaveFiller::CorrectToleranceOfSE()
|
||||
}
|
||||
}
|
||||
//
|
||||
// fill in the map vertex index - pave blocks
|
||||
for (Standard_Integer j=0; j < 2; j++) {
|
||||
// fill in the map vertex index - pave blocks
|
||||
for (Standard_Integer j=0; j < 2; j++) {
|
||||
Standard_Integer nV = (j == 0 ? aPB->Pave1().Index() : aPB->Pave2().Index());
|
||||
BOPDS_ListOfPaveBlock *pPBList = aMVIPBs.ChangeSeek(nV);
|
||||
if (!pPBList) {
|
||||
pPBList = &aMVIPBs.ChangeFromIndex(aMVIPBs.Add(nV, BOPDS_ListOfPaveBlock()));
|
||||
}
|
||||
BOPDS_ListOfPaveBlock *pPBList = aMVIPBs.ChangeSeek(nV);
|
||||
if (!pPBList) {
|
||||
pPBList = &aMVIPBs.ChangeFromIndex(aMVIPBs.Add(nV, BOPDS_ListOfPaveBlock()));
|
||||
}
|
||||
pPBList->Append(aPB);
|
||||
if (bIsReduced) {
|
||||
aMVIToReduce.Add(nV);
|
||||
|
@@ -92,6 +92,9 @@ void BOPAlgo_PaveFiller::ProcessDE()
|
||||
//
|
||||
// 2.
|
||||
BOPDS_ListOfPaveBlock& aLPBD = myDS->ChangePaveBlocks(nE);
|
||||
Standard_ASSERT_VOID(!aLPBD.IsEmpty(), "ListOfPaveBlock is unexpectedly empty");
|
||||
if (aLPBD.IsEmpty())
|
||||
continue;
|
||||
aPBD = aLPBD.First();
|
||||
//
|
||||
FillPaves(nV, nE, nF, aLPBOut, aPBD);
|
||||
|
@@ -56,7 +56,7 @@ class BOPAlgo_ShrunkRange : public IntTools_ShrunkRange {
|
||||
//
|
||||
virtual void Perform() {
|
||||
IntTools_ShrunkRange::Perform();
|
||||
}
|
||||
}
|
||||
//
|
||||
protected:
|
||||
Handle(BOPDS_PaveBlock) myPB;
|
||||
@@ -153,6 +153,7 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
|
||||
BOPAlgo_ShrunkRangeCnt::Perform(myRunParallel, aVSD, myContext);
|
||||
//=============================================================
|
||||
//
|
||||
Standard_Real aFuzz = myFuzzyValue / 2.;
|
||||
for (k=0; k < aNbVSD; ++k) {
|
||||
BOPAlgo_ShrunkRange& aSD=aVSD(k);
|
||||
if (!aSD.IsDone()) {
|
||||
@@ -161,7 +162,8 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
|
||||
//
|
||||
Handle(BOPDS_PaveBlock)& aPB=aSD.PaveBlock();
|
||||
aSD.ShrunkRange(aTS1, aTS2);
|
||||
const Bnd_Box& aBox=aSD.BndBox();
|
||||
Bnd_Box aBox=aSD.BndBox();
|
||||
aBox.SetGap(aBox.GetGap() + aFuzz);
|
||||
Standard_Boolean bIsSplittable = aSD.IsSplittable();
|
||||
//
|
||||
aPB->SetShrunkData(aTS1, aTS2, aBox, bIsSplittable);
|
||||
|
Reference in New Issue
Block a user