0030149: BRepMesh_Delaun: free triangle is left in the mesh after cleanup of auxiliar... IR-2019-03-07
authoroan <oan@opencascade.com>
Wed, 6 Mar 2019 11:29:57 +0000 (14:29 +0300)
committerapn <apn@opencascade.com>
Thu, 7 Mar 2019 15:11:43 +0000 (18:11 +0300)
Remove free triangles connected to triangles over nodes of super triangle.
Modification of improved test case.

src/BRepMesh/BRepMesh_Delaun.cxx
tests/bugs/mesh/bug30149 [new file with mode: 0644]
tests/mesh/data/standard/U5

index ea93a6a..8b6e96d 100644 (file)
@@ -682,7 +682,7 @@ void BRepMesh_Delaun::cleanupMesh()
         if ( anEdges[aCurEdgeIdx] != aFreeEdgeId )
           continue;
 
         if ( anEdges[aCurEdgeIdx] != aFreeEdgeId )
           continue;
 
-        for ( Standard_Integer anOtherEdgeIt = 1; anOtherEdgeIt <= 2; ++anOtherEdgeIt )
+        for ( Standard_Integer anOtherEdgeIt = 1; anOtherEdgeIt <= 2 && isCanNotBeRemoved; ++anOtherEdgeIt )
         {
           Standard_Integer anOtherEdgeId = ( aCurEdgeIdx + anOtherEdgeIt ) % 3;
           const BRepMesh_PairOfIndex& anOtherEdgePair = 
         {
           Standard_Integer anOtherEdgeId = ( aCurEdgeIdx + anOtherEdgeIt ) % 3;
           const BRepMesh_PairOfIndex& anOtherEdgePair = 
@@ -691,7 +691,27 @@ void BRepMesh_Delaun::cleanupMesh()
           if ( anOtherEdgePair.Extent() < 2 )
           {
             isCanNotBeRemoved = Standard_False;
           if ( anOtherEdgePair.Extent() < 2 )
           {
             isCanNotBeRemoved = Standard_False;
-            break;
+          }
+          else
+          {
+            for (int aTriIdx = 1; aTriIdx <= anOtherEdgePair.Extent () && isCanNotBeRemoved; ++aTriIdx)
+            {
+              if (anOtherEdgePair.Index (aTriIdx) == aTriId)
+                continue;
+
+              Standard_Integer v[3];
+              const BRepMesh_Triangle& aCurTriangle = GetTriangle (anOtherEdgePair.Index (aTriIdx));
+              myMeshData->ElementNodes (aCurTriangle, v);
+              for (int aNodeIdx = 0; aNodeIdx < 3 && isCanNotBeRemoved; ++aNodeIdx)
+              {
+                if (v[aNodeIdx] == mySupVert[0] ||
+                    v[aNodeIdx] == mySupVert[1] ||
+                    v[aNodeIdx] == mySupVert[2])
+                {
+                  isCanNotBeRemoved = Standard_False;
+                }
+              }
+            }
           }
         }
 
           }
         }
 
diff --git a/tests/bugs/mesh/bug30149 b/tests/bugs/mesh/bug30149
new file mode 100644 (file)
index 0000000..7c0144b
--- /dev/null
@@ -0,0 +1,26 @@
+puts "======="
+puts "0030149: BRepMesh_Delaun: free triangle is left in the mesh after cleanup of auxiliary items"
+puts "======="
+puts ""
+
+pload XDE 
+
+stepread [locate_data_file bug30149_comb_bug.step] a *
+renamevar a_1 result
+
+tclean result
+incmesh result 1
+
+set info_bad [tricheck result]
+if { [regexp "Not connected mesh inside face" $info_bad] } {
+    puts "Error : Mesh contains free triangle"
+}
+
+checktrinfo result -tri 32 -nod 54
+
+vinit
+vtop
+vsetdispmode 1
+vdisplay result
+vfit
+checkview -screenshot -3d -path ${imagedir}/${test_image}.png
index 7b1ea78..a0c8af9 100755 (executable)
@@ -1,6 +1,6 @@
 set TheFileName shading_wrongshape_007.brep
 if { [string compare $command "shading"] == 0 } {
 set TheFileName shading_wrongshape_007.brep
 if { [string compare $command "shading"] == 0 } {
-  set bug_freelinks "OCC22687"
+##   set bug_freelinks "OCC22687"
   set bug_freenodes "OCC22687"
   set nbfreenodes(All) 6
   set nbfree(All) 3
   set bug_freenodes "OCC22687"
   set nbfreenodes(All) 6
   set nbfree(All) 3