MantisBT - Community
View Issue Details
0027569Community[OCCT] OCCT:Modeling Algorithmspublic2016-06-05 13:292016-12-09 16:37
Roman Lygin 
bugmaster 
normalmajor 
closedfixed 
[OCCT] 7.0.0 
[OCCT] 7.1.0[OCCT] 7.1.0 
bugs modalg_6 bug27569
0027569: [Regression in 6.9.0] Projecting a curve hangs
Symptoms are very much like in 0026339 and the call stack is very similar.
The data comes from a real-world file. The severity is set to major as this is a hang leading to data loss in a customer app.

Call stack:
TKMath.dll!BSplSLib_Cache::D0(const double & theU, const double & theV, gp_Pnt & thePoint) Line 206 C++
TKG3d.dll!GeomAdaptor_Surface::D0(const double U, const double V, gp_Pnt & P) Line 732 C++
TKG3d.dll!GeomAdaptor_Surface::Value(const double U, const double V) Line 710 C++
TKGeomBase.dll!Extrema_GenExtPS::BuildGrid(const gp_Pnt & thePoint) Line 549 C++
TKGeomBase.dll!Extrema_GenExtPS::Perform(const gp_Pnt & P) Line 811 C++
TKGeomBase.dll!Extrema_ExtPS::Perform(const gp_Pnt & thePoint) Line 343 C++
TKGeomBase.dll!Extrema_ExtPS::Extrema_ExtPS(const gp_Pnt & theP, const Adaptor3d_Surface & theS, const double theTolU, const double theTolV, const Extrema_ExtFlag theF, const Extrema_ExtAlgo theA) Line 175 C++
TKGeomBase.dll!Function_Value(const double theU, const aFuncStruct & theData) Line 384 C++
TKGeomBase.dll!ProjLib_PolarFunction::Value(const double theT, NCollection_Array1<gp_Pnt2d> & thePnt2d, NCollection_Array1<gp_Pnt> & __formal) Line 462 C++
TKGeomBase.dll!AppCont_LeastSquare::FixSingleBorderPoint(const AppCont_Function & theSSP, const double theU, const double theU0, const double theU1, NCollection_Array1<gp_Pnt2d> & theFix2d, NCollection_Array1<gp_Pnt> & theFix) Line 56 C++
TKGeomBase.dll!AppCont_LeastSquare::AppCont_LeastSquare(const AppCont_Function & SSP, const double U0, const double U1, const AppParCurves_Constraint FirstCons, const AppParCurves_Constraint LastCons, const int Deg, const int myNbPoints) Line 307 C++
TKGeomBase.dll!Approx_FitAndDivide2d::Compute(const AppCont_Function & Line, const double Ufirst, const double Ulast, double & TheTol3d, double & TheTol2d) Line 232 C++
TKGeomBase.dll!Approx_FitAndDivide2d::Perform(const AppCont_Function & Line) Line 157 C++
TKGeomBase.dll!Approx_FitAndDivide2d::Approx_FitAndDivide2d(const AppCont_Function & Line, const int degreemin, const int degreemax, const double Tolerance3d, const double Tolerance2d, const unsigned int cutting, const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC) Line 55 C++
TKGeomBase.dll!ProjLib_ComputeApproxOnPolarSurface::ProjectUsingInitialCurve2d(const opencascade::handle<Adaptor3d_HCurve> & Curve, const opencascade::handle<Adaptor3d_HSurface> & Surf, const opencascade::handle<Adaptor2d_HCurve2d> & InitCurve2d) Line 1808 C++
TKGeomBase.dll!ProjLib_ComputeApproxOnPolarSurface::Perform(const opencascade::handle<Adaptor2d_HCurve2d> & InitialCurve2d, const opencascade::handle<Adaptor3d_HCurve> & Curve, const opencascade::handle<Adaptor3d_HSurface> & S) Line 801 C++
TKGeomBase.dll!ProjLib_ComputeApproxOnPolarSurface::ProjLib_ComputeApproxOnPolarSurface(const opencascade::handle<Adaptor3d_HCurve> & theCurve, const opencascade::handle<Adaptor3d_HSurface> & theSurface, const double theTolerance3D) Line 553 C++
TKGeomBase.dll!ProjLib_ProjectedCurve::Load(const opencascade::handle<Adaptor3d_HCurve> & C) Line 434 C++
TKGeomBase.dll!ProjLib_ProjectedCurve::ProjLib_ProjectedCurve(const opencascade::handle<Adaptor3d_HSurface> & S, const opencascade::handle<Adaptor3d_HCurve> & C) Line 294 C++
TKShHealing.dll!ShapeConstruct_ProjectCurveOnSurface::PerformByProjLib(opencascade::handle<Geom_Curve> & c3d, const double First, const double Last, opencascade::handle<Geom2d_Curve> & c2d, const GeomAbs_Shape __formal, const int __formal, const int __formal) Line 429 C++
TKShHealing.dll!ShapeConstruct_ProjectCurveOnSurface::Perform(opencascade::handle<Geom_Curve> & c3d, const double First, const double Last, opencascade::handle<Geom2d_Curve> & c2d, const GeomAbs_Shape __formal, const int __formal, const int __formal) Line 343 C++
restore surface_draw s
restore curve_draw c
pload QAcommands
OCC24008 c s
No tags attached.
related to 0026339closed bugmaster [Regression in 6.9.0] Projecting a curve hangs 
zip 020.zip (5,229) 2016-06-05 13:29
https://tracker.dev.opencascade.org/
? aC2d_v680.brep (5,884) 2016-06-07 09:57
https://tracker.dev.opencascade.org/
? aC2d_v700.brep (5,878) 2016-06-07 09:57
https://tracker.dev.opencascade.org/
png Projection.png (35,096) 2016-06-07 09:58
https://tracker.dev.opencascade.org/
? bug27569.brep (8,591) 2016-06-09 14:48
https://tracker.dev.opencascade.org/
Issue History
2016-06-05 13:29Roman LyginNew Issue
2016-06-05 13:29Roman LyginAssigned To => msv
2016-06-05 13:29Roman LyginFile Added: 020.zip
2016-06-05 13:30Roman LyginRelationship addedrelated to 0026339
2016-06-06 18:38amlAssigned Tomsv => aml
2016-06-07 08:48amlNote Added: 0054754
2016-06-07 08:48amlAssigned Toaml => msv
2016-06-07 08:48amlStatusnew => feedback
2016-06-07 09:26amlNote Added: 0054755
2016-06-07 09:57amlFile Added: aC2d_v680.brep
2016-06-07 09:57amlFile Added: aC2d_v700.brep
2016-06-07 09:58amlFile Added: Projection.png
2016-06-07 10:07amlNote Added: 0054756
2016-06-07 10:26msvNote Added: 0054757
2016-06-07 10:26msvAssigned Tomsv => aml
2016-06-07 10:26msvStatusfeedback => assigned
2016-06-07 12:28Roman LyginNote Added: 0054763
2016-06-07 14:53msvNote Added: 0054766
2016-06-09 14:48amlFile Added: bug27569.brep
2016-06-09 14:54gitNote Added: 0054842
2016-06-09 17:34Roman LyginNote Added: 0054855
2016-06-09 19:14gitNote Added: 0054866
2016-06-10 08:15gitNote Added: 0054870
2016-06-10 08:33gitNote Added: 0054871
2016-06-10 08:50amlNote Added: 0054872
2016-06-10 08:50amlAssigned Toaml => msv
2016-06-10 08:50amlStatusassigned => resolved
2016-06-10 09:36msvNote Added: 0054874
2016-06-10 09:36msvAssigned Tomsv => bugmaster
2016-06-10 09:36msvStatusresolved => reviewed
2016-06-10 11:30apvAssigned Tobugmaster => apv
2016-06-10 13:29gitNote Added: 0054892
2016-06-10 13:30apvNote Added: 0054893
2016-06-14 14:49apvTest case number => bugs modalg_6 bug27569
2016-06-14 15:33apvNote Added: 0054965
2016-06-14 15:33apvAssigned Toapv => bugmaster
2016-06-14 15:33apvStatusreviewed => tested
2016-06-17 12:04bugmasterChangeset attached => occt master 67285996
2016-06-17 12:04bugmasterStatustested => verified
2016-06-17 12:04bugmasterResolutionopen => fixed
2016-06-17 12:13gitNote Added: 0055144
2016-12-09 16:31aivStatusverified => closed
2016-12-09 16:37aivFixed in Version => 7.1.0

Notes
(0054754)
aml   
2016-06-07 08:48   
restore d:/surface_draw s
restore d:/curve3d_draw c
pload QAcommands
chrono s1 reset; chrono s1 start;
OCC24008 c s
chrono s1 stop; chrono s1 show;


OCCT-690:
Elapsed time: 0 Hours 0 Minutes 41.7356698439 Seconds
CPU user time: 34.476221 seconds
CPU system time: 4.9764319 seconds

OCCT-691:
Elapsed time: 0 Hours 1 Minutes 17.9660195971 Seconds
CPU user time: 73.0240681 seconds
CPU system time: 4.4772287 seconds

Current master (IR-2016-06-02)
Elapsed time: 0 Hours 1 Minutes 11.8179416475 Seconds
CPU user time: 66.0976237 seconds
CPU system time: 5.2728338 seconds

Test does not hang but slow working.
(0054755)
aml   
2016-06-07 09:26   
OCCT-680:
Elapsed time: 0 Hours 0 Minutes 0.290150400077 Seconds
CPU user time: 0.0312002 seconds
CPU system time: 0.0156001 seconds
(0054756)
aml   
2016-06-07 10:07   
Result is incorrect in all versions since input data is not supported - curve walk over degenerated point on surface.
(0054757)
msv   
2016-06-07 10:26   
Since the input curve has very uneven parametrization, the algorithm goes by the hard way (standard ProjLib projection instead of quick one implemented in shape healing). It is needed to find a new solution or a compromise between two algorithms.
(0054763)
Roman Lygin   
2016-06-07 12:28   
Folks,

Thank you for further inputs. If it helps, as mentioned, this is not a synthetic case - the data comes from a real file with 3D curve representation and a surface.
The fact of 3D curve going over the pole is quite regular when receiving from other kernels which do not enforce requirement of having both 3D and 2D representations. For instance, a semi-circle going over a sphere pole is not an exceptional case.

So performance drop from 0.29s to 71s is essentially equivalent to a hang.
Thank you for your further efforts.
(0054766)
msv   
2016-06-07 14:53   
Dear Roman, in this case the problem is not only with the case of going through a pole. This case is well processed by internal projector of shape healing. Rather the problem is with the input 3d curve - first, it has C0 continuity, second, it has degenerated points with null derivative. Such b-spline is a real challenge for OCCT algorithms.
(0054842)
git   
2016-06-09 14:54   
Branch CR27569 has been created by aml.

SHA-1: bd77ce1e90ea3fb7ca6210c29cb1f976340996a7


Detailed log of new commits:

Author: aml
Date: Thu Jun 9 14:38:04 2016 +0300

    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.
(0054855)
Roman Lygin   
2016-06-09 17:34   
Minor comment regarding the branch.
The name of the variable aMinParSpeed is slightly misleading, it is rather aParStep (parameter step). It's not speed and is not minimum.
My 2 cents.
(0054866)
git   
2016-06-09 19:14   
Branch CR27569 has been updated forcibly by aml.

SHA-1: 9f72fdb2a0df80cd0fb2b460ad3ce354d97b2924
(0054870)
git   
2016-06-10 08:15   
Branch CR27569 has been updated forcibly by aml.

SHA-1: 261d959e75393161946312ed9b09c4c221babd7e
(0054871)
git   
2016-06-10 08:33   
Branch CR27569 has been updated forcibly by aml.

SHA-1: 486eeedc357e86c897ca6ce1918d153eb81ba8c4
(0054872)
aml   
2016-06-10 08:50   
Dear msv,
Please check current state of the CR27569 branch.
(0054874)
msv   
2016-06-10 09:36   
Reviewed.
(0054892)
git   
2016-06-10 13:29   
Branch CR27569 has been updated forcibly by apv.

SHA-1: 2589722a4fe9c3d0b5ff696f6bde63cfff8679ec
(0054893)
apv   
2016-06-10 13:30   
Branch CR27569 has been rebased on the current master
(0054965)
apv   
2016-06-14 15:33   
Dear BugMaster,

Branch CR27569 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: 2589722a4fe9c3d0b5ff696f6bde63cfff8679ec

Number of compiler warnings:
occt component:
   Linux: 0 (0 on master)
   Windows: 0 (0 on master)
   MacOS: 0 (0 on master)
products component:
   Linux: 72
   Windows: 4
   MacOS: 1125

Regressions/Differences:
Not detected

Testing cases:
bugs modalg_6 bug27569 - OK
http://occt-tests/CR27569-master-OCCT/Debian70-64/bugs/modalg_6/bug27569.html [^]
http://occt-tests/CR27569-master-OCCT/Windows-64-VC10/bugs/modalg_6/bug27569.html [^]

Testing on Linux:
Total MEMORY difference: 89312894 / 88279366 [+1.17%]
Total CPU difference: 19461.949999999895 / 19440.389999999967 [+0.11%]

Testing on Windows:
Total MEMORY difference: 55954840 / 55981508 [-0.05%]
Total CPU difference: 18363.92291669883 / 19056.083753598912 [-3.63%]
(0055144)
git   
2016-06-17 12:13   
Branch CR27569 has been deleted by inv.

SHA-1: 2589722a4fe9c3d0b5ff696f6bde63cfff8679ec