From 6728599615fc6f7ecac294f440e35dde0a6cdae5 Mon Sep 17 00:00:00 2001 From: aml Date: Thu, 9 Jun 2016 14:38:04 +0300 Subject: [PATCH] 0027569: [Regression in 6.9.0] Projecting a curve hangs Parameterization speed is taken into account to avoid ProjLib projector usage in case of bad input data. Test case is added. Test cases correction. --- .../ShapeConstruct_ProjectCurveOnSurface.cxx | 11 ++++++-- tests/bugs/modalg_6/bug27569 | 28 +++++++++++++++++++ tests/de/step_2/O3 | 6 ++-- 3 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 tests/bugs/modalg_6/bug27569 diff --git a/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx b/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx index 052a95c267..1fc1cb1f21 100644 --- a/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx +++ b/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx @@ -289,7 +289,7 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::Perform (Handle(Geom_Curv } GeomAdaptor_Curve aC3DAdaptor(c3d); - + Standard_Real aMinParSpeed = Precision::Infinite(); // Minimal parameterization speed. for(; anIdx <= bspl->NbKnots() && aFirstParam < Last; anIdx++) { // Fill current knot interval. @@ -320,8 +320,12 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::Perform (Handle(Geom_Curv { Standard_Real aParam = aFirstParam + aStep * anIntIdx; aC3DAdaptor.D0 (aParam, p3d2); - aLength3d += p3d2.Distance(p3d1); + const Standard_Real aDist = p3d2.Distance(p3d1); + + aLength3d += aDist; p3d1 = p3d2; + + aMinParSpeed = Min(aMinParSpeed, aDist / aStep); } const Standard_Real aCoeff = aLength3d / (aLastParam - aFirstParam); if (Abs(aCoeff) > gp::Resolution()) @@ -337,7 +341,8 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::Perform (Handle(Geom_Curv } const Standard_Real aMaxQuotientCoeff = 1500.0; - if (anEvenlyCoeff > aMaxQuotientCoeff) + if (anEvenlyCoeff > aMaxQuotientCoeff && + aMinParSpeed > Precision::Confusion() ) { PerformByProjLib(c3d, First, Last, c2d); // PerformByProjLib fail detection: diff --git a/tests/bugs/modalg_6/bug27569 b/tests/bugs/modalg_6/bug27569 new file mode 100644 index 0000000000..ece3f66972 --- /dev/null +++ b/tests/bugs/modalg_6/bug27569 @@ -0,0 +1,28 @@ +puts "============" +puts "OCC27569" +puts "============" +puts "" +###################################################### +# [Regression in 6.9.0] Projecting a curve hangs +###################################################### + +pload QAcommands + +restore [locate_data_file bug27569.brep] aS +explode aS +mkcurve c aS_1 +mksurface s aS_2 + +# Performance check +chrono h reset; chrono h start +OCC24008 c s; +chrono h stop; set q [dchrono h show] +regexp {CPU user time: ([-0-9.+eE]+) seconds} $q full aTime + +set MAX_TIME 1.0 + +if { $aTime > ${MAX_TIME} } { + puts "Elapsed time is more than ${MAX_TIME} seconds - Faulty" +} else { + puts "Elapsed time is less than ${MAX_TIME} seconds - OK" +} diff --git a/tests/de/step_2/O3 b/tests/de/step_2/O3 index 6f5d4dd2fc..cffe2dc486 100644 --- a/tests/de/step_2/O3 +++ b/tests/de/step_2/O3 @@ -1,5 +1,5 @@ # !!!! This file is generated automatically, do not edit manually! See end script -puts "TODO CR23096 ALL: NBSHAPES : Faulty" +puts "TODO CR23096 ALL: TPSTAT : Faulty" set filename ie_soapbox-A.stp @@ -8,8 +8,8 @@ set ref_data { DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 ) TPSTAT : Faulties = 0 ( 0 ) Warnings = 28 ( 20 ) Summary = 28 ( 20 ) CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) -NBSHAPES : Solid = 2 ( 2 ) Shell = 2 ( 2 ) Face = 112 ( 112 ) Summary = 685 ( 687 ) -STATSHAPE : Solid = 2 ( 2 ) Shell = 2 ( 2 ) Face = 112 ( 112 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 286 ( 288 ) +NBSHAPES : Solid = 2 ( 2 ) Shell = 2 ( 2 ) Face = 112 ( 112 ) Summary = 687 ( 687 ) +STATSHAPE : Solid = 2 ( 2 ) Shell = 2 ( 2 ) Face = 112 ( 112 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 288 ( 288 ) TOLERANCE : MaxTol = 0.5386330267 ( 1.019942733 ) AvgTol = 0.009444234359 ( 0.01316262156 ) LABELS : N0Labels = 1 ( 1 ) N1Labels = 0 ( 0 ) N2Labels = 0 ( 0 ) TotalLabels = 1 ( 1 ) NameLabels = 1 ( 1 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) -- 2.39.5