From 9140163ba8726a0a2ff30c459668f9c9ff78ddd0 Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 19 Feb 2021 22:34:56 +0300 Subject: [PATCH] 0032066: Modeling Algorithms - Incorrect result of Boolean CUT operation Do not limit the normalization factor of the highly anisotropic parametric space when filtering start points in the algorithm of walking line construction. Additionally check the knots are in the increasing orders when merging two B-spline curves --- .../GeomConvert_CompCurveToBSplineCurve.cxx | 11 ++------ src/IntWalk/IntWalk_IWalking_2.gxx | 11 ++++++-- tests/bugs/modalg_7/bug32066 | 26 +++++++++++++++++++ tests/hlr/exact_hlr/bug27979_6 | 2 +- 4 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 tests/bugs/modalg_7/bug32066 diff --git a/src/GeomConvert/GeomConvert_CompCurveToBSplineCurve.cxx b/src/GeomConvert/GeomConvert_CompCurveToBSplineCurve.cxx index addfba1ec8..93dc628426 100644 --- a/src/GeomConvert/GeomConvert_CompCurveToBSplineCurve.cxx +++ b/src/GeomConvert/GeomConvert_CompCurveToBSplineCurve.cxx @@ -132,7 +132,7 @@ void GeomConvert_CompCurveToBSplineCurve::Add( if (SecondCurve->Degree() < Deg) { SecondCurve->IncreaseDegree(Deg); } // Declarationd - Standard_Real L1, L2, U_de_raccord; + Standard_Real L1, L2; Standard_Integer ii, jj; Standard_Real Ratio=1, Ratio1, Ratio2, Delta1, Delta2; Standard_Integer NbP1 = FirstCurve->NbPoles(), NbP2 = SecondCurve->NbPoles(); @@ -159,7 +159,6 @@ void GeomConvert_CompCurveToBSplineCurve::Add( Delta1 = 0; Ratio2 = 1/Ratio; Delta2 = Ratio2*SecondCurve->Knot(1) - FirstCurve->Knot(NbK1); - U_de_raccord = FirstCurve->LastParameter(); } else { // On ne bouge pas la seconde courbe @@ -167,12 +166,11 @@ void GeomConvert_CompCurveToBSplineCurve::Add( Delta1 = Ratio1*FirstCurve->Knot(NbK1) - SecondCurve->Knot(1); Ratio2 = 1; Delta2 = 0; - U_de_raccord = SecondCurve->FirstParameter(); } // Les Noeuds Standard_Real eps; - for (ii=1; iiKnot(ii) - Delta1; if(ii > 1) { eps = Epsilon (Abs(Noeuds(ii-1))); @@ -183,11 +181,6 @@ void GeomConvert_CompCurveToBSplineCurve::Add( } Mults(ii) = FirstCurve->Multiplicity(ii); } - Noeuds(NbK1) = U_de_raccord; - eps = Epsilon (Abs(Noeuds(NbK1-1))); - if(Noeuds(NbK1) - Noeuds(NbK1-1) <= eps) { - Noeuds(NbK1) += eps; - } Mults(NbK1) = FirstCurve->Degree(); for (ii=2, jj=NbK1+1; ii<=NbK2; ii++, jj++) { Noeuds(jj) = Ratio2*SecondCurve->Knot(ii) - Delta2; diff --git a/src/IntWalk/IntWalk_IWalking_2.gxx b/src/IntWalk/IntWalk_IWalking_2.gxx index 2e5d7f0cdd..4e9933ad8c 100644 --- a/src/IntWalk/IntWalk_IWalking_2.gxx +++ b/src/IntWalk/IntWalk_IWalking_2.gxx @@ -400,8 +400,15 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage //Normalizing factor. If it is less than 1.0 then the range will be expanded. //This is no good for computation. Therefore, it is limited. - const Standard_Real deltau = mySRangeU.IsVoid() ? UM - Um : Max(mySRangeU.Delta(), 1.0); - const Standard_Real deltav = mySRangeV.IsVoid() ? VM - Vm : Max(mySRangeV.Delta(), 1.0); + //Do not limit this factor in case of highly anisotropic parametrization + //(parametric space is considerably larger in one direction than another). + const Standard_Boolean isHighlyAnisotropic = Max(tolu, tolv) > 1000. * Min(tolu, tolv); + const Standard_Real deltau = mySRangeU.IsVoid() ? UM - Um + : (isHighlyAnisotropic ? mySRangeU.Delta() + : Max(mySRangeU.Delta(), 1.0)); + const Standard_Real deltav = mySRangeV.IsVoid() ? VM - Vm + : (isHighlyAnisotropic ? mySRangeV.Delta() + : Max(mySRangeV.Delta(), 1.0)); Up/=deltau; UV1/=deltau; Vp/=deltav; UV2/=deltav; diff --git a/tests/bugs/modalg_7/bug32066 b/tests/bugs/modalg_7/bug32066 new file mode 100644 index 0000000000..5f0b0c080b --- /dev/null +++ b/tests/bugs/modalg_7/bug32066 @@ -0,0 +1,26 @@ +puts "=======================================================" +puts "0032066: Modeling Algorithms - Incorrect result of Boolean CUT operation" +puts "=======================================================" +puts "" + +restore [locate_data_file bug32066_solid.brep] s + +restore [locate_data_file bug32066_hole_2547.brep] h1 +restore [locate_data_file bug32066_hole_2562.brep] h2 +restore [locate_data_file bug32066_hole_2563.brep] h3 +restore [locate_data_file bug32066_hole_2564.brep] h4 + +bclearobjects +bcleartools +baddobjects s +baddtools h1 h2 h3 h4 +bfillds + +bbop r 2 + +checkshape r + +checknbshapes r -wire 73 -face 65 -shell 1 -solid 1 -t +checkprops r -s 3.45489e+07 -v 1.54742e+08 + +checkview -display r -2d -path ${imagedir}/${test_image}.png diff --git a/tests/hlr/exact_hlr/bug27979_6 b/tests/hlr/exact_hlr/bug27979_6 index c758e0c073..19e579ab70 100644 --- a/tests/hlr/exact_hlr/bug27979_6 +++ b/tests/hlr/exact_hlr/bug27979_6 @@ -1,4 +1,4 @@ -puts "TODO OCC30286 ALL: Error : The length of result shape is 227257, expected 11." +puts "TODO OCC30286 ALL: Error : The length of result shape is" puts "========================================================================" puts "OCC27979: Parasolid converted BREP shows weird lines on hidden line Algo"