From e7bcf415c3170d827cbec564a3a19da8512e5c29 Mon Sep 17 00:00:00 2001 From: akaftasev Date: Thu, 31 Aug 2023 12:42:05 +0100 Subject: [PATCH] 0033450: Modeling algorithm - HLR algorightm stucks Selecting the middle point between XInf and XSup leads situation, where X values almost does not change. To prevent this situation, select shifted point instead of middle. --- src/Contap/Contap_Contour.cxx | 7 +++++-- tests/hlr/exact_hlr/bug33450 | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 tests/hlr/exact_hlr/bug33450 diff --git a/src/Contap/Contap_Contour.cxx b/src/Contap/Contap_Contour.cxx index 90a00e7779..16d2d58625 100644 --- a/src/Contap/Contap_Contour.cxx +++ b/src/Contap/Contap_Contour.cxx @@ -1236,8 +1236,11 @@ void ComputeInternalPoints // std::cout << "Changement de signe detecte" << std::endl; solution = Standard_False; while (!solution) { - X(1) = (XInf(1) + XSup(1)) /2.; - X(2) = (XInf(2) + XSup(2)) /2.; + // Selecting the middle point between XInf and XSup leads situation, where X values almost do not change. + // To prevent this situation, select shifted point instead of middle. + const Standard_Real aCoef = 2. / 3.; + X(1) = XInf(1) + aCoef * (XSup(1) - XInf(1)); + X(2) = XInf(2) + aCoef * (XSup(2) - XInf(2)); rsnld.Perform(SFunc,X,infb,supb); if (!rsnld.IsDone()) { diff --git a/tests/hlr/exact_hlr/bug33450 b/tests/hlr/exact_hlr/bug33450 new file mode 100644 index 0000000000..efe6ca5de0 --- /dev/null +++ b/tests/hlr/exact_hlr/bug33450 @@ -0,0 +1,5 @@ +set viewname "vfront" +set length 63.8689 + +restore [locate_data_file bug33450.brep] a +COMPUTE_HLR $viewname $algotype