diff --git a/src/BRepMesh/BRepMesh_CurveTessellator.cxx b/src/BRepMesh/BRepMesh_CurveTessellator.cxx index c8e942ec3a..ac17847667 100644 --- a/src/BRepMesh/BRepMesh_CurveTessellator.cxx +++ b/src/BRepMesh/BRepMesh_CurveTessellator.cxx @@ -226,7 +226,7 @@ Standard_Boolean BRepMesh_CurveTessellator::isInToleranceOfVertex ( const TopoDS_Vertex& theVertex) const { const gp_Pnt aPoint = BRep_Tool::Pnt(theVertex); - const Standard_Real aTolerance = BRep_Tool::Tolerance(theVertex); + const Standard_Real aTolerance = BRep_Tool::Tolerance(theVertex) * 1.1; return (thePoint.SquareDistance (aPoint) < aTolerance * aTolerance); } @@ -243,9 +243,9 @@ Standard_Boolean BRepMesh_CurveTessellator::Value ( thePoint = myDiscretTool.Value (theIndex); theParameter = myDiscretTool.Parameter (theIndex); - /*if (!isInToleranceOfVertex(thePoint, myFirstVertex) && + if (!isInToleranceOfVertex(thePoint, myFirstVertex) && !isInToleranceOfVertex(thePoint, myLastVertex)) - {*/ + { if (!myCurve.IsCurveOnSurface()) { return Standard_True; @@ -281,9 +281,9 @@ Standard_Boolean BRepMesh_CurveTessellator::Value ( aSurface->D0(aUV.X(), aUV.Y(), aPntOnSurf); return (thePoint.SquareDistance(aPntOnSurf) < myEdgeSqTol); - /*} + } - return Standard_False;*/ + return Standard_False; } //======================================================================= diff --git a/tests/bugs/mesh/bug31395 b/tests/bugs/mesh/bug31395 new file mode 100644 index 0000000000..6c07dd6e02 --- /dev/null +++ b/tests/bugs/mesh/bug31395 @@ -0,0 +1,22 @@ +puts "========" +puts "0031395: Mesh - BRepMesh produces poor mesh on shape with hidden self-intersections" +puts "========" +puts "" + +restore [locate_data_file log368.brep] result + +tclean result +incmesh result 0.2 + +vinit +vsetdispmode 1 +vdefaults -autoTriang 0 + +checkview -display result -3d -path ${imagedir}/${test_image}.png + +set log [tricheck result] +if { [llength $log] != 0 } { + puts "Error : Invalid mesh" +} else { + puts "Mesh is OK" +}