]> OCCT Git - occt.git/commitdiff
0025469: BRepMesh corrupts triangulation of another not connected shape
authoroan <oan@opencascade.com>
Fri, 21 Nov 2014 11:15:34 +0000 (14:15 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 21 Nov 2014 11:19:28 +0000 (14:19 +0300)
Do not clean polygons that are created for different faces not connected with current shape.
Remove old code producing additional points for BSpline curves due to fix #24959.

Test cases fir issue CR25469

Revert changes producing additional points for BSpline curves with C1 continuity

Test cases fir issue CR25469

Correction of test cases for issue CR25469

src/BRepMesh/BRepMesh_EdgeTessellator.cxx
src/BRepMesh/BRepMesh_IncrementalMesh.cxx
tests/bugs/mesh/bug23631
tests/bugs/mesh/bug25469_1 [new file with mode: 0644]
tests/bugs/mesh/bug25469_2 [new file with mode: 0644]
tests/bugs/mesh/bug25469_3 [new file with mode: 0755]
tests/bugs/mesh/bug25479 [new file with mode: 0644]
tests/bugs/modalg_4/bug22383

index 2347a2840fe59ae88755d6b38acb54944fcdc1f9..1a4f4d4a51c233f55f1d552b80095b1b697f3e0a 100644 (file)
@@ -97,7 +97,7 @@ BRepMesh_EdgeTessellator::BRepMesh_EdgeTessellator(
       }
     }
   }
-
+  
   // PTv, chl/922/G9, Take into account internal vertices
   // it is necessary for internal edges, which do not split other edges, by their vertex
   TopExp_Explorer aVertexIt(theEdge, TopAbs_VERTEX);
index 7460b1cf95fd99e78864edede6ebc30fc43041e3..9c614e9fb40d094c324f60bc4b7b97556e0b6fcc 100644 (file)
@@ -374,6 +374,30 @@ void BRepMesh_IncrementalMesh::update(const TopoDS_Edge& theEdge)
       {
         continue;
       }
+      else
+      {
+        // Check that triangulation relies to face of the given shape.
+        const TopTools_IndexedDataMapOfShapeListOfShape& aMapOfSharedFaces = 
+          myMesh->SharedFaces();
+
+        const TopTools_ListOfShape& aSharedFaces = 
+          aMapOfSharedFaces.FindFromKey(theEdge);
+
+        Standard_Boolean isCurrentShape = Standard_False;
+        TopTools_ListIteratorOfListOfShape aSharedFaceIt(aSharedFaces);
+        for (; aSharedFaceIt.More() && !isCurrentShape; aSharedFaceIt.Next())
+        {
+          TopLoc_Location aLoc;
+          const TopoDS_Face& aFace = TopoDS::Face(aSharedFaceIt.Value());
+          Handle(Poly_Triangulation) aFaceTriangulation = 
+            BRep_Tool::Triangulation(aFace, aLoc);
+
+          isCurrentShape = (aFaceTriangulation == aTriangulation);
+        }
+
+        if (!isCurrentShape)
+          continue;
+      }
 
       myModified = Standard_True;
       BRepMesh_ShapeTool::NullifyEdge(theEdge, aTriangulation, aLoc);
@@ -397,7 +421,7 @@ Standard_Boolean BRepMesh_IncrementalMesh::toBeMeshed(
   const Standard_Boolean isWithCheck)
 {
   TopLoc_Location aLoc;
-  Handle(Poly_Triangulation) aTriangulation = 
+  const Handle(Poly_Triangulation)& aTriangulation = 
     BRep_Tool::Triangulation(theFace, aLoc);
 
   if (aTriangulation.IsNull())
@@ -514,7 +538,7 @@ void BRepMesh_IncrementalMesh::commitEdges(const TopoDS_Face& theFace)
     return;
   }
 
-  TopLoc_Location            aLoc = aFace.Location();
+  TopLoc_Location aLoc;
   Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(aFace, aLoc);
 
   if (aTriangulation.IsNull())
index e80c600b9d9d4645437c6b60337559068cd4f8f6..41ff351fdc94a363d9bb88a1cb858cdcbaf559a8 100644 (file)
@@ -16,8 +16,8 @@ triangles result
 set tri 0
 set nod 0
 
-set good_tri 31
-set good_nod 33
+set good_tri 38
+set good_nod 40
 
 set tri_info [trinfo result]
 regexp { +([-0-9.+eE]+) +triangles} $tri_info full tri
diff --git a/tests/bugs/mesh/bug25469_1 b/tests/bugs/mesh/bug25469_1
new file mode 100644 (file)
index 0000000..54ea29a
--- /dev/null
@@ -0,0 +1,30 @@
+puts "========="
+puts "CR25469"
+puts "========="
+puts ""
+###############################################
+# BRepMesh corrupts triangulation of another not connected shape
+###############################################
+
+restore [locate_data_file bug25469_common_edge.brep] a
+
+explode a
+
+incmesh a_1 0.04
+set report [tricheck a_1]
+if {$report != ""} {
+   puts "Error: incorrect meshing of shape 1"
+}
+
+incmesh a_2 0.04
+set report [tricheck a_1]
+if {$report != ""} {
+   puts "Error: meshing of shape 2 corrupts mesh of shape 1"
+}
+
+vinit
+vsetdispmode 1
+vdisplay a_1 a_2
+vfit
+
+set only_screen 1
diff --git a/tests/bugs/mesh/bug25469_2 b/tests/bugs/mesh/bug25469_2
new file mode 100644 (file)
index 0000000..64b16f4
--- /dev/null
@@ -0,0 +1,34 @@
+puts "========="
+puts "CR25469"
+puts "========="
+puts ""
+###############################################
+# BRepMesh corrupts triangulation of another not connected shape
+###############################################
+
+restore [locate_data_file bug25469_common_edge.brep] a
+
+explode a
+explode a_1
+explode a_2
+
+ttranslate a_2_1 -100 -220 0
+
+incmesh a_1_1 0.04
+set report [tricheck a_1_1]
+if {$report != ""} {
+   puts "Error: incorrect meshing of shape 1"
+}
+
+incmesh a_2_1 0.04
+set report [tricheck a_1_1 a_2_1]
+if {$report != ""} {
+   puts "Error: meshing of shape 2 corrupts mesh of shape 1"
+}
+
+vinit
+vsetdispmode 1
+vdisplay a_1_1 a_2_1
+vfit
+
+set only_screen 1
diff --git a/tests/bugs/mesh/bug25469_3 b/tests/bugs/mesh/bug25469_3
new file mode 100755 (executable)
index 0000000..b8c5e66
--- /dev/null
@@ -0,0 +1,42 @@
+puts "TODO CR25469 ALL: Error : Colors are not equal in default coordinate and in the near coordinates too"
+
+puts "========="
+puts "CR25469"
+puts "========="
+puts ""
+###############################################
+# BRepMesh corrupts triangulation of another not connected shape
+###############################################
+
+pload QAcommands
+
+restore [locate_data_file bug25469_bad_tria.brep] a
+tclean a
+incmesh a 0.001
+triangles a
+isos a 0
+
+donly a
+top
+fit
+
+vinit
+vsetdispmode 1
+vdisplay a
+vtop
+vfit
+vmoveto 200 150
+
+dlog reset
+dlog off
+checkcolor 64 200 1 0.72549021244049072 0.12941177189350128
+dlog on
+
+if { ${stat} == 1} {
+   puts "Error : Bad triangulation"
+} else {
+   puts "OK : Good triangulation"
+}
+
+xwd ${imagedir}/${test_image}_1.png
+vdump ${imagedir}/${test_image}_2.png
diff --git a/tests/bugs/mesh/bug25479 b/tests/bugs/mesh/bug25479
new file mode 100644 (file)
index 0000000..d5a69c6
--- /dev/null
@@ -0,0 +1,33 @@
+puts "========="
+puts "CR25479"
+puts "========="
+puts ""
+###############################################
+# BRepTools::Clean() cleans all edge polygons, even related to different shapes
+###############################################
+
+restore [locate_data_file bug25469_common_edge.brep] a
+
+tclean a
+incmesh a 0.004
+
+explode a
+
+incmesh a_1 0.04
+set report [tricheck a_1]
+if {$report != ""} {
+   puts "Error: incorrect meshing of shape"
+}
+
+tclean a_2
+set report [tricheck a_1]
+if {$report != ""} {
+   puts "Error: cleaning mesh of shape 2 corrupts mesh of shape 1"
+}
+
+vinit
+vsetdispmode 1
+vdisplay a_1 a_2
+vfit
+
+set only_screen 1
index 7980b02b0c047795e0ac744364a9173881b9f73a..995ddce3ba8a862b1a6cb648b166edae6644bbbe 100755 (executable)
@@ -29,7 +29,7 @@ puts $nbpoints
 ## must be less than number on clear occ651
 
 set status 0
-if {$nbpoints < $good_trip} {
+if {$nbpoints <= $good_trip} {
   set status 1
 }