1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +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:
msv
2016-11-08 15:20:42 +03:00
committed by apn
parent b2134621cc
commit 0d0481c787
50 changed files with 947 additions and 1120 deletions

View File

@@ -200,7 +200,7 @@ IntTools_BeanFaceIntersector::IntTools_BeanFaceIntersector(const BRepAdaptor_Cur
{
myCurve = theCurve;
myCriteria = myBeanTolerance + myFaceTolerance + Precision::Confusion();
myCriteria = myBeanTolerance + myFaceTolerance;
myCurveResolution = myCurve.Resolution(myCriteria);
mySurface = theSurface;
@@ -243,7 +243,7 @@ void IntTools_BeanFaceIntersector::Init(const BRepAdaptor_Curve& theCurve,
myBeanTolerance = theBeanTolerance;
myFaceTolerance = theFaceTolerance;
myCriteria = myBeanTolerance + myFaceTolerance + Precision::Confusion();
myCriteria = myBeanTolerance + myFaceTolerance;
myCurveResolution = myCurve.Resolution(myCriteria);
SetSurfaceParameters(mySurface.FirstUParameter(), mySurface.LastUParameter(),

View File

@@ -514,24 +514,25 @@ Standard_Integer IntTools_Context::ComputePE
//purpose :
//=======================================================================
Standard_Integer IntTools_Context::ComputeVE
(const TopoDS_Vertex& aV1,
const TopoDS_Edge& aE2,
Standard_Real& aParam,
Standard_Real& aTolVnew)
(const TopoDS_Vertex& theV,
const TopoDS_Edge& theE,
Standard_Real& theT,
Standard_Real& theTol,
const Standard_Real theFuzz)
{
if (BRep_Tool::Degenerated(aE2)) {
if (BRep_Tool::Degenerated(theE)) {
return -1;
}
if (!BRep_Tool::IsGeometric(aE2)) {
if (!BRep_Tool::IsGeometric(theE)) {
return -2;
}
Standard_Real aDist, aTolV1, aTolE2, aTolSum;
Standard_Real aDist, aTolV, aTolE, aTolSum;
Standard_Integer aNbProj;
gp_Pnt aP;
//
aP=BRep_Tool::Pnt(aV1);
aP=BRep_Tool::Pnt(theV);
//
GeomAPI_ProjectPointOnCurve& aProjector=ProjPC(aE2);
GeomAPI_ProjectPointOnCurve& aProjector=ProjPC(theE);
aProjector.Perform(aP);
aNbProj=aProjector.NbPoints();
@@ -541,13 +542,12 @@ Standard_Integer IntTools_Context::ComputeVE
//
aDist=aProjector.LowerDistance();
//
aTolV1=BRep_Tool::Tolerance(aV1);
aTolE2=BRep_Tool::Tolerance(aE2);
aTolSum = aTolV1 + aTolE2 + Precision::Confusion();
aTolV=BRep_Tool::Tolerance(theV);
aTolE=BRep_Tool::Tolerance(theE);
aTolSum = aTolV + aTolE + Max(theFuzz, Precision::Confusion());
//
aTolVnew=aDist+aTolE2;
//
aParam=aProjector.LowerDistanceParameter();
theTol = aDist + aTolE;
theT = aProjector.LowerDistanceParameter();
if (aDist > aTolSum) {
return -4;
}
@@ -558,19 +558,20 @@ Standard_Integer IntTools_Context::ComputeVE
//purpose :
//=======================================================================
Standard_Integer IntTools_Context::ComputeVF
(const TopoDS_Vertex& aV1,
const TopoDS_Face& aF2,
Standard_Real& U,
Standard_Real& V,
Standard_Real& aTolVnew)
(const TopoDS_Vertex& theVertex,
const TopoDS_Face& theFace,
Standard_Real& theU,
Standard_Real& theV,
Standard_Real& theTol,
const Standard_Real theFuzz)
{
Standard_Real aTolV1, aTolF2, aTolSum, aDist;
Standard_Real aTolV, aTolF, aTolSum, aDist;
gp_Pnt aP;
aP=BRep_Tool::Pnt(aV1);
aP = BRep_Tool::Pnt(theVertex);
//
// 1. Check if the point is projectable on the surface
GeomAPI_ProjectPointOnSurf& aProjector=ProjPS(aF2);
GeomAPI_ProjectPointOnSurf& aProjector=ProjPS(theFace);
aProjector.Perform(aP);
//
if (!aProjector.IsDone()) { // the point is not projectable on the surface
@@ -579,22 +580,22 @@ Standard_Integer IntTools_Context::ComputeVF
//
// 2. Check the distance between the projection point and
// the original point
aDist=aProjector.LowerDistance();
aDist = aProjector.LowerDistance();
//
aTolV1=BRep_Tool::Tolerance(aV1);
aTolF2=BRep_Tool::Tolerance(aF2);
aTolV = BRep_Tool::Tolerance(theVertex);
aTolF = BRep_Tool::Tolerance(theFace);
//
aTolSum = aTolV1 + aTolF2 + Precision::Confusion();
aTolVnew = aDist + aTolF2;
aTolSum = aTolV + aTolF + Max(theFuzz, Precision::Confusion());
theTol = aDist + aTolF;
aProjector.LowerDistanceParameters(theU, theV);
//
if (aDist > aTolSum) {
// the distance is too large
return -2;
}
aProjector.LowerDistanceParameters(U, V);
//
gp_Pnt2d aP2d(U, V);
Standard_Boolean pri=IsPointInFace (aF2, aP2d);
gp_Pnt2d aP2d(theU, theV);
Standard_Boolean pri = IsPointInFace (theFace, aP2d);
if (!pri) {// the point lays on the surface but out of the face
return -3;
}

View File

@@ -23,6 +23,7 @@
#include <BOPCol_DataMapOfTransientAddress.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Precision.hxx>
#include <MMgt_TShared.hxx>
#include <TopAbs_State.hxx>
#include <Standard_Boolean.hxx>
@@ -111,37 +112,40 @@ Standard_EXPORT virtual ~IntTools_Context();
Standard_EXPORT Standard_Integer ComputePE (const gp_Pnt& theP, const Standard_Real theTolP,
const TopoDS_Edge& theE, Standard_Real& theT,
Standard_Real& theDist);
//! Computes parameter of the vertex aV on
//! the edge aE and new increased value of vertex tolerance.
//! the edge aE and correct tolerance value for
//! the vertex on the edge.
//! Returns zero if the distance between vertex
//! and edge is less than sum of tolerances,
//! and edge is less than sum of tolerances and the fuzzy value,
//! otherwise and for following conditions returns
//! negative value: <br>
//! 1. the edge is degenerated (-1) <br>
//! 2. the edge does not contain 3d curve and pcurves (-2) <br>
//! 3. projection algorithm failed (-3)
Standard_EXPORT Standard_Integer ComputeVE (const TopoDS_Vertex& aV,
const TopoDS_Edge& aE,
Standard_Real& aParam,
Standard_Real& aTolVnew);
Standard_EXPORT Standard_Integer ComputeVE (const TopoDS_Vertex& theV,
const TopoDS_Edge& theE,
Standard_Real& theT,
Standard_Real& theTol,
const Standard_Real theFuzz = Precision::Confusion());
//! Computes UV parameters of the vertex aV on face aF
//! and new increased value of vertex tolerance.
//! and correct tolerance value for the vertex on the face.
//! Returns zero if the distance between vertex and face is
//! less than or equal the sum of tolerances and the projection
//! point lays inside boundaries of the face.
//! less than or equal the sum of tolerances and the fuzzy value
//! and the projection point lays inside boundaries of the face.
//! For following conditions returns negative value <br>
//! 1. projection algorithm failed (-1) <br>
//! 2. distance is more than sum of tolerances (-2) <br>
//! 3. projection point out or on the boundaries of face (-3)
Standard_EXPORT Standard_Integer ComputeVF (const TopoDS_Vertex& aV,
const TopoDS_Face& aF,
Standard_Real& U,
Standard_Real& V,
Standard_Real& aTolVnew);
Standard_EXPORT Standard_Integer ComputeVF (const TopoDS_Vertex& theVertex,
const TopoDS_Face& theFace,
Standard_Real& theU,
Standard_Real& theV,
Standard_Real& theTol,
const Standard_Real theFuzz = Precision::Confusion());
//! Returns the state of the point aP2D
@@ -226,7 +230,6 @@ Standard_EXPORT virtual ~IntTools_Context();
DEFINE_STANDARD_RTTIEXT(IntTools_Context,MMgt_TShared)
protected:
@@ -251,14 +254,6 @@ private:
//! Clears map of already cached projectors.
Standard_EXPORT void clearCachedPOnSProjectors();
};
#endif // _IntTools_Context_HeaderFile

View File

@@ -160,7 +160,7 @@ void IntTools_EdgeEdge::Prepare()
mySwap = Standard_True;
}
//
Standard_Real aTolAdd = Precision::Confusion() / 2.;
Standard_Real aTolAdd = myFuzzyValue / 2.;
myTol1 = myCurve1.Tolerance() + aTolAdd;
myTol2 = myCurve2.Tolerance() + aTolAdd;
myTol = myTol1 + myTol2;

View File

@@ -94,6 +94,10 @@ public:
void SetRange2(const Standard_Real aT1, const Standard_Real aT2);
//! Sets the Fuzzy value
void SetFuzzyValue (const Standard_Real theFuzz);
//! Performs the intersection between edges
Standard_EXPORT void Perform();
@@ -102,6 +106,10 @@ public:
Standard_Boolean IsDone() const;
//! Returns Fuzzy value
Standard_Real FuzzyValue() const;
//! Returns common parts
const IntTools_SequenceOfCommonPrts& CommonParts() const;
@@ -190,6 +198,7 @@ protected:
Standard_Real myTol1;
Standard_Real myTol2;
Standard_Real myTol;
Standard_Real myFuzzyValue;
Standard_Real myRes1;
Standard_Real myRes2;
Standard_Real myResCoeff1;

View File

@@ -24,6 +24,7 @@ inline IntTools_EdgeEdge::IntTools_EdgeEdge()
myTol1(0.),
myTol2(0.),
myTol(0.),
myFuzzyValue(Precision::Confusion()),
myRes1(0.),
myRes2(0.),
myResCoeff1(0.),
@@ -49,6 +50,7 @@ inline IntTools_EdgeEdge::IntTools_EdgeEdge(const TopoDS_Edge& theEdge1,
myTol1(0.),
myTol2(0.),
myTol(0.),
myFuzzyValue(Precision::Confusion()),
myRes1(0.),
myRes2(0.),
myResCoeff1(0.),
@@ -78,6 +80,7 @@ inline IntTools_EdgeEdge::IntTools_EdgeEdge(const TopoDS_Edge& theEdge1,
myTol1(0.),
myTol2(0.),
myTol(0.),
myFuzzyValue(Precision::Confusion()),
myRes1(0.),
myRes2(0.),
myResCoeff1(0.),
@@ -172,6 +175,23 @@ inline void IntTools_EdgeEdge::SetEdge2(const TopoDS_Edge& theEdge,
SetEdge2(theEdge);
SetRange2(aT1, aT2);
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
inline void IntTools_EdgeEdge::SetFuzzyValue(const Standard_Real theFuzz)
{
myFuzzyValue = Max(theFuzz, Precision::Confusion());
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
inline Standard_Real IntTools_EdgeEdge::FuzzyValue() const
{
return myFuzzyValue;
}
//=======================================================================
//function : CommonParts
//purpose :

View File

@@ -72,9 +72,8 @@ static
//=======================================================================
IntTools_EdgeFace::IntTools_EdgeFace()
{
myTolE=1.e-7;
myTolF=1.e-7;
myDiscret=30;
myFuzzyValue = Precision::Confusion();
myDiscret = 30;
myEpsT =1e-12;
myDeflection=0.01;
myIsDone=Standard_False;
@@ -115,22 +114,6 @@ void IntTools_EdgeFace::SetFace(const TopoDS_Face& aFace)
myFace=aFace;
}
//=======================================================================
//function : SetTolE
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetTolE(const Standard_Real aTol)
{
myTolE=aTol;
}
//=======================================================================
//function : SetTolF
//purpose :
//=======================================================================
void IntTools_EdgeFace::SetTolF(const Standard_Real aTol)
{
myTolF=aTol;
}
//=======================================================================
//function : Edge
//purpose :
//=======================================================================
@@ -147,21 +130,13 @@ const TopoDS_Face& IntTools_EdgeFace::Face()const
return myFace;
}
//=======================================================================
//function : TolE
//function : SetFuzzyValue
//purpose :
//=======================================================================
Standard_Real IntTools_EdgeFace::TolE()const
void IntTools_EdgeFace::SetFuzzyValue(const Standard_Real theFuzz)
{
return myTolE;
myFuzzyValue = Max(theFuzz, Precision::Confusion());
}
//=======================================================================
//function : TolF
//purpose :
//=======================================================================
Standard_Real IntTools_EdgeFace::TolF()const
{
return myTolF;
}
//=======================================================================
//function : SetDiscretize
//purpose :
@@ -345,12 +320,15 @@ void IntTools_EdgeFace::Prepare()
aCurveType=myC.GetType();
//
// 2.Prepare myCriteria
if (aCurveType==GeomAbs_BSplineCurve||
aCurveType==GeomAbs_BezierCurve) {
myCriteria=1.5*myTolE+myTolF;
Standard_Real aFuzz = myFuzzyValue / 2.;
Standard_Real aTolF = BRep_Tool::Tolerance(myFace) + aFuzz;
Standard_Real aTolE = BRep_Tool::Tolerance(myEdge) + aFuzz;
if (aCurveType == GeomAbs_BSplineCurve ||
aCurveType == GeomAbs_BezierCurve) {
myCriteria = 1.5*aTolE + aTolF;
}
else {
myCriteria = myTolE + myTolF + Precision::Confusion();
myCriteria = aTolE + aTolF;
}
// 2.a myTmin, myTmax
aTmin=myRange.First();
@@ -820,19 +798,22 @@ void IntTools_EdgeFace::Perform()
aCurveType=myC.GetType();
//
// Prepare myCriteria
if (aCurveType==GeomAbs_BSplineCurve||
Standard_Real aFuzz = myFuzzyValue / 2.;
Standard_Real aTolF = BRep_Tool::Tolerance(myFace) + aFuzz;
Standard_Real aTolE = BRep_Tool::Tolerance(myEdge) + aFuzz;
if (aCurveType == GeomAbs_BSplineCurve ||
aCurveType==GeomAbs_BezierCurve) {
//--- 5112
Standard_Real diff1 = (myTolE/myTolF);
Standard_Real diff2 = (myTolF/myTolE);
Standard_Real diff1 = (aTolE/aTolF);
Standard_Real diff2 = (aTolF/aTolE);
if( diff1 > 100 || diff2 > 100 ) {
myCriteria = Max(myTolE,myTolF);
myCriteria = Max(aTolE,aTolF);
}
else //--- 5112
myCriteria=1.5*myTolE+myTolF;
myCriteria = 1.5*aTolE + aTolF;
}
else {
myCriteria = myTolE + myTolF + Precision::Confusion();
myCriteria = aTolE + aTolF;
}
myS.Initialize (myFace,Standard_True);
@@ -852,7 +833,7 @@ void IntTools_EdgeFace::Perform()
}
}
//
IntTools_BeanFaceIntersector anIntersector(myC, myS, myTolE, myTolF);
IntTools_BeanFaceIntersector anIntersector(myC, myS, aTolE, aTolF);
anIntersector.SetBeanParameters(myRange.First(), myRange.Last());
//
anIntersector.SetContext(myContext);

View File

@@ -61,18 +61,10 @@ public:
Standard_EXPORT void SetEdge (const TopoDS_Edge& anEdge);
//! Initializes algorithm by edge tolerance
Standard_EXPORT void SetTolE (const Standard_Real aTolEdge1);
//! Initializes algorithm by the face aFace
Standard_EXPORT void SetFace (const TopoDS_Face& aFace);
//! Initializes algorithm by face tolerance
Standard_EXPORT void SetTolF (const Standard_Real aTolFace);
//! Returns edge
Standard_EXPORT const TopoDS_Edge& Edge() const;
@@ -81,14 +73,6 @@ public:
Standard_EXPORT const TopoDS_Face& Face() const;
//! Returns tolerance of the edge
Standard_EXPORT Standard_Real TolE() const;
//! Returns tolerance of the face
Standard_EXPORT Standard_Real TolF() const;
//! Initializes algorithm by discretization value
Standard_EXPORT void SetDiscretize (const Standard_Integer aDiscret);
@@ -117,6 +101,14 @@ public:
//! Gets the intersecton context
Standard_EXPORT const Handle(IntTools_Context)& Context() const;
//! Sets the Fuzzy value
Standard_EXPORT void SetFuzzyValue(const Standard_Real theFuzz);
//! Returns Fuzzy value
Standard_Real FuzzyValue() const
{
return myFuzzyValue;
}
//! Launches the process
Standard_EXPORT void Perform();
@@ -184,8 +176,7 @@ private:
TopoDS_Edge myEdge;
TopoDS_Face myFace;
Standard_Real myTolE;
Standard_Real myTolF;
Standard_Real myFuzzyValue;
Standard_Integer myDiscret;
Standard_Real myEpsT;
Standard_Real myDeflection;

View File

@@ -56,9 +56,9 @@
#include <gp_Elips.hxx>
static
void TolR3d(const TopoDS_Face& ,
const TopoDS_Face& ,
Standard_Real& );
void TolR3d(const Standard_Real aTolF1,
const Standard_Real aTolF2,
Standard_Real& myTolReached3d);
static
void Parameters(const Handle(GeomAdaptor_HSurface)&,
@@ -84,6 +84,7 @@ static
const TopoDS_Face& theFace2,
const Standard_Real theOtherParameter,
const Standard_Boolean bIncreasePar,
const Standard_Real theTol,
Standard_Real& theNewParameter,
const Handle(IntTools_Context)& );
@@ -174,8 +175,11 @@ IntTools_FaceFace::IntTools_FaceFace()
myTolReached2d=0.;
myTolReached3d=0.;
myTolReal = 0.;
myTolF1 = 0.;
myTolF2 = 0.;
myTol = 0.;
myFuzzyValue = Precision::Confusion();
SetParameters(Standard_True, Standard_True, Standard_True, 1.e-07);
}
//=======================================================================
//function : SetContext
@@ -282,6 +286,23 @@ void IntTools_FaceFace::SetParameters(const Standard_Boolean ToApproxC3d,
myApprox2 = ToApproxC2dOnS2;
myTolApprox = ApproximationTolerance;
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
void IntTools_FaceFace::SetFuzzyValue(const Standard_Real theFuzz)
{
myFuzzyValue = Max(theFuzz, Precision::Confusion());
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
Standard_Real IntTools_FaceFace::FuzzyValue() const
{
return myFuzzyValue;
}
//=======================================================================
//function : SetList
//purpose :
@@ -293,12 +314,10 @@ void IntTools_FaceFace::SetList(IntSurf_ListOfPntOn2S& aListOfPnts)
static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
const TopoDS_Face& theF2)
const TopoDS_Face& theF2,
const Standard_Real theTol)
{
const Standard_Real Tolang = 1.e-8;
const Standard_Real aTolF1=BRep_Tool::Tolerance(theF1);
const Standard_Real aTolF2=BRep_Tool::Tolerance(theF2);
const Standard_Real aTolSum = aTolF1 + aTolF2 + Precision::Confusion();
Standard_Real aHigh = 0.0;
const BRepAdaptor_Surface aBAS1(theF1), aBAS2(theF2);
@@ -351,7 +370,7 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
}
IntAna_QuadQuadGeo inter;
inter.Perform(aS1,aS2,Tolang,aTolSum, aHigh);
inter.Perform(aS1,aS2,Tolang,theTol, aHigh);
if(inter.TypeInter() == IntAna_Ellipse)
{
const gp_Elips anEl = inter.Ellipse(1);
@@ -424,10 +443,12 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
const Handle(Geom_Surface) S1=BRep_Tool::Surface(myFace1);
const Handle(Geom_Surface) S2=BRep_Tool::Surface(myFace2);
const Standard_Real aTolF1=BRep_Tool::Tolerance(myFace1);
const Standard_Real aTolF2=BRep_Tool::Tolerance(myFace2);
Standard_Real aFuzz = myFuzzyValue / 2.;
myTolF1 = BRep_Tool::Tolerance(myFace1) + aFuzz;
myTolF2 = BRep_Tool::Tolerance(myFace2) + aFuzz;
myTol = myTolF1 + myTolF2;
Standard_Real TolArc = aTolF1 + aTolF2 + Precision::Confusion();
Standard_Real TolArc = myTol;
Standard_Real TolTang = TolArc;
const Standard_Boolean isFace1Quad = (aType1 == GeomAbs_Cylinder ||
@@ -452,7 +473,7 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
Standard_Real TolAng = 1.e-8;
//
PerformPlanes(myHS1, myHS2,
aTolF1, aTolF2, TolAng, TolTang,
myTolF1, myTolF2, TolAng, TolTang,
myApprox1, myApprox2,
mySeqOfCurve, myTangentFaces, myTolReached3d);
//
@@ -462,7 +483,7 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
const Standard_Integer NbLinPP = mySeqOfCurve.Length();
if(NbLinPP) {
Standard_Real aTolFMax;
aTolFMax=Max(aTolF1, aTolF2);
aTolFMax=Max(myTolF1, myTolF2);
myTolReal = Precision::Confusion();
if (aTolFMax > myTolReal) {
myTolReal = aTolFMax;
@@ -498,7 +519,7 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
// F2
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace2, (aTolF1 + aTolF2) * 2., umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace2, myTol * 2., umin, umax, vmin, vmax);
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
}
else if ((aType2==GeomAbs_Plane) && isFace1Quad)
@@ -506,7 +527,7 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
Standard_Real umin, umax, vmin, vmax;
//F1
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace1, (aTolF1 + aTolF2) * 2., umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace1, myTol * 2., umin, umax, vmin, vmax);
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
// F2
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
@@ -517,10 +538,10 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
{
Standard_Real umin, umax, vmin, vmax;
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace1, (aTolF1 + aTolF2) * 2., umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace1, myTol * 2., umin, umax, vmin, vmax);
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace2, (aTolF1 + aTolF2) * 2., umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace2, myTol * 2., umin, umax, vmin, vmax);
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
}
@@ -605,7 +626,7 @@ void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
}
#endif
const Standard_Boolean isGeomInt = isTreatAnalityc(aF1, aF2);
const Standard_Boolean isGeomInt = isTreatAnalityc(aF1, aF2, myTol);
myIntersector.Perform(myHS1, dom1, myHS2, dom2, TolArc, TolTang,
myListOfPnts, RestrictLine, isGeomInt);
@@ -909,7 +930,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
//
// myTolReached3d
if (typl == IntPatch_Lin) {
TolR3d (myFace1, myFace2, myTolReached3d);
TolR3d (myTolF1, myTolF2, myTolReached3d);
}
//
aNbParts=myLConstruct.NbParts();
@@ -928,12 +949,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
Handle(Geom_TrimmedCurve) aCT3D=new Geom_TrimmedCurve(newc, fprm, lprm);
aCurve.SetCurve(aCT3D);
if (typl == IntPatch_Parabola) {
Standard_Real aTolF1, aTolF2, aTolBase;
aTolF1 = BRep_Tool::Tolerance(myFace1);
aTolF2 = BRep_Tool::Tolerance(myFace2);
aTolBase=aTolF1+aTolF2;
myTolReached3d=IntTools_Tools::CurveTolerance(aCT3D, aTolBase);
myTolReached3d=IntTools_Tools::CurveTolerance(aCT3D, myTol);
}
//
aCurve.SetCurve(new Geom_TrimmedCurve(newc, fprm, lprm));
@@ -1035,7 +1051,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
}
//
// myTolReached3d
TolR3d (myFace1, myFace2, myTolReached3d);
TolR3d (myTolF1, myTolF2, myTolReached3d);
//
aNbParts=myLConstruct.NbParts();
//
@@ -1060,14 +1076,14 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
else {
gp_Pnt P1 = newc->Value(fprm);
gp_Pnt P2 = newc->Value(aPeriod);
Standard_Real aTolDist = BRep_Tool::Tolerance(myFace1) + BRep_Tool::Tolerance(myFace2);
Standard_Real aTolDist = myTol;
aTolDist = (myTolReached3d > aTolDist) ? myTolReached3d : aTolDist;
if(P1.Distance(P2) > aTolDist) {
Standard_Real anewpar = fprm;
if(ParameterOutOfBoundary(fprm, newc, myFace1, myFace2,
lprm, Standard_False, anewpar, myContext)) {
lprm, Standard_False, myTol, anewpar, myContext)) {
fprm = anewpar;
}
aSeqFprm.Append(fprm);
@@ -1083,14 +1099,14 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
else {
gp_Pnt P1 = newc->Value(aNul);
gp_Pnt P2 = newc->Value(lprm);
Standard_Real aTolDist = BRep_Tool::Tolerance(myFace1) + BRep_Tool::Tolerance(myFace2);
Standard_Real aTolDist = myTol;
aTolDist = (myTolReached3d > aTolDist) ? myTolReached3d : aTolDist;
if(P1.Distance(P2) > aTolDist) {
Standard_Real anewpar = lprm;
if(ParameterOutOfBoundary(lprm, newc, myFace1, myFace2,
fprm, Standard_True, anewpar, myContext)) {
fprm, Standard_True, myTol, anewpar, myContext)) {
lprm = anewpar;
}
aSeqFprm.Append(aNul);
@@ -1387,6 +1403,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
myFace2,
myLConstruct,
bAvoidLineConstructor,
myTol,
aSeqOfL,
aReachedTol,
myContext);
@@ -2225,15 +2242,13 @@ Handle(Geom_Curve) MakeBSpline (const Handle(IntPatch_WLine)& WL,
//function : TolR3d
//purpose :
//=======================================================================
void TolR3d(const TopoDS_Face& aF1,
const TopoDS_Face& aF2,
void TolR3d(const Standard_Real aTolF1,
const Standard_Real aTolF2,
Standard_Real& myTolReached3d)
{
Standard_Real aTolF1, aTolF2, aTolFMax, aTolTresh;
Standard_Real aTolFMax, aTolTresh;
aTolTresh=2.999999e-3;
aTolF1 = BRep_Tool::Tolerance(aF1);
aTolF2 = BRep_Tool::Tolerance(aF2);
aTolFMax=Max(aTolF1, aTolF2);
if (aTolFMax>aTolTresh) {
@@ -2252,6 +2267,7 @@ Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
const TopoDS_Face& theFace2,
const Standard_Real theOtherParameter,
const Standard_Boolean bIncreasePar,
const Standard_Real theTol,
Standard_Real& theNewParameter,
const Handle(IntTools_Context)& aContext)
{
@@ -2261,7 +2277,7 @@ Standard_Boolean ParameterOutOfBoundary(const Standard_Real theParameter,
Standard_Real acurpar = theParameter;
TopAbs_State aState = TopAbs_ON;
Standard_Integer iter = 0;
Standard_Real asumtol = BRep_Tool::Tolerance(theFace1) + BRep_Tool::Tolerance(theFace2);
Standard_Real asumtol = theTol;
Standard_Real adelta = asumtol * 0.1;
adelta = (adelta < Precision::Confusion()) ? Precision::Confusion() : adelta;
Handle(Geom_Surface) aSurf1 = BRep_Tool::Surface(theFace1);

View File

@@ -110,7 +110,13 @@ public:
//! Sets the intersecton context
Standard_EXPORT void SetContext (const Handle(IntTools_Context)& aContext);
//! Sets the Fuzzy value
void SetFuzzyValue (const Standard_Real theFuzz);
//! Returns Fuzzy value
Standard_Real FuzzyValue() const;
//! Gets the intersecton context
Standard_EXPORT const Handle(IntTools_Context)& Context() const;
@@ -150,6 +156,10 @@ private:
Standard_Boolean myApprox1;
Standard_Boolean myApprox2;
Standard_Real myTolApprox;
Standard_Real myTolF1;
Standard_Real myTolF2;
Standard_Real myTol;
Standard_Real myFuzzyValue;
IntTools_SequenceOfCurves mySeqOfCurve;
Standard_Boolean myTangentFaces;
TopoDS_Face myFace1;

View File

@@ -805,7 +805,7 @@ Standard_Boolean IntTools_Tools::ComputeTolerance
//e.g. after trimming) we will be able to come
//to the more precise minimum point. As result, this curve with the
//tolerance computed earlier will become invalid.
const Standard_Real anEps = (1.0+1.0e-7);
const Standard_Real anEps = (1.0+1.0e-5);
theMaxDist = anEps*aCS.MaxDistance();
theMaxPar = aCS.MaxParameter();
//

View File

@@ -730,6 +730,7 @@ Standard_Boolean IntTools_WLineTool::
const TopoDS_Face& theFace2,
const GeomInt_LineConstructor& theLConstructor,
const Standard_Boolean theAvoidLConstructor,
const Standard_Real theTol,
IntPatch_SequenceOfLine& theNewLines,
Standard_Real& theReachedTol3d,
const Handle(IntTools_Context)& aContext)
@@ -1206,7 +1207,7 @@ Standard_Boolean IntTools_WLineTool::
if(found) {
// check point
Standard_Real aCriteria = BRep_Tool::Tolerance(theFace1) + BRep_Tool::Tolerance(theFace2);
Standard_Real aCriteria = theTol;
GeomAPI_ProjectPointOnSurf& aProjector =
(surfit == 0) ? aContext->ProjPS(theFace2) : aContext->ProjPS(theFace1);
Handle(GeomAdaptor_HSurface) aSurface = (surfit == 0) ? theSurface1 : theSurface2;

View File

@@ -46,6 +46,7 @@ public:
const TopoDS_Face& theFace2,
const GeomInt_LineConstructor& theLConstructor,
const Standard_Boolean theAvoidLConstructor,
const Standard_Real theTol,
IntPatch_SequenceOfLine& theNewLines,
Standard_Real& theReachedTol3d,
const Handle(IntTools_Context)& );