mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0031470: Modeling Algorithms - Regression: BOP common produces empty result (box and holed sphere)
Approx_ComputeCLine.gxx : new class field is added to manage hang checking. ProjLib/ProjLib_ComputeApprox.cxx : unset hang checking for analytical surfaces and curves
This commit is contained in:
parent
a28d897290
commit
e44cf1e4da
@ -54,6 +54,7 @@ const AppParCurves_Constraint LastC)
|
|||||||
mylastC = LastC;
|
mylastC = LastC;
|
||||||
myMaxSegments = MAXSEGM;
|
myMaxSegments = MAXSEGM;
|
||||||
myInvOrder = Standard_True;
|
myInvOrder = Standard_True;
|
||||||
|
myHangChecking = Standard_True;
|
||||||
alldone = Standard_False;
|
alldone = Standard_False;
|
||||||
Perform(Line);
|
Perform(Line);
|
||||||
}
|
}
|
||||||
@ -82,6 +83,7 @@ const AppParCurves_Constraint LastC)
|
|||||||
mylastC = LastC;
|
mylastC = LastC;
|
||||||
myMaxSegments = MAXSEGM;
|
myMaxSegments = MAXSEGM;
|
||||||
myInvOrder = Standard_True;
|
myInvOrder = Standard_True;
|
||||||
|
myHangChecking = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -97,7 +99,15 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
|||||||
Standard_Real thetol3d = Precision::Confusion(), thetol2d = Precision::Confusion();
|
Standard_Real thetol3d = Precision::Confusion(), thetol2d = Precision::Confusion();
|
||||||
UFirst = Line.FirstParameter();
|
UFirst = Line.FirstParameter();
|
||||||
ULast = Line.LastParameter();
|
ULast = Line.LastParameter();
|
||||||
Standard_Real TolU = Max((ULast - UFirst)*1.e-03, Precision::Confusion());
|
Standard_Real TolU = 0.;
|
||||||
|
if (myHangChecking)
|
||||||
|
{
|
||||||
|
TolU = Max((ULast - UFirst)*1.e-03, Precision::Confusion());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TolU = Max((ULast - UFirst)*1.e-05, Precision::PApproximation());
|
||||||
|
}
|
||||||
Standard_Real myfirstU = UFirst;
|
Standard_Real myfirstU = UFirst;
|
||||||
Standard_Real mylastU = ULast;
|
Standard_Real mylastU = ULast;
|
||||||
Standard_Integer aMaxSegments = 0;
|
Standard_Integer aMaxSegments = 0;
|
||||||
@ -176,7 +186,7 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
|
|||||||
|
|
||||||
//cout << myfirstU << " - " << mylastU << " tol : " << thetol3d << " " << thetol2d << endl;
|
//cout << myfirstU << " - " << mylastU << " tol : " << thetol3d << " " << thetol2d << endl;
|
||||||
Standard_Boolean aStopCutting = Standard_False;
|
Standard_Boolean aStopCutting = Standard_False;
|
||||||
if (aNbCut >= aNbComp)
|
if (myHangChecking && aNbCut >= aNbComp)
|
||||||
{
|
{
|
||||||
if (aNbCut > aNbImp + 1)
|
if (aNbCut > aNbImp + 1)
|
||||||
{
|
{
|
||||||
@ -434,6 +444,15 @@ void Approx_ComputeCLine::SetInvOrder(const Standard_Boolean theInvOrder)
|
|||||||
myInvOrder = theInvOrder;
|
myInvOrder = theInvOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetHangChecking
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void Approx_ComputeCLine::SetHangChecking(const Standard_Boolean theHangChecking)
|
||||||
|
{
|
||||||
|
myHangChecking = theHangChecking;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : IsAllApproximated
|
//function : IsAllApproximated
|
||||||
//purpose : returns False if at a moment of the approximation,
|
//purpose : returns False if at a moment of the approximation,
|
||||||
|
@ -70,6 +70,12 @@ public:
|
|||||||
//! By default inverse order is used.
|
//! By default inverse order is used.
|
||||||
Standard_EXPORT void SetInvOrder(const Standard_Boolean theInvOrder);
|
Standard_EXPORT void SetInvOrder(const Standard_Boolean theInvOrder);
|
||||||
|
|
||||||
|
//! Set value of hang checking flag
|
||||||
|
//! if this flag = true, possible hang of algorithm is checked
|
||||||
|
//! and algorithm is forced to stop.
|
||||||
|
//! By default hang checking is used.
|
||||||
|
Standard_EXPORT void SetHangChecking(const Standard_Boolean theHangChecking);
|
||||||
|
|
||||||
//! returns False if at a moment of the approximation,
|
//! returns False if at a moment of the approximation,
|
||||||
//! the status NoApproximation has been sent by the user
|
//! the status NoApproximation has been sent by the user
|
||||||
//! when more points were needed.
|
//! when more points were needed.
|
||||||
@ -125,6 +131,7 @@ private:
|
|||||||
AppParCurves_Constraint mylastC;
|
AppParCurves_Constraint mylastC;
|
||||||
Standard_Integer myMaxSegments;
|
Standard_Integer myMaxSegments;
|
||||||
Standard_Boolean myInvOrder;
|
Standard_Boolean myInvOrder;
|
||||||
|
Standard_Boolean myHangChecking;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -70,6 +70,12 @@ public:
|
|||||||
//! By default inverse order is used.
|
//! By default inverse order is used.
|
||||||
Standard_EXPORT void SetInvOrder(const Standard_Boolean theInvOrder);
|
Standard_EXPORT void SetInvOrder(const Standard_Boolean theInvOrder);
|
||||||
|
|
||||||
|
//! Set value of hang checking flag
|
||||||
|
//! if this flag = true, possible hang of algorithm is checked
|
||||||
|
//! and algorithm is forced to stop.
|
||||||
|
//! By default hang checking is used.
|
||||||
|
Standard_EXPORT void SetHangChecking(const Standard_Boolean theHangChecking);
|
||||||
|
|
||||||
//! returns False if at a moment of the approximation,
|
//! returns False if at a moment of the approximation,
|
||||||
//! the status NoApproximation has been sent by the user
|
//! the status NoApproximation has been sent by the user
|
||||||
//! when more points were needed.
|
//! when more points were needed.
|
||||||
@ -125,6 +131,7 @@ private:
|
|||||||
AppParCurves_Constraint mylastC;
|
AppParCurves_Constraint mylastC;
|
||||||
Standard_Integer myMaxSegments;
|
Standard_Integer myMaxSegments;
|
||||||
Standard_Boolean myInvOrder;
|
Standard_Boolean myInvOrder;
|
||||||
|
Standard_Boolean myHangChecking;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -70,6 +70,12 @@ public:
|
|||||||
//! By default inverse order is used.
|
//! By default inverse order is used.
|
||||||
Standard_EXPORT void SetInvOrder(const Standard_Boolean theInvOrder);
|
Standard_EXPORT void SetInvOrder(const Standard_Boolean theInvOrder);
|
||||||
|
|
||||||
|
//! Set value of hang checking flag
|
||||||
|
//! if this flag = true, possible hang of algorithm is checked
|
||||||
|
//! and algorithm is forced to stop.
|
||||||
|
//! By default hang checking is used.
|
||||||
|
Standard_EXPORT void SetHangChecking(const Standard_Boolean theHangChecking);
|
||||||
|
|
||||||
//! returns False if at a moment of the approximation,
|
//! returns False if at a moment of the approximation,
|
||||||
//! the status NoApproximation has been sent by the user
|
//! the status NoApproximation has been sent by the user
|
||||||
//! when more points were needed.
|
//! when more points were needed.
|
||||||
@ -125,6 +131,7 @@ private:
|
|||||||
AppParCurves_Constraint mylastC;
|
AppParCurves_Constraint mylastC;
|
||||||
Standard_Integer myMaxSegments;
|
Standard_Integer myMaxSegments;
|
||||||
Standard_Boolean myInvOrder;
|
Standard_Boolean myInvOrder;
|
||||||
|
Standard_Boolean myHangChecking;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1156,6 +1156,10 @@ void ProjLib_ComputeApprox::Perform
|
|||||||
|
|
||||||
Approx_FitAndDivide2d Fit(Deg1, Deg2, myTolerance, aTol2d, Standard_True, aFistC, aLastC);
|
Approx_FitAndDivide2d Fit(Deg1, Deg2, myTolerance, aTol2d, Standard_True, aFistC, aLastC);
|
||||||
Fit.SetMaxSegments(aMaxSegments);
|
Fit.SetMaxSegments(aMaxSegments);
|
||||||
|
if (simplecase)
|
||||||
|
{
|
||||||
|
Fit.SetHangChecking(Standard_False);
|
||||||
|
}
|
||||||
Fit.Perform(F);
|
Fit.Perform(F);
|
||||||
|
|
||||||
Standard_Real aNewTol2d = 0;
|
Standard_Real aNewTol2d = 0;
|
||||||
|
36
tests/bugs/modalg_7/bug31470
Normal file
36
tests/bugs/modalg_7/bug31470
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
puts "================================================================="
|
||||||
|
puts "OCC31470: BOP common produces empty result (box and holed sphere)"
|
||||||
|
puts "================================================================="
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
plane pln1 51.899912462 99.996691888 62.33204004
|
||||||
|
psphere s1 pln1 15
|
||||||
|
psphere s2 pln1 10
|
||||||
|
bcut ss s1 s2
|
||||||
|
box bb 100 100 100
|
||||||
|
|
||||||
|
bcommon result bb ss
|
||||||
|
savehistory hh
|
||||||
|
|
||||||
|
explode ss f
|
||||||
|
modified ff hh ss_1
|
||||||
|
generated ee hh ss_1
|
||||||
|
|
||||||
|
checkshape result
|
||||||
|
|
||||||
|
checknbshapes result -solid 1 -shell 1 -face 3 -wire 6 -edge 8 -vertex 6
|
||||||
|
|
||||||
|
set tolres [checkmaxtol result]
|
||||||
|
|
||||||
|
if { ${tolres} > 2.e-7} {
|
||||||
|
puts "Error: bad tolerance of result"
|
||||||
|
}
|
||||||
|
|
||||||
|
checkprops result -v 4975.49
|
||||||
|
|
||||||
|
v2d
|
||||||
|
pcurve pc ee ff
|
||||||
|
trim pc pc
|
||||||
|
2dfit
|
||||||
|
|
||||||
|
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
Loading…
x
Reference in New Issue
Block a user