]> OCCT Git - occt-copy.git/commitdiff
0030497: [REGRESSION] Mesh - wrong Poly_Polygon3D within local selection of located...
authornds <nds@opencascade.com>
Thu, 7 Mar 2019 13:18:59 +0000 (16:18 +0300)
committernds <nds@opencascade.com>
Thu, 7 Mar 2019 13:18:59 +0000 (16:18 +0300)
The previous code has a condition to avoid processing the same faces if the face has a location.
The similar condition should be applied during the edges processing.
If not doing this, in the previous implementation, IMeshData_Edge instances are created for all edges(even located), but edges of faces located are not filled with curves.
As a result we had wrong local selection of edges.

Limit addition of edges to data model by ones with unique TShape and location using edges map already available in BRepMesh_ShapeVisitor.

(cherry picked from commit 967d2f4f301c079f3cbe689d88dad155bae2dada)

src/BRepMesh/BRepMesh_ShapeVisitor.cxx
src/IMeshTools/IMeshTools_ShapeExplorer.cxx
tests/bugs/mesh/bug25364
tests/bugs/moddata_3/bug30497

index 791810b7d24c0cfc750a4722e5f71af2fe5c6f01..0705c13cf033df8af2b511496a4a276432b38c10 100644 (file)
@@ -57,8 +57,11 @@ BRepMesh_ShapeVisitor::~BRepMesh_ShapeVisitor ()
 //=======================================================================
 void BRepMesh_ShapeVisitor::Visit(const TopoDS_Edge& theEdge)
 {
-  myModel->AddEdge(theEdge);
-  myDEdgeMap.Bind(theEdge, myModel->EdgesNb() - 1);
+  if (!myDEdgeMap.IsBound (theEdge))
+  {
+    myModel->AddEdge (theEdge);
+    myDEdgeMap.Bind  (theEdge, myModel->EdgesNb () - 1);
+  }
 }
 
 //=======================================================================
index ba7636f08c02b6268d7a0f5eda80dc16003e0e02..2dc244a73cdfd7a1bc3c29b6140e4ac16a5eab62 100644 (file)
 #include <TopTools_MapOfShape.hxx>
 #include <Geom_Surface.hxx>
 
+namespace
+{
+  //=======================================================================
+  // Function: visitEdges
+  // Purpose : Explodes the given shape on edges according to the specified
+  //           criteria and visits each one in order to add it to data model.
+  //=======================================================================
+  void visitEdges (const Handle (IMeshTools_ShapeVisitor)& theVisitor,
+                   const TopoDS_Shape&                     theShape,
+                   const TopAbs_ShapeEnum                  theToFind,
+                   const TopAbs_ShapeEnum                  theToAvoid = TopAbs_SHAPE)
+  {
+    TopExp_Explorer aEdgesIt (theShape, theToFind, theToAvoid);
+    for (; aEdgesIt.More (); aEdgesIt.Next ())
+    {
+      const TopoDS_Edge& aEdge = TopoDS::Edge (aEdgesIt.Current ());
+      if (!BRep_Tool::IsGeometric (aEdge))
+      {
+        continue;
+      }
+
+      theVisitor->Visit (aEdge);
+    }
+  }
+}
+
 //=======================================================================
 // Function: Constructor
 // Purpose : 
@@ -51,19 +77,10 @@ void IMeshTools_ShapeExplorer::Accept (
   const Handle (IMeshTools_ShapeVisitor)& theVisitor)
 {
   // Explore all free edges in shape.
-  TopExp_Explorer aFreeEdgesIt (GetShape (), TopAbs_EDGE, TopAbs_FACE);
-  for (; aFreeEdgesIt.More(); aFreeEdgesIt.Next())
-  {
-    const TopoDS_Edge& aEdge = TopoDS::Edge (aFreeEdgesIt.Current());
-    if (!BRep_Tool::IsGeometric(aEdge))
-    {
-      continue;
-    }
-
-    theVisitor->Visit (aEdge);
-  }
+  visitEdges (theVisitor, GetShape (), TopAbs_EDGE, TopAbs_FACE);
 
   // Explore all related to some face edges in shape.
+  // make array of faces suitable for processing (excluding faces without surface)
   TopTools_ListOfShape aFaceList;
   BRepLib::ReverseSortFaces (GetShape (), aFaceList);
   TopTools_MapOfShape aFaceMap;
@@ -80,46 +97,15 @@ void IMeshTools_ShapeExplorer::Accept (
       continue; // already processed
     }
 
-    TopoDS_Face aFace = TopoDS::Face (aFaceIter.Value ());
+    const TopoDS_Face& aFace = TopoDS::Face (aFaceIter.Value ());
     const Handle (Geom_Surface)& aSurf = BRep_Tool::Surface (aFace, aDummyLoc);
     if (aSurf.IsNull())
     {
       continue;
     }
 
-    TopExp_Explorer anEdgesExp (aFace, TopAbs_EDGE);
-    for (; anEdgesExp.More(); anEdgesExp.Next())
-    {
-      const TopoDS_Edge& aEdge =  TopoDS::Edge (anEdgesExp.Current());
-      if (!BRep_Tool::IsGeometric(aEdge))
-      {
-        continue;
-      }
-
-      theVisitor->Visit (aEdge);
-    }
-  }
-
-  // Explore faces
-  aFaceMap.Clear();
-
-  // make array of faces suitable for processing (excluding faces without surface)
-  aFaceIter.Init (aFaceList);
-  for (; aFaceIter.More (); aFaceIter.Next ())
-  {
-    TopoDS_Shape aFaceNoLoc = aFaceIter.Value ();
-    aFaceNoLoc.Location (aEmptyLoc);
-    if (!aFaceMap.Add(aFaceNoLoc))
-    {
-      continue; // already processed
-    }
-
-    TopoDS_Face aFace = TopoDS::Face (aFaceIter.Value ());
-    const Handle (Geom_Surface)& aSurf = BRep_Tool::Surface (aFace, aDummyLoc);
-    if (aSurf.IsNull())
-    {
-      continue;
-    }
+    // Explore all edges in face.
+    visitEdges (theVisitor, aFace, TopAbs_EDGE);
 
     // Store only forward faces in order to prevent inverse issue.
     theVisitor->Visit (TopoDS::Face (aFace.Oriented (TopAbs_FORWARD)));
index 0ef6bc404e9db03bc090c2209616ce15ce06ce22..a4544ad76d18c373acbbb4b15dd42938da1e4f00 100755 (executable)
@@ -68,7 +68,7 @@ set mem_delta_private 200
 set mem_delta_swap 120
 set mem_delta_swappeak 250
 set mem_delta_wset 200
-set mem_delta_wsetpeak 220
+set mem_delta_wsetpeak 300
 set mem_delta_virt 220
 set mem_delta_heap 80
 
index 239b481730649c97cf6dfd00037d2adf69f9322e..0fb0e7f0b97696291a662ff9857a77d309456e8c 100644 (file)
@@ -1,13 +1,10 @@
 puts "======="
-puts "0030497"
+puts "0030497 \[REGRESSION\] Mesh - wrong Poly_Polygon3D within local selection of located shape"
 puts "======="
 puts ""
-##################################################
-# [REGRESSION] Mesh - wrong Poly_Polygon3D within local selection of located shape
-##################################################
 
-pload XDE VISUALIZATION
-testreadstep as1-oc-214-mat.stp s
+pload XDE
+testreadstep [locate_data_file as1-oc-214-mat.stp] s
 
 vclear
 vinit View1
@@ -16,3 +13,5 @@ vdisplay s -dispmode 1
 vfit
 vselmode 2 1
 vmoveto 150 201
+
+vdump ${imagedir}/${casename}.png