From: duv Date: Mon, 26 Jun 2017 08:22:24 +0000 (+0300) Subject: 0028731: Restore Face Orientation tool runs very slow for specific CAD files X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=276356c90bac8801ffa70b2a8c8e379a30864fe1;p=occt-copy.git 0028731: Restore Face Orientation tool runs very slow for specific CAD files --- diff --git a/src/BRepMesh/BRepMesh_RestoreOrientationTool.cxx b/src/BRepMesh/BRepMesh_RestoreOrientationTool.cxx index 3270da0d7f..77ad33346f 100644 --- a/src/BRepMesh/BRepMesh_RestoreOrientationTool.cxx +++ b/src/BRepMesh/BRepMesh_RestoreOrientationTool.cxx @@ -60,6 +60,9 @@ const Standard_Real COHERENCY_WEIGHT = 50.0; // Indicates that ray does not hit any geometry. const Standard_Integer INVALID_HIT = -1; +//! Maximum number of attempts for rejection sampling. +const int MAX_SAMPLING_ATTEMPTS = 10; + //! Samples value from array according to probabilities. Standard_Integer sampleValue (Standard_Real theKsi, const std::vector& theCDF) { @@ -389,11 +392,16 @@ void BRepMesh_RestoreOrientationTool::computeVisibility (BVH_Triangulation 1.0); + + if (aKsi + aPsi > 1.0) + { + break; + } + } const BVH_Vec3d& aPoint0 = thePatch->Vertices[aTriangle.x()]; const BVH_Vec3d& aPoint1 = thePatch->Vertices[aTriangle.y()]; @@ -412,7 +420,7 @@ void BRepMesh_RestoreOrientationTool::computeVisibility (BVH_Triangulation