1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0026329: Restore floating point signals handling in DRAW

Added DRAW command dsetsignal, resetting OSD signal handler with either armed or disabled FPE handler, according to an option.
If called without arguments, it sets FPE handler only if environment variable OSD_FPE is defined (with value different from 0).
On start, DRAW calls dsetsignal to set FPE signal if CSF_FPE is defined.
Test bugs fclasses bug6143 uses dsetsignal to set FPE handler unconditionally before the test command, and resets it to default at the end.

A number of changes in the code have been done in order to fix floating point exceptions that became generated after enabling signals:

- Global functions Sinh() and Cosh() defined in Standard_Real.hxx are improved to raise Standard_NumericError exception if argument is too big (greater than 710.47586), instead of relying on system treatment of floating point overflow. These functions are used instead of sinh and cosh in ElCLib.cxx.

- Maximal value of parameter on hyperbola is restricted by 23 (corresponding to ~1e10 in 3d) in order to avoid FP overflow in Extrema_GenExtCS.cxx, ShapeFix_EdgeProjAux.cxx.

- Interface of the root curve adaptor class Adaptor3d_Curve has been updated to add new virtual methods BasisCurve and OffsetValue. They complement the adaptor for the case of offset curves. These methods are used in Extrema_GenExtCS.cxx to restrict domain search in the case of offset of hyperbola, in order to get rid of floating point overflow. All classes inheriting Adaptor3d_Curve have been changed to implement the new virtual methods.

- Protection against division by zero has been implemented in ApproxInt_KnotTools.cxx, BRepClass3d_SClassifier.cxx, BRepGProp_Face.cxx, BRepMesh_FastDiscretFace.cxx, Geom2dGcc_Circ2d2TanOnIter.cxx, Geom2dInt_Geom2dCurveTool.cxx, IntPolyh_MaillageAffinage.cxx.

- Protection against calling of math functions of infinite arguments has been added in BRepCheck_Edge.cxx, BRepLib.cxx, CSLib_NormalPolyDef.cxx, Extrema_FuncExtPC.gxx, Extrema_GExtPC.gxx, Extrema_GLocateExtPC.gxx, Intf_InterferencePolygonPolyhedron.gxx, ShapeAnalysis_Surface.cxx, ShapeAnalysis_TransferParametersProj.cxx, ShapeAnalysis_Wire.cxx, math_FunctionSetRoot.cxx.

- Proper initialization of local variables is done in BOPAlgo_PaveFiller_6.cxx, XSDRAWSTLVRML.cxx.

- Inconsistent usage of Standard_Boolean* to access integer data in HLR (caused by #27772) is corrected

Some test cases have been updated to actual state.
This commit is contained in:
ifv
2016-08-09 20:12:59 +03:00
committed by kgv
parent 73594f7248
commit f4dee9bb20
48 changed files with 595 additions and 228 deletions

View File

@@ -415,7 +415,7 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (Standard_Boolean)(n1 == -1)) {
if (o[l] != (n1 == -1)) {
if (l == 0 && npi == 1) {
p[0] = p[1];
o[0] = o[1];
@@ -434,7 +434,7 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
for (l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (Standard_Boolean)(n1 == -1)) {
if (o[l] != (n1 == -1)) {
if (l == 0 && npi == 1) {
p[0] = p[1];
o[0] = o[1];
@@ -560,7 +560,7 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
for (l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (Standard_Boolean)(n1 == -1)) {
if (o[l] != (n1 == -1)) {
if (l == 0 && npi == 1) {
p[0] = p[1];
o[0] = o[1];
@@ -579,7 +579,7 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
for (l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (Standard_Boolean)(n1 == -1)) {
if (o[l] != (n1 == -1)) {
if (l == 0 && npi == 1) {
p[0] = p[1];
o[0] = o[1];
@@ -705,7 +705,7 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
for (l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (Standard_Boolean)(n1 == -1)) {
if (o[l] != (n1 == -1)) {
if (l == 0 && npi == 1) {
p[0] = p[1];
o[0] = o[1];
@@ -724,7 +724,7 @@ void HLRAlgo_PolyData::hideByOneTriangle (const Standard_Address Coordinates,
for (l = 0; l <= npi; l++) {
if (m[l]) {
OutSideP = Standard_True;
if (o[l] != (Standard_Boolean)(n1 == -1)) {
if (o[l] != (n1 == -1)) {
if (l == 0 && npi == 1) {
p[0] = p[1];
o[0] = o[1];

View File

@@ -25,12 +25,12 @@ IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyInternalData,MMgt_TShared)
#define Tri1Node1 ((Standard_Integer*)Tri1Indices)[0]
#define Tri1Node2 ((Standard_Integer*)Tri1Indices)[1]
#define Tri1Node3 ((Standard_Integer*)Tri1Indices)[2]
#define Tri1Flags ((Standard_Boolean*)Tri1Indices)[3]
#define Tri1Flags ((Standard_Integer*)Tri1Indices)[3]
#define Tri2Node1 ((Standard_Integer*)Tri2Indices)[0]
#define Tri2Node2 ((Standard_Integer*)Tri2Indices)[1]
#define Tri2Node3 ((Standard_Integer*)Tri2Indices)[2]
#define Tri2Flags ((Standard_Boolean*)Tri2Indices)[3]
#define Tri2Flags ((Standard_Integer*)Tri2Indices)[3]
#define Seg1LstSg1 ((Standard_Integer*)Seg1Indices)[0]
#define Seg1LstSg2 ((Standard_Integer*)Seg1Indices)[1]
@@ -47,9 +47,9 @@ IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyInternalData,MMgt_TShared)
#define Seg2Conex2 ((Standard_Integer*)Seg2Indices)[5]
#define Nod1NdSg ((Standard_Integer*)Nod1Indices)[0]
#define Nod1Flag ((Standard_Boolean*)Nod1Indices)[1]
#define Nod1Edg1 ((Standard_Boolean*)Nod1Indices)[2]
#define Nod1Edg2 ((Standard_Boolean*)Nod1Indices)[3]
#define Nod1Flag ((Standard_Integer*)Nod1Indices)[1]
#define Nod1Edg1 ((Standard_Integer*)Nod1Indices)[2]
#define Nod1Edg2 ((Standard_Integer*)Nod1Indices)[3]
#define Nod1PntX ((Standard_Real*)Nod1RValues)[ 0]
#define Nod1PntY ((Standard_Real*)Nod1RValues)[ 1]
@@ -64,9 +64,9 @@ IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyInternalData,MMgt_TShared)
#define Nod1Scal ((Standard_Real*)Nod1RValues)[10]
#define Nod2NdSg ((Standard_Integer*)Nod2Indices)[0]
#define Nod2Flag ((Standard_Boolean*)Nod2Indices)[1]
#define Nod2Edg1 ((Standard_Boolean*)Nod2Indices)[2]
#define Nod2Edg2 ((Standard_Boolean*)Nod2Indices)[3]
#define Nod2Flag ((Standard_Integer*)Nod2Indices)[1]
#define Nod2Edg1 ((Standard_Integer*)Nod2Indices)[2]
#define Nod2Edg2 ((Standard_Integer*)Nod2Indices)[3]
#define Nod2PntX ((Standard_Real*)Nod2RValues)[ 0]
#define Nod2PntY ((Standard_Real*)Nod2RValues)[ 1]
@@ -81,9 +81,9 @@ IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyInternalData,MMgt_TShared)
#define Nod2Scal ((Standard_Real*)Nod2RValues)[10]
#define Nod3NdSg ((Standard_Integer*)Nod3Indices)[0]
#define Nod3Flag ((Standard_Boolean*)Nod3Indices)[1]
#define Nod3Edg1 ((Standard_Boolean*)Nod3Indices)[2]
#define Nod3Edg2 ((Standard_Boolean*)Nod3Indices)[3]
#define Nod3Flag ((Standard_Integer*)Nod3Indices)[1]
#define Nod3Edg1 ((Standard_Integer*)Nod3Indices)[2]
#define Nod3Edg2 ((Standard_Integer*)Nod3Indices)[3]
#define Nod3PntX ((Standard_Real*)Nod3RValues)[ 0]
#define Nod3PntY ((Standard_Real*)Nod3RValues)[ 1]
@@ -98,9 +98,9 @@ IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyInternalData,MMgt_TShared)
#define Nod3Scal ((Standard_Real*)Nod3RValues)[10]
#define Nod4NdSg ((Standard_Integer*)Nod4Indices)[0]
#define Nod4Flag ((Standard_Boolean*)Nod4Indices)[1]
#define Nod4Edg1 ((Standard_Boolean*)Nod4Indices)[2]
#define Nod4Edg2 ((Standard_Boolean*)Nod4Indices)[3]
#define Nod4Flag ((Standard_Integer*)Nod4Indices)[1]
#define Nod4Edg1 ((Standard_Integer*)Nod4Indices)[2]
#define Nod4Edg2 ((Standard_Integer*)Nod4Indices)[3]
#define Nod4PntX ((Standard_Real*)Nod4RValues)[ 0]
#define Nod4PntY ((Standard_Real*)Nod4RValues)[ 1]