Archived issue #0023943
OCC fails to work with offset surfaces with singularities
Description
Unlike other types of surfaces, offsets throw an exception Geom_UndefinedValue (or _UndefinedDerivative) when trying to compute values near their singularities.
Therefore algorithms that do not expect surface evaluation to throw exception eventually produce incorrect results when working with such geometries.
The fix addresses two cases trying to improve robustness of OCC:
1. singularity is now recognized in Geom_OscullatingSurface if the derivative is below the tolerance (regardless that it should be greater than 1e-12 threshold used before)
2. ShapeAnalysis_Surface::ValueOf() now avoids going beyond the surface range for offset surfaces.
Notes:
1. In #0000001 additionally the debug output in Geom_OscullatingSurface.cxx has been suppressed in production version as otherwise it severely contaminates the log.
Suppression is done by adding another macro which could be defined only in OCC development environment. OCC team is free to modify the name as sees fit.
2. In #0000002 it would probably be good to prevent going beyond surface range for all types of (non-periodic?) surfaces. However to minimize fix impact it has been limited to offsets only.
Therefore algorithms that do not expect surface evaluation to throw exception eventually produce incorrect results when working with such geometries.
The fix addresses two cases trying to improve robustness of OCC:
1. singularity is now recognized in Geom_OscullatingSurface if the derivative is below the tolerance (regardless that it should be greater than 1e-12 threshold used before)
2. ShapeAnalysis_Surface::ValueOf() now avoids going beyond the surface range for offset surfaces.
Notes:
1. In #0000001 additionally the debug output in Geom_OscullatingSurface.cxx has been suppressed in production version as otherwise it severely contaminates the log.
Suppression is done by adding another macro which could be defined only in OCC development environment. OCC team is free to modify the name as sees fit.
2. In #0000002 it would probably be good to prevent going beyond surface range for all types of (non-periodic?) surfaces. However to minimize fix impact it has been limited to offsets only.
Steps to reproduce
See two independent reproducers attached.
Public activity
4 archived notes
Participants are labeled by their role within this record.
The fix pushed to the git repository
The first part of correction (elimination of TolMin from test of singular point) seems to be Ok.
The second part of correction (ShapeAnalysis_Surface::ValueOf()) can be consider as temporal solution for following reasons:
the going beyond surface domain is not "fatal" problem for practically all types of not periodic surface including offset surface because these surfaces can be analytically extended. Of course, extension must not be too large.
Sometimes going beyong surface happens by "natural" way, for example, while getting pcurve by projection of 3d curve, which is near surface boundary.
Problem of given offset surface is that basis surface is singular and osculating surface is built for Umax, but derivative are calculated for u > Umax. Perhaps, the correct fix of bug must solve problem of extension of osculating surface, if it exists for u > Umax.
So problem requires additional investigations.
The second part of correction (ShapeAnalysis_Surface::ValueOf()) can be consider as temporal solution for following reasons:
the going beyond surface domain is not "fatal" problem for practically all types of not periodic surface including offset surface because these surfaces can be analytically extended. Of course, extension must not be too large.
Sometimes going beyong surface happens by "natural" way, for example, while getting pcurve by projection of 3d curve, which is near surface boundary.
Problem of given offset surface is that basis surface is singular and osculating surface is built for Umax, but derivative are calculated for u > Umax. Perhaps, the correct fix of bug must solve problem of extension of osculating surface, if it exists for u > Umax.
So problem requires additional investigations.
Dear Commenter 1,
Branch CR23943 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 2 (2 on master)
Windows: 11 (11 on master)
products component :
Linux: 0 (0 on master)
Windows: 64 (64 on master)
Regressions:
No regressions
Improvements:
No improvements
Testing cases:
bugs moddata_3(013) bug23943_1, bug23943_2, bug23943_3, bug23943_4 - OK
Testing on Linux:
Total MEMORY difference: 365857352 / 365850136
Total CPU difference: 41145.37000000122 / 45786.650000001355
Testing on Windows:
Total MEMORY difference: 415969780 / 418014292
Total CPU difference: 38610.796875 / 29305.09375
There are not differences in images found by testdiff.
Branch CR23943 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 2 (2 on master)
Windows: 11 (11 on master)
products component :
Linux: 0 (0 on master)
Windows: 64 (64 on master)
Regressions:
No regressions
Improvements:
No improvements
Testing cases:
bugs moddata_3(013) bug23943_1, bug23943_2, bug23943_3, bug23943_4 - OK
Testing on Linux:
Total MEMORY difference: 365857352 / 365850136
Total CPU difference: 41145.37000000122 / 45786.650000001355
Testing on Windows:
Total MEMORY difference: 415969780 / 418014292
Total CPU difference: 38610.796875 / 29305.09375
There are not differences in images found by testdiff.
Fix has been integrated into master of occt repository
Related records