From 99c008e90f4d457acda2bfe39dc4cbf6a051e241 Mon Sep 17 00:00:00 2001 From: oan Date: Wed, 17 Feb 2016 17:17:54 +0300 Subject: [PATCH] 0026384: Add explicit check for null magnitude instead of catching of exception in BRepMesh_FastDiscretFace::control() Check normal for null magnitude using gp::Resolution () --- src/BRepMesh/BRepMesh_FastDiscretFace.cxx | 31 ++++++++++------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/BRepMesh/BRepMesh_FastDiscretFace.cxx b/src/BRepMesh/BRepMesh_FastDiscretFace.cxx index dd1fe61688..04400d19e0 100644 --- a/src/BRepMesh/BRepMesh_FastDiscretFace.cxx +++ b/src/BRepMesh/BRepMesh_FastDiscretFace.cxx @@ -1227,29 +1227,24 @@ Standard_Real BRepMesh_FastDiscretFace::control( Standard_Real aSqDef = -1.; Standard_Boolean isSkipped = Standard_False; gp_XYZ normal(aLinkVec[0] ^ aLinkVec[1]); - try - { - OCC_CATCH_SIGNALS + if (normal.SquareModulus () < gp::Resolution()) + continue; - normal.Normalize(); + normal.Normalize(); - // Check deflection on triangle - gp_XY mi2d = (xy[0] + xy[1] + xy[2]) / 3.0; - gFace->D0(mi2d.X(), mi2d.Y(), pDef); - aSqDef = Abs(normal * (pDef.XYZ() - p[0])); - aSqDef *= aSqDef; + // Check deflection at triangle centroid + gp_XY aCenter2d = (xy[0] + xy[1] + xy[2]) / 3.0; + gFace->D0(aCenter2d.X(), aCenter2d.Y(), pDef); + aSqDef = Abs(normal * (pDef.XYZ() - p[0])); + aSqDef *= aSqDef; - isSkipped = !checkDeflectionAndInsert(pDef, mi2d, theIsFirst, - aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef); + isSkipped = !checkDeflectionAndInsert(pDef, aCenter2d, theIsFirst, + aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef); - if (isSkipped) - break; - } - catch (Standard_Failure) - { - continue; - } + if (isSkipped) + break; + // Check deflection at triangle links for (Standard_Integer i = 0; i < 3 && !isSkipped; ++i) { if (m[i]) // is a boundary -- 2.39.5