mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0026627: [Regression] Shape Healing hangs as of OCC 6.8.0
Check for orientation of the solid corrected to ensure that cycle always finishes. Test case added: bugs modalg_6 bug26627 Tests boolean volumemaker A3, B5, B7 corrected (improvements)
This commit is contained in:
parent
27af30526d
commit
79e9ce0ec2
@ -33,6 +33,8 @@
|
|||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopoDS_Face.hxx>
|
#include <TopoDS_Face.hxx>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
// modified by NIZHNY-MKK Mon Jun 21 15:13:40 2004
|
// modified by NIZHNY-MKK Mon Jun 21 15:13:40 2004
|
||||||
static
|
static
|
||||||
Standard_Boolean FaceNormal (const TopoDS_Face& aF,
|
Standard_Boolean FaceNormal (const TopoDS_Face& aF,
|
||||||
@ -103,72 +105,76 @@ void BRepClass3d_SClassifier::PerformInfinitePoint(BRepClass3d_SolidExplorer& aS
|
|||||||
myFace.Nullify();
|
myFace.Nullify();
|
||||||
myState=2;
|
myState=2;
|
||||||
|
|
||||||
aSE.InitShell();
|
// Collect faces in sequence to iterate
|
||||||
if (aSE.MoreShell())
|
std::vector<TopoDS_Face> aFaces;
|
||||||
|
for (aSE.InitShell(); aSE.MoreShell(); aSE.NextShell())
|
||||||
{
|
{
|
||||||
aSE.InitFace();
|
for (aSE.InitFace(); aSE.MoreFace(); aSE.NextFace())
|
||||||
if (aSE.MoreFace())
|
|
||||||
{
|
{
|
||||||
TopoDS_Face aF = aSE.CurrentFace();
|
aFaces.push_back (aSE.CurrentFace());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// iteratively try up to 10 probing points from each face
|
||||||
|
const int NB_MAX_POINTS_PER_FACE = 10;
|
||||||
|
for (int itry = 0; itry < NB_MAX_POINTS_PER_FACE; itry++)
|
||||||
|
{
|
||||||
|
for (std::vector<TopoDS_Face>::iterator iFace = aFaces.begin(); iFace != aFaces.end(); ++iFace)
|
||||||
|
{
|
||||||
|
TopoDS_Face aF = *iFace;
|
||||||
|
|
||||||
TopAbs_State aState = TopAbs_OUT;
|
TopAbs_State aState = TopAbs_OUT;
|
||||||
IntCurveSurface_TransitionOnCurve aTransition = IntCurveSurface_Tangent;
|
IntCurveSurface_TransitionOnCurve aTransition = IntCurveSurface_Tangent;
|
||||||
TopoDS_Face MinFace = aF;
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
aParam = 0.1 + 0.8 * aRandomGenerator.NextReal(); // random number in range [0.1, 0.9]
|
|
||||||
bFound = aSE.FindAPointInTheFace(aF, aPoint, aU, aV, aParam);
|
|
||||||
if (!bFound)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!FaceNormal(aF, aU, aV, aDN))
|
aParam = 0.1 + 0.8 * aRandomGenerator.NextReal(); // random number in range [0.1, 0.9]
|
||||||
continue;
|
bFound = aSE.FindAPointInTheFace(aF, aPoint, aU, aV, aParam);
|
||||||
gp_Lin aLin(aPoint, -aDN);
|
if (!bFound || !FaceNormal(aF, aU, aV, aDN))
|
||||||
Standard_Real parmin = RealLast();
|
continue;
|
||||||
for (aSE.InitShell();aSE.MoreShell();aSE.NextShell()) {
|
|
||||||
if (aSE.RejectShell(aLin) == Standard_False) {
|
gp_Lin aLin(aPoint, -aDN);
|
||||||
for (aSE.InitFace();aSE.MoreFace(); aSE.NextFace()) {
|
Standard_Real parmin = RealLast();
|
||||||
if (aSE.RejectFace(aLin) == Standard_False) {
|
for (aSE.InitShell();aSE.MoreShell();aSE.NextShell()) {
|
||||||
TopoDS_Shape aLocalShape = aSE.CurrentFace();
|
if (aSE.RejectShell(aLin) == Standard_False) {
|
||||||
TopoDS_Face CurFace = TopoDS::Face(aLocalShape);
|
for (aSE.InitFace();aSE.MoreFace(); aSE.NextFace()) {
|
||||||
IntCurvesFace_Intersector& Intersector3d = aSE.Intersector(CurFace);
|
if (aSE.RejectFace(aLin) == Standard_False) {
|
||||||
Intersector3d.Perform(aLin,-RealLast(),parmin);
|
TopoDS_Shape aLocalShape = aSE.CurrentFace();
|
||||||
|
TopoDS_Face CurFace = TopoDS::Face(aLocalShape);
|
||||||
if(Intersector3d.IsDone()) {
|
IntCurvesFace_Intersector& Intersector3d = aSE.Intersector(CurFace);
|
||||||
if(Intersector3d.NbPnt()) {
|
Intersector3d.Perform(aLin,-RealLast(),parmin);
|
||||||
Standard_Integer imin = 1;
|
|
||||||
for (Standard_Integer i = 2; i <= Intersector3d.NbPnt(); i++)
|
if(Intersector3d.IsDone()) {
|
||||||
if (Intersector3d.WParameter(i) < Intersector3d.WParameter(imin))
|
if(Intersector3d.NbPnt()) {
|
||||||
imin = i;
|
Standard_Integer imin = 1;
|
||||||
parmin = Intersector3d.WParameter(imin);
|
for (Standard_Integer i = 2; i <= Intersector3d.NbPnt(); i++)
|
||||||
aState = Intersector3d.State(imin);
|
if (Intersector3d.WParameter(i) < Intersector3d.WParameter(imin))
|
||||||
aTransition = Intersector3d.Transition(imin);
|
imin = i;
|
||||||
MinFace = CurFace;
|
parmin = Intersector3d.WParameter(imin);
|
||||||
}
|
aState = Intersector3d.State(imin);
|
||||||
|
aTransition = Intersector3d.Transition(imin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
myState = 1;
|
|
||||||
} //end of loop on the whole solid
|
|
||||||
|
|
||||||
if (aState == TopAbs_IN)
|
|
||||||
{
|
|
||||||
if (aTransition == IntCurveSurface_Out) {
|
|
||||||
//-- The line is going from inside the solid to outside
|
|
||||||
//-- the solid.
|
|
||||||
myState = 3; //-- IN --
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (aTransition == IntCurveSurface_In) {
|
|
||||||
myState = 4; //-- OUT --
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
aF = MinFace;
|
else
|
||||||
|
myState = 1;
|
||||||
|
} //end of loop on the whole solid
|
||||||
|
|
||||||
|
if (aState == TopAbs_IN)
|
||||||
|
{
|
||||||
|
if (aTransition == IntCurveSurface_Out) {
|
||||||
|
//-- The line is going from inside the solid to outside
|
||||||
|
//-- the solid.
|
||||||
|
myState = 3; //-- IN --
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (aTransition == IntCurveSurface_In) {
|
||||||
|
myState = 4; //-- OUT --
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} //if (aSE.MoreFace())
|
} // iteration by faces
|
||||||
} //if (aSE.MoreShell())
|
} // iteration by points
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
# plane unstable
|
# plane unstable
|
||||||
|
|
||||||
puts "TODO OCC26020 ALL: Error: bopcheck failed"
|
puts "TODO OCC26020 ALL: Error: bopcheck failed"
|
||||||
puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
|
|
||||||
|
|
||||||
# planar face
|
# planar face
|
||||||
plane pln_f1 0 -870 -1.3877787807814457e-014 0 1 1.1102230246251565e-016
|
plane pln_f1 0 -870 -1.3877787807814457e-014 0 1 1.1102230246251565e-016
|
||||||
@ -37,5 +36,5 @@ mkface f6 pln_f6 -1000000 1000000 -1000000 1000000
|
|||||||
# make volume operation
|
# make volume operation
|
||||||
mkvolume result f1 f2 f3 f4 f5 f6
|
mkvolume result f1 f2 f3 f4 f5 f6
|
||||||
|
|
||||||
set square 2.4e+013
|
set square 1183220.
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
# test script on make volume operation
|
# test script on make volume operation
|
||||||
# plane
|
# plane
|
||||||
|
|
||||||
puts "TODO OCC26020 ALL: Error: bopcheck failed"
|
|
||||||
|
|
||||||
# planar face
|
# planar face
|
||||||
plane pln_f1 2949.26242211 -890 552.5 1.110223024625157e-016 -1 1.1102230246251563e-016
|
plane pln_f1 2949.26242211 -890 552.5 1.110223024625157e-016 -1 1.1102230246251563e-016
|
||||||
erase pln_f1
|
erase pln_f1
|
||||||
@ -36,5 +34,4 @@ mkface f6 pln_f6 -1000000 1000000 -1000000 1000000
|
|||||||
# make volume operation
|
# make volume operation
|
||||||
mkvolume result f1 f2 f3 f4 f5 f6
|
mkvolume result f1 f2 f3 f4 f5 f6
|
||||||
|
|
||||||
set square 2.4e+013
|
set square 12400.
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# test script on make volume operation
|
# test script on make volume operation
|
||||||
# plane
|
# plane
|
||||||
|
|
||||||
puts "TODO ?OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
|
puts "TODO OCC26020 ALL: Error: bopcheck failed"
|
||||||
puts "TODO ?OCC26020 ALL: Error: bopcheck failed"
|
|
||||||
|
|
||||||
# planar face
|
# planar face
|
||||||
plane pln_f1 18.855982726712998 17.500000000800412 0 -0.96152394764524818 -0.27472112788189063 0
|
plane pln_f1 18.855982726712998 17.500000000800412 0 -0.96152394764524818 -0.27472112788189063 0
|
||||||
@ -52,4 +51,4 @@ mkface f9 pln_f9 -1000000 1000000 -1000000 1000000
|
|||||||
# make volume operation
|
# make volume operation
|
||||||
mkvolume result f1 f2 f3 f4 f5 f6 f7 f8 f9
|
mkvolume result f1 f2 f3 f4 f5 f6 f7 f8 f9
|
||||||
|
|
||||||
set square 2.75501e+013
|
set square 1.3412e+013
|
||||||
|
19
tests/bugs/modalg_6/bug26627
Normal file
19
tests/bugs/modalg_6/bug26627
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
puts "##################################################"
|
||||||
|
puts "0026627: Shape Healing hangs as of OCC 6.8.0"
|
||||||
|
puts "##################################################"
|
||||||
|
|
||||||
|
# load and check shape
|
||||||
|
restore [locate_data_file bug26627_fixed.brep] a
|
||||||
|
tolerance a
|
||||||
|
checkshape a
|
||||||
|
|
||||||
|
# call fixshape -- it should finish in fraction of second
|
||||||
|
cpulimit 10
|
||||||
|
fixshape result a 1e-6
|
||||||
|
|
||||||
|
# result should have positive volume
|
||||||
|
if { [regexp {Mass\s*:\s*([0-9.e+-]*)} [vprops result] dummy volume] } {
|
||||||
|
checkreal "Volume of the solid" $volume 4332.63 0.1 0.
|
||||||
|
} else {
|
||||||
|
puts "Error: cannot get volume of result!"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user