mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0028909: Algorithm of BO is stuck while fusing shell and edges
Approximation parameters: degmin, degmax, max number of segments, boundary condition, maximal distance of projecting are added in interface of classes ProjLib_ProjectedCurve, ProjLib_ComputeApprox, ProjLib_ComputeApproxOnPolarSurface Algorithm of Approx/Approx_ComputeCLine is modified in order to treat maximal number of segments allowed for cutting. Algorithm of method BOPTools_AlgoTools2D::MakePCurveOnFace(...) is modified in order to manage cases with big edge tolerances. Test case added Some test cases were modified according to new behavior of algorithms
This commit is contained in:
@@ -50,6 +50,7 @@ Approx_ComputeCLine::Approx_ComputeCLine
|
||||
mycut = cutting;
|
||||
myfirstC = FirstC;
|
||||
mylastC = LastC;
|
||||
myMaxSegments = IntegerLast();
|
||||
alldone = Standard_False;
|
||||
Perform(Line);
|
||||
}
|
||||
@@ -76,6 +77,7 @@ Approx_ComputeCLine::Approx_ComputeCLine
|
||||
mycut = cutting;
|
||||
myfirstC = FirstC;
|
||||
mylastC = LastC;
|
||||
myMaxSegments = IntegerLast();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -91,9 +93,11 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
||||
Standard_Real thetol3d = Precision::Confusion(), thetol2d = Precision::Confusion();
|
||||
UFirst = Line.FirstParameter();
|
||||
ULast = Line.LastParameter();
|
||||
Standard_Real TolU = (ULast-UFirst)*1.e-05;
|
||||
Standard_Real TolU = Max((ULast-UFirst)*1.e-05, Precision::PApproximation());
|
||||
Standard_Real myfirstU = UFirst;
|
||||
Standard_Real mylastU = ULast;
|
||||
Standard_Integer aMaxSegments = 0;
|
||||
Standard_Integer aMaxSegments1 = myMaxSegments - 1;
|
||||
|
||||
if (!mycut)
|
||||
{
|
||||
@@ -126,7 +130,8 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
||||
// Calcul de la partie a approximer.
|
||||
myfirstU = mylastU;
|
||||
mylastU = ULast;
|
||||
if (Abs(ULast-myfirstU) <= RealEpsilon())
|
||||
if (Abs(ULast-myfirstU) <= RealEpsilon()
|
||||
|| aMaxSegments >= myMaxSegments)
|
||||
{
|
||||
Finish = Standard_True;
|
||||
alldone = Standard_True;
|
||||
@@ -155,11 +160,15 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
||||
|
||||
// Calcul des parametres sur ce nouvel intervalle.
|
||||
Ok = Compute(Line, myfirstU, mylastU, thetol3d, thetol2d);
|
||||
if(Ok)
|
||||
{
|
||||
aMaxSegments++;
|
||||
}
|
||||
|
||||
//cout << myfirstU << " - " << mylastU << " tol : " << thetol3d << " " << thetol2d << endl;
|
||||
|
||||
// is new decision better?
|
||||
if (!Ok && Abs(myfirstU-mylastU) <= TolU)
|
||||
if (!Ok && (Abs(myfirstU-mylastU) <= TolU || aMaxSegments >= aMaxSegments1))
|
||||
{
|
||||
Ok = Standard_True; // stop interval cutting, approx the rest part
|
||||
|
||||
@@ -176,6 +185,7 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
||||
|
||||
tolreached = Standard_False; // helas
|
||||
myMultiCurves.Append(KeptMultiCurve);
|
||||
aMaxSegments++;
|
||||
Tolers3d.Append (KeptT3d);
|
||||
Tolers2d.Append (KeptT2d);
|
||||
myfirstparam.Append (KeptUfirst);
|
||||
@@ -303,6 +313,16 @@ void Approx_ComputeCLine::SetConstraints(const AppParCurves_Constraint FirstC,
|
||||
mylastC = LastC;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMaxSegments
|
||||
//purpose : Changes the max number of segments, which is allowed for cutting.
|
||||
//=======================================================================
|
||||
|
||||
void Approx_ComputeCLine:: SetMaxSegments(const Standard_Integer theMaxSegments)
|
||||
{
|
||||
myMaxSegments = theMaxSegments;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsAllApproximated
|
||||
//purpose : returns False if at a moment of the approximation,
|
||||
|
@@ -60,6 +60,9 @@ public:
|
||||
|
||||
//! Changes the constraints of the approximation.
|
||||
Standard_EXPORT void SetConstraints (const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC);
|
||||
|
||||
//! Changes the max number of segments, which is allowed for cutting.
|
||||
Standard_EXPORT void SetMaxSegments (const Standard_Integer theMaxSegments);
|
||||
|
||||
//! returns False if at a moment of the approximation,
|
||||
//! the status NoApproximation has been sent by the user
|
||||
@@ -114,6 +117,7 @@ private:
|
||||
Standard_Boolean mycut;
|
||||
AppParCurves_Constraint myfirstC;
|
||||
AppParCurves_Constraint mylastC;
|
||||
Standard_Integer myMaxSegments;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -60,6 +60,9 @@ public:
|
||||
|
||||
//! Changes the constraints of the approximation.
|
||||
Standard_EXPORT void SetConstraints (const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC);
|
||||
|
||||
//! Changes the max number of segments, which is allowed for cutting.
|
||||
Standard_EXPORT void SetMaxSegments (const Standard_Integer theMaxSegments);
|
||||
|
||||
//! returns False if at a moment of the approximation,
|
||||
//! the status NoApproximation has been sent by the user
|
||||
@@ -114,6 +117,7 @@ private:
|
||||
Standard_Boolean mycut;
|
||||
AppParCurves_Constraint myfirstC;
|
||||
AppParCurves_Constraint mylastC;
|
||||
Standard_Integer myMaxSegments;
|
||||
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user