]> OCCT Git - occt.git/commitdiff
0028163: 3D Offset algorithm produces incorrect result on attached shape in mode...
authoremv <emv@opencascade.com>
Fri, 18 Nov 2016 07:06:50 +0000 (10:06 +0300)
committerapn <apn@opencascade.com>
Thu, 8 Dec 2016 13:28:42 +0000 (16:28 +0300)
1. Correct building of the lists of intersection faces connected to the same vertex.
2. For the artificially invalid cases with only one invalid face avoid usage of the edges having same origins as invalid edges.
3. Test cases for the issue.
4. Test cases offset shape_type_i_c XM1, ZW*,ZX*,ZY* have been modified to provide more clear result.
5. TODO statements have been removed from the test case offset shape_type_i_c XE6 as it is OK.
6. Test case offset shape_type_i_c ZZ2 is improvement.

34 files changed:
src/BRepOffset/BRepOffset_Inter3d.cxx
src/BRepOffset/BRepOffset_MakeOffset_1.cxx
tests/offset/shape_type_i_c/XE6
tests/offset/shape_type_i_c/XM1
tests/offset/shape_type_i_c/XM4 [new file with mode: 0644]
tests/offset/shape_type_i_c/XM5 [new file with mode: 0644]
tests/offset/shape_type_i_c/XM6 [new file with mode: 0644]
tests/offset/shape_type_i_c/XM7 [new file with mode: 0644]
tests/offset/shape_type_i_c/XM8 [new file with mode: 0644]
tests/offset/shape_type_i_c/XM9 [new file with mode: 0644]
tests/offset/shape_type_i_c/XN1 [new file with mode: 0644]
tests/offset/shape_type_i_c/XN2 [new file with mode: 0644]
tests/offset/shape_type_i_c/ZW1
tests/offset/shape_type_i_c/ZW2
tests/offset/shape_type_i_c/ZW3
tests/offset/shape_type_i_c/ZW4
tests/offset/shape_type_i_c/ZW5
tests/offset/shape_type_i_c/ZW6
tests/offset/shape_type_i_c/ZW7
tests/offset/shape_type_i_c/ZW8
tests/offset/shape_type_i_c/ZW9
tests/offset/shape_type_i_c/ZX1
tests/offset/shape_type_i_c/ZX2
tests/offset/shape_type_i_c/ZX3
tests/offset/shape_type_i_c/ZX4
tests/offset/shape_type_i_c/ZX9
tests/offset/shape_type_i_c/ZY1
tests/offset/shape_type_i_c/ZY4
tests/offset/shape_type_i_c/ZY5
tests/offset/shape_type_i_c/ZY6
tests/offset/shape_type_i_c/ZY7
tests/offset/shape_type_i_c/ZY8
tests/offset/shape_type_i_c/ZZ1
tests/offset/shape_type_i_c/ZZ2

index 9460d58346c30db13c587b3983bfd1cb3abca906..b89e1f030a588d1b13bac5ac4800dabf133df912 100644 (file)
@@ -443,7 +443,35 @@ void BRepOffset_Inter3d::ConnexIntByInt
   // map the shape for vertices
   if (bIsPlanar) {
     TopExp::MapShapes(SI, TopAbs_VERTEX, VEmap);
-    TopExp::MapShapesAndAncestors(SI, TopAbs_VERTEX, TopAbs_FACE, aMVF);
+    //
+    // make vertex-faces connexity map with unique ancestors
+    // TopExp::MapShapesAndAncestors(SI, TopAbs_VERTEX, TopAbs_FACE, aMVF);
+    TopExp_Explorer aExpF(SI, TopAbs_FACE);
+    for (; aExpF.More(); aExpF.Next()) {
+      const TopoDS_Shape& aF = aExpF.Current();
+      //
+      TopExp_Explorer aExpV(aF, TopAbs_VERTEX);
+      for (; aExpV.More(); aExpV.Next()) {
+        const TopoDS_Shape& aV = aExpV.Current();
+        //
+        TopTools_ListOfShape *pLF = aMVF.ChangeSeek(aV);
+        if (!pLF) {
+          pLF = &aMVF(aMVF.Add(aV, TopTools_ListOfShape()));
+          pLF->Append(aF);
+          continue;
+        }
+        //
+        TopTools_ListIteratorOfListOfShape aItLF(*pLF);
+        for (; aItLF.More(); aItLF.Next()) {
+          if (aItLF.Value().IsSame(aF)) {
+            break;
+          }
+        }
+        if (!aItLF.More()) {
+          pLF->Append(aF);
+        }
+      }
+    }
   }
   //
   TopTools_DataMapOfShapeListOfShape aDMVLF1, aDMVLF2, aDMIntFF;
@@ -462,19 +490,15 @@ void BRepOffset_Inter3d::ConnexIntByInt
       if (aLF.Extent() < 2) {
         continue;
       }
-      //
-      // find pairs in which the vertex is alone (not connected to shared edges)
+      // build lists of faces connected to the same vertex by looking for
+      // the pairs in which the vertex is alone (not connected to shared edges)
       TopTools_ListOfShape aLF1, aLF2;
-      Standard_Boolean bVertexOnly = Standard_False;
-      TopTools_MapOfShape aMFence;
       //
       it.Initialize(aLF);
       for (; it.More(); it.Next()) {
-        const TopoDS_Face& aFV1 = *(TopoDS_Face*)&it.Value();
-        if (!aMFence.Add(aFV1)) {
-          continue;
-        }
+        const TopoDS_Shape& aFV1 = it.Value();
         //
+        // get edges of first face connected to current vertex
         TopTools_MapOfShape aME;
         TopExp_Explorer aExp(aFV1, TopAbs_EDGE);
         for (; aExp.More(); aExp.Next()) {
@@ -488,37 +512,31 @@ void BRepOffset_Inter3d::ConnexIntByInt
           }
         }
         //
-        it1.Initialize(aLF);
+        // get to the next face in the list
+        it1 = it;
         for (it1.Next(); it1.More(); it1.Next()) {
-          const TopoDS_Face& aFV2 = *(TopoDS_Face*)&it1.Value();
-          if (aMFence.Contains(aFV2)) {
-            continue;
-          }
+          const TopoDS_Shape& aFV2 = it1.Value();
           //
-          bVertexOnly = Standard_True;
           aExp.Init(aFV2, TopAbs_EDGE);
           for (; aExp.More(); aExp.Next()) {
             const TopoDS_Shape& aEV2 = aExp.Current();
             if (aME.Contains(aEV2)) {
-              bVertexOnly = Standard_False;
               break;
             }
           }
           //
-          if (bVertexOnly) {
+          if (!aExp.More()) {
+            // faces share only vertex - make pair for intersection
             aLF1.Append(aFV1);
             aLF2.Append(aFV2);
-            aMFence.Add(aFV2);
           }
         }
       }
       //
-      if (aLF1.IsEmpty()) {
-        continue;
+      if (aLF1.Extent()) {
+        aDMVLF1.Bind(aS, aLF1);
+        aDMVLF2.Bind(aS, aLF2);
       }
-      //
-      aDMVLF1.Bind(aS, aLF1);
-      aDMVLF2.Bind(aS, aLF2);
     }
   }
   //
index abc54f034a799fa60582a541a9b7d7951e68172f..0a4b37d7de414540e111c0b5e3e67dbc9d888fec 100644 (file)
@@ -783,19 +783,19 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
       TopTools_ListOfShape aLFImages1;
       BuildSplitsOfFace(aF, aCE1, Standard_False, theFacesOrigins, aLFImages1);
       //
-      // additionally check if newly created faces are not the same
-      Standard_Boolean bAllInv = Standard_True;
+      // check if the rebuilding has added some new faces to the splits
       for (TopTools_ListIteratorOfListOfShape aItLFIm(aLFImages1); aItLFIm.More();)
       {
+        Standard_Boolean bAllInv = Standard_True;
         const TopoDS_Shape& aFIm = aItLFIm.Value();
         TopExp_Explorer aExpE(aFIm, TopAbs_EDGE);
         for (; aExpE.More(); aExpE.Next()) {
           const TopoDS_Shape& aE = aExpE.Current();
-          if (!aMapEInv.Contains(aE) && !aMENInv.Contains(aE)) {
-            break;
-          }
-          else if (bAllInv) {
-            bAllInv = aMapEInv.Contains(aE);
+          if (!aMapEInv.Contains(aE)) {
+            bAllInv = Standard_False;
+            if (!aMENInv.Contains(aE)) {
+              break;
+            }
           }
         }
         //
@@ -1314,12 +1314,14 @@ Standard_Boolean CheckIfArtificial(const TopoDS_Shape& theF,
     TopExp_Explorer aExpV(aEInv, TopAbs_VERTEX);
     for (; aExpV.More(); aExpV.Next()) {
       const TopoDS_Shape& aVEInv = aExpV.Current();
-      if (!aMEUsed.Contains(aVEInv) && aMVE.Contains(aVEInv)) {
-        const TopTools_ListOfShape& aLENInv = aMVE.FindFromKey(aVEInv);
-        TopTools_ListIteratorOfListOfShape aItLEInv(aLENInv);
+      const TopTools_ListOfShape* pLENInv = aMVE.Seek(aVEInv);
+      if (pLENInv) {
+        TopTools_ListIteratorOfListOfShape aItLEInv(*pLENInv);
         for (; aItLEInv.More(); aItLEInv.Next()) {
           const TopoDS_Shape& aENInv = aItLEInv.Value();
-          theMENInv.Add(aENInv);
+          if (!aMEUsed.Contains(aENInv)) {
+            theMENInv.Add(aENInv);
+          }
         }
       }
     }
@@ -1395,7 +1397,7 @@ void FindInvalidEdges(const TopoDS_Face& theF,
   // be defined by the edges on the original face adjacent to the connection vertex
   //
   const TopoDS_Face& aFOr = *(TopoDS_Face*)&theFacesOrigins.Find(theF);
-  // invald edges
+  // invalid edges
   TopTools_IndexedMapOfShape aMEInv;
   // valid edges
   TopTools_MapOfShape aMEVal;
@@ -1479,6 +1481,11 @@ void FindInvalidEdges(const TopoDS_Face& theF,
       TopTools_MapOfShape aME, aMV;
       Standard_Boolean bInvalid = Standard_False, bChecked = Standard_False;
       Standard_Integer aNbP = NbPoints(aEIm);
+      Standard_Boolean bUseVertex = !aNbVOr ? Standard_False :
+        (aNbVOr == 1 &&
+         aDMEF.FindFromKey(aEIm).Extent() == 1 &&
+         !theOEOrigins.IsBound(aEIm));
+      //
       aItLEO.Initialize(aLEOr);
       for (; aItLEO.More(); aItLEO.Next()) {
         const TopoDS_Shape& aSOr = aItLEO.Value();
@@ -1487,18 +1494,9 @@ void FindInvalidEdges(const TopoDS_Face& theF,
         TopoDS_Shape aEOrF;
         if (bVertex) {
           // for some cases it is impossible to check the validity of the edge
-          if (aNbVOr > 1) {
+          if (!bUseVertex) {
             continue;
           }
-          //
-          if (aDMEF.FindFromKey(aEIm).Extent() > 1) {
-            continue;
-          }
-          //
-          if (theOEOrigins.IsBound(aEIm)) {
-            continue;
-          }
-          //
           // find edges on the original face adjacent to this vertex
           if (aDMVEFOr.IsEmpty()) {
             // fill the map
@@ -1579,8 +1577,9 @@ void FindInvalidEdges(const TopoDS_Face& theF,
       }
       //
       // check if the edge has been inverted
-      Standard_Boolean bInverted = CheckInverted(aEIm, aFOr, theOEImages, theOEOrigins,
-        theEdgesOrigins, aDMEF, aDMVE, aMEdges, theMEInverted);
+      Standard_Boolean bInverted = !aNbE ? Standard_False :
+        CheckInverted(aEIm, aFOr, theOEImages, theOEOrigins,
+          theEdgesOrigins, aDMEF, aDMVE, aMEdges, theMEInverted);
       //
       if (!bInverted || !aNbVOr) {
         theValidEdges.Add(aEIm);
@@ -1908,10 +1907,6 @@ Standard_Boolean CheckInverted(const TopoDS_Edge& theEIm,
     return Standard_False;
   }
   //
-  if (theMEInverted.Contains(theEIm)) {
-    return Standard_True;
-  }
-  //
   // it is necessary to compare the direction from first vertex
   // to the last vertex on the original edge with the
   // same direction on the new edge. If the directions
@@ -2013,7 +2008,7 @@ Standard_Boolean CheckInverted(const TopoDS_Edge& theEIm,
           if (aEO.ShapeType() == TopAbs_EDGE && aMFence.Add(aEO)) {
             TopoDS_Shape aEOin;
             if (FindShape(aEO, theFOr, aEOin)) {
-              aLOE.Append(aEO);
+              AppendToList(aLOE, aEO);
             }
           }
         }
@@ -2512,6 +2507,7 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
   //
   TopoDS_Compound aSolids;
   BRep_Builder().MakeCompound(aSolids);
+  TopTools_MapOfShape aMFKeep;
   //
   TopExp_Explorer aExpS(aSols, TopAbs_SOLID);
   for (; aExpS.More(); aExpS.Next()) {
@@ -2538,7 +2534,9 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
         const TopoDS_Shape& aFS = aExpF.Current();
         //
         if (aMFToRem.Contains(aFS)) {
-          aMFToRem.Remove(aFS);
+          if (!aMFKeep.Add(aFS)) {
+            aMFKeep.Remove(aFS);
+          }
         }
         else {
           aMFToRem.Add(aFS);
@@ -2551,6 +2549,11 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
     }
   }
   //
+  TopTools_MapIteratorOfMapOfShape aItM(aMFKeep);
+  for (; aItM.More(); aItM.Next()) {
+    aMFToRem.Remove(aItM.Value());
+  }
+  //
   // remove newly found internal faces
   RemoveValidSplits(aMFToRem, theFImages, aMV, theMERemoved);
   RemoveInvalidSplits(aMFToRem, theArtInvFaces, theInvEdges, theInvFaces, aMV, theMERemoved);
@@ -3320,85 +3323,136 @@ void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebui
   // when dealing with artificially invalid faces for intersection to be
   // complete we need to use not only invalid edges, but also the 
   // edges connected to invalid ones
-  TopTools_MapOfShape aMEAlone, aMFence, aMVEInv;
-  TopTools_IndexedDataMapOfShapeListOfShape aDMVEVal;
-  //
+
+  // find blocks of artificially invalid faces
+  TopTools_DataMapOfShapeShape aDMFImF;
+  TopoDS_Compound aCFArt;
+  BRep_Builder().MakeCompound(aCFArt);
   TopTools_DataMapIteratorOfDataMapOfShapeShape aItM(theArtInvFaces);
   for (; aItM.More(); aItM.Next()) {
     const TopoDS_Shape& aF = aItM.Key();
     const TopTools_ListOfShape& aLFInv = theInvFaces.FindFromKey(aF);
     aItLF.Initialize(aLFInv);
     for (; aItLF.More(); aItLF.Next()) {
-      const TopoDS_Shape& aFInv = aItLF.Value();
-      for (TopExp_Explorer aExp(aFInv, TopAbs_EDGE); aExp.More(); aExp.Next())
-      {
-        const TopoDS_Shape& aE = aExp.Current();
-        if (theInvEdges.Contains(aE)) {
-          for (TopoDS_Iterator aItV(aE); aItV.More(); aItV.Next()) {
-            aMVEInv.Add(aItV.Value());
-          }
-          continue;
-        }
-        if (aMFence.Add(aE)) {
-          TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aDMVEVal);
-        }
-      }
+      BRep_Builder().Add(aCFArt, aItLF.Value());
+      aDMFImF.Bind(aItLF.Value(), aF);
     }
   }
   //
-  // collect edges with free vertices
-  Standard_Integer aNbV = aDMVEVal.Extent();
-  for (i = 1; i <= aNbV; ++i) {
-    const TopoDS_Shape& aV = aDMVEVal.FindKey(i);
-    if (!aMVEInv.Contains(aV)) {
-      continue;
-    }
+  // make connexity blocks
+  TopTools_ListOfShape aLCBArt;
+  BOPTools_AlgoTools::MakeConnexityBlocks(aCFArt, TopAbs_VERTEX, TopAbs_FACE, aLCBArt);
+  //
+  // alone edges
+  TopTools_MapOfShape aMEAlone;
+  //
+  TopTools_ListIteratorOfListOfShape aItLCBArt(aLCBArt);
+  for (; aItLCBArt.More(); aItLCBArt.Next()) {
+    const TopoDS_Shape& aCB = aItLCBArt.Value();
     //
-    const TopTools_ListOfShape& aLEV = aDMVEVal(i);
-    if (aLEV.Extent() > 1) {
-      continue;
+    // check if aCB contains splits of only one offset face
+    TopTools_MapOfShape aMFArt;
+    TopExp_Explorer aExpF(aCB, TopAbs_FACE);
+    for (; aExpF.More(); aExpF.Next()) {
+      aMFArt.Add(aDMFImF.Find(aExpF.Current()));
     }
     //
-    const TopoDS_Shape& aE = aLEV.First();
-    aMEAlone.Add(aE);
-    //
-    // if this alone edge adds nothing to the intersection list
-    // it means that the origin of this edge has been split and we need to
-    // add the neigboring images of the same origins
-    if (aDMSF.Find(aE).Extent() > 1) {
-      continue;
-    }
+    Standard_Boolean bAlone = (aMFArt.Extent() == 1);
     //
-    // check also its vertices
-    TopoDS_Iterator aItE(aE);
-    for (; aItE.More(); aItE.Next()) {
-      const TopoDS_Shape& aVE = aItE.Value();
-      if (aDMSF.Find(aVE).Extent() > 2) {
-        break;
+    // vertices on invalid edges
+    TopTools_MapOfShape aMVEInv;
+    TopTools_MapOfShape aMFence;
+    // edges that should not be marked as alone - edges having same origins as invalid ones
+    TopTools_MapOfShape aMEAvoid;
+    // map to find alone edges by looking for free vertices
+    TopTools_IndexedDataMapOfShapeListOfShape aDMVEVal;
+    //
+    TopExp_Explorer aExpE(aCB, TopAbs_EDGE);
+    for (; aExpE.More(); aExpE.Next()) {
+      const TopoDS_Shape& aE = aExpE.Current();
+      if (theInvEdges.Contains(aE)) {
+        for (TopoDS_Iterator aItV(aE); aItV.More(); aItV.Next()) {
+          aMVEInv.Add(aItV.Value());
+        }
+        //
+        if (bAlone) {
+          const TopTools_ListOfShape *pLEOr = theOEOrigins.Seek(aE);
+          if (pLEOr) {
+            TopTools_ListIteratorOfListOfShape aItLEOr(*pLEOr);
+            for (; aItLEOr.More(); aItLEOr.Next()) {
+              TopTools_ListIteratorOfListOfShape aItLEIm(theOEImages.Find(aItLEOr.Value()));
+              for (; aItLEIm.More(); aItLEIm.Next()) {
+                aMEAvoid.Add(aItLEIm.Value());
+              }
+            }
+          }
+        }
+        continue;
+      }
+      //
+      if (aMFence.Add(aE)) {
+        TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aDMVEVal);
       }
     }
     //
-    if (aItE.More()) {
-      continue;
-    }
-    //
-    // the edge is useless - look for other images
-    const TopTools_ListOfShape *pLEOr = theOEOrigins.Seek(aE);
-    if (!pLEOr) {
-      continue;
-    }
-    //
-    TopTools_ListIteratorOfListOfShape aItLEOr(*pLEOr);
-    for (; aItLEOr.More(); aItLEOr.Next()) {
-      const TopoDS_Shape& aEOr = aItLEOr.Value();
+    // find edges with free vertices
+    Standard_Integer aNbV = aDMVEVal.Extent();
+    for (i = 1; i <= aNbV; ++i) {
+      const TopoDS_Shape& aV = aDMVEVal.FindKey(i);
+      if (!aMVEInv.Contains(aV)) {
+        continue;
+      }
       //
-      const TopTools_ListOfShape& aLEIm = theOEImages.Find(aEOr);
-      TopTools_ListIteratorOfListOfShape aItLEIm(aLEIm);
-      for (; aItLEIm.More(); aItLEIm.Next()) {
-        const TopoDS_Shape& aEIm = aItLEIm.Value();
+      const TopTools_ListOfShape& aLEV = aDMVEVal(i);
+      if (aLEV.Extent() > 1) {
+        continue;
+      }
+      //
+      const TopoDS_Shape& aE = aLEV.First();
+      if (aMEAvoid.Contains(aE)) {
+        continue;
+      }
+      //
+      aMEAlone.Add(aE);
+      //
+      // if this alone edge adds nothing to the intersection list
+      // it means that the origin of this edge has been split and we need to
+      // add the neighboring images of the same origins
+      if (aDMSF.Find(aE).Extent() > 1) {
+        continue;
+      }
+      //
+      // check also its vertices
+      TopoDS_Iterator aItE(aE);
+      for (; aItE.More(); aItE.Next()) {
+        const TopoDS_Shape& aVE = aItE.Value();
+        if (aDMSF.Find(aVE).Extent() > 2) {
+          break;
+        }
+      }
+      //
+      if (aItE.More()) {
+        continue;
+      }
+      //
+      // the edge is useless - look for other images
+      const TopTools_ListOfShape *pLEOr = theOEOrigins.Seek(aE);
+      if (!pLEOr) {
+        continue;
+      }
+      //
+      TopTools_ListIteratorOfListOfShape aItLEOr(*pLEOr);
+      for (; aItLEOr.More(); aItLEOr.Next()) {
+        const TopoDS_Shape& aEOr = aItLEOr.Value();
         //
-        if (aMFence.Contains(aEIm)) {
-          aMEAlone.Add(aEIm);
+        const TopTools_ListOfShape& aLEIm = theOEImages.Find(aEOr);
+        TopTools_ListIteratorOfListOfShape aItLEIm(aLEIm);
+        for (; aItLEIm.More(); aItLEIm.Next()) {
+          const TopoDS_Shape& aEIm = aItLEIm.Value();
+          //
+          if (aMFence.Contains(aEIm)) {
+            aMEAlone.Add(aEIm);
+          }
         }
       }
     }
@@ -3958,17 +4012,24 @@ void ProcessCommonEdges(const TopTools_ListOfShape& theLEC,
       aItLE.Initialize(theLEC);
       for (; aItLE.More(); aItLE.Next()) {
         const TopoDS_Shape& aEC = aItLE.Value();
-        if (theAllInvs.Contains(aEC) || theInvEdges.Contains(aEC)) {
-          return;
-        }
-        //
-        TopoDS_Iterator aItV(aEC);
-        for (; aItV.More(); aItV.Next()) {
-          if (theAllInvs.Contains(aItV.Value())) {
+        // check if all images of the origin of this edge
+        // are not connected to any invalidity
+        const TopoDS_Shape& aEInt = theETrimEInf.Find(aEC);
+        const TopTools_ListOfShape& aLVE = theMEInfETrim.Find(aEInt);
+        TopTools_ListIteratorOfListOfShape aItLVE(aLVE);
+        for (; aItLVE.More(); aItLVE.Next()) {
+          const TopoDS_Shape& aECx = aItLVE.Value();
+          if (theAllInvs.Contains(aECx) || theInvEdges.Contains(aECx)) {
             return;
           }
+          //
+          TopoDS_Iterator aItV(aECx);
+          for (; aItV.More(); aItV.Next()) {
+            if (theAllInvs.Contains(aItV.Value())) {
+              return;
+            }
+          }
         }
-        //
         // use only one element
         if (aLEC.IsEmpty()) {
           aLEC.Append(aEC);
@@ -4514,6 +4575,7 @@ void UpdateValidEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theFImage
   // back connection from edges to faces
   TopTools_DataMapOfShapeListOfShape aMELF;
   //
+  TopTools_MapOfShape aMETmp;
   Standard_Integer i, aNb = theFLE.Extent();
   for (i = 1; i <= aNb; ++i) {
     const TopoDS_Face& aF = TopoDS::Face(theFLE.FindKey(i));
@@ -4522,6 +4584,11 @@ void UpdateValidEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theFImage
     TopTools_ListIteratorOfListOfShape aItLE(aLEInt);
     for (; aItLE.More(); aItLE.Next()) {
       const TopoDS_Shape& aE = aItLE.Value();
+      if ((theMECheckExt.Contains(aE) || aMETmp.Contains(aE)) && !theEImages.IsBound(aE)) {
+        theMECheckExt.Remove(aE);
+        aMETmp.Add(aE);
+        continue;
+      }
       TopTools_ListOfShape* pLF = aMELF.ChangeSeek(aE);
       if (!pLF) {
         pLF = aMELF.Bound(aE, TopTools_ListOfShape());
@@ -4728,6 +4795,8 @@ void TrimNewIntersectionEdges(const TopTools_ListOfShape& theLE,
   for (; aIt.More(); aIt.Next()) {
     const TopoDS_Shape& aE = aIt.Value();
     //
+    Standard_Boolean bCheckExt = theMECheckExt.Remove(aE);
+    //
     Standard_Boolean bOld = theEETrim.IsBound(aE);
     if (bOld) {
       const TopTools_ListOfShape& aLET = theEETrim.Find(aE);
@@ -4820,7 +4889,6 @@ void TrimNewIntersectionEdges(const TopTools_ListOfShape& theLE,
       }
     }
     //
-    Standard_Boolean bCheckExt = theMECheckExt.Contains(aE);
     if (aLEIm.IsEmpty()) {
       theEImages.UnBind(aE);
     }
@@ -4846,10 +4914,6 @@ void TrimNewIntersectionEdges(const TopTools_ListOfShape& theLE,
         }
       }
     }
-    //
-    if (bCheckExt) {
-      theMECheckExt.Remove(aE);
-    }
   }
 }
 
index ec54beae60b4c386680020aee2cd81203103a2b2..f462c92068942b1c765e71323f6044ee29400ed0 100644 (file)
@@ -1,10 +1,10 @@
-puts "TODO CR27414 ALL: Error : The area of result shape is"
-puts "TODO CR27414 ALL: Error : The volume of result shape is"
-
 restore [locate_data_file bug26917_dom-7724_trim5.brep] s
 
 OFFSETSHAPE 15 {} $calcul $type
 
-checkprops result -v 0 -s 0
+checkprops result -v 596571 -s 50145.4
+
+unifysamedom result_unif result
+checknbshapes result_unif -face 9 -shell 1
 
-checknbshapes result -shell 1
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index 747eeadea4c5ef0e2fd88fba1c7e6a9822e1fb03..f84299b5160cb8b202b5eec5c241fbfff043d8ca 100644 (file)
@@ -1,10 +1,12 @@
 restore [locate_data_file bug28046_rm-107_merged_input.brep] s
 
-OFFSETSHAPE 8 {} $calcul $type
+offsetparameter 1e-7 c i r
+offsetload s 8
+offsetperform result
 
 checkprops result -v 4.40128e+007 -s 1.81672e+006
 
 unifysamedom result_unif result
-checknbshapes result_unif -face 64 -shell 1
+checknbshapes result_unif -edge 186 -face 64 -shell 1
 
 checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XM4 b/tests/offset/shape_type_i_c/XM4
new file mode 100644 (file)
index 0000000..53fa225
--- /dev/null
@@ -0,0 +1,27 @@
+restore [locate_data_file bug28163_merged_input.brep] s
+
+offsetparameter 1e-7 c i
+offsetload s 4
+foreach f [explode s f] {
+  mksurface surf $f
+  set found [regexp {Axis   :([-0-9.+eE]*), ([-0-9.+eE]*), ([-0-9.+eE]*)} [dump surf] full x y z]
+  if {$found && abs(abs($z) - 1) < 1.e-7} {
+    offsetonface $f 3
+  } else {
+    if { y < -0.7 } {
+      offsetonface $f 5
+    } else {
+      if { y > 0.7 } {
+        offsetonface $f 3
+      }
+    }
+  }
+}
+offsetperform result
+
+checkprops result -v 4.27764e+007 -s 1.70699e+006
+
+unifysamedom result_unif result
+checknbshapes result_unif -face 413 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XM5 b/tests/offset/shape_type_i_c/XM5
new file mode 100644 (file)
index 0000000..6f95451
--- /dev/null
@@ -0,0 +1,27 @@
+restore [locate_data_file bug28163_merged_input_trim1.brep] s
+
+offsetparameter 1e-7 c i
+offsetload s 4
+foreach f [explode s f] {
+  mksurface surf $f
+  set found [regexp {Axis   :([-0-9.+eE]*), ([-0-9.+eE]*), ([-0-9.+eE]*)} [dump surf] full x y z]
+  if {$found && abs(abs($z) - 1) < 1.e-7} {
+    offsetonface $f 3
+  } else {
+    if { y < -0.7 } {
+      offsetonface $f 5
+    } else {
+      if { y > 0.7 } {
+        offsetonface $f 3
+      }
+    }
+  }
+}
+offsetperform result
+
+checkprops result -v 1.62872e+007 -s 600815
+
+unifysamedom result_unif result
+checknbshapes result_unif -face 90 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XM6 b/tests/offset/shape_type_i_c/XM6
new file mode 100644 (file)
index 0000000..73860d1
--- /dev/null
@@ -0,0 +1,27 @@
+restore [locate_data_file bug28163_merged_input_trim3.brep] s
+
+offsetparameter 1e-7 c i
+offsetload s 4
+foreach f [explode s f] {
+  mksurface surf $f
+  set found [regexp {Axis   :([-0-9.+eE]*), ([-0-9.+eE]*), ([-0-9.+eE]*)} [dump surf] full x y z]
+  if {$found && abs(abs($z) - 1) < 1.e-7} {
+    offsetonface $f 3
+  } else {
+    if { y < -0.7 } {
+      offsetonface $f 5
+    } else {
+      if { y > 0.7 } {
+        offsetonface $f 3
+      }
+    }
+  }
+}
+offsetperform result
+
+checkprops result -v 1.23529e+006 -s 103271
+
+unifysamedom result_unif result
+checknbshapes result_unif -face 35 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XM7 b/tests/offset/shape_type_i_c/XM7
new file mode 100644 (file)
index 0000000..d5262d3
--- /dev/null
@@ -0,0 +1,27 @@
+restore [locate_data_file bug28163_merged_input_trim5.brep] s
+
+offsetparameter 1e-7 c i
+offsetload s 4
+foreach f [explode s f] {
+  mksurface surf $f
+  set found [regexp {Axis   :([-0-9.+eE]*), ([-0-9.+eE]*), ([-0-9.+eE]*)} [dump surf] full x y z]
+  if {$found && abs(abs($z) - 1) < 1.e-7} {
+    offsetonface $f 3
+  } else {
+    if { y < -0.7 } {
+      offsetonface $f 5
+    } else {
+      if { y > 0.7 } {
+        offsetonface $f 3
+      }
+    }
+  }
+}
+offsetperform result
+
+checkprops result -v 195034 -s 24982.5
+
+unifysamedom result_unif result
+checknbshapes result_unif -face 12 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XM8 b/tests/offset/shape_type_i_c/XM8
new file mode 100644 (file)
index 0000000..5bf3cae
--- /dev/null
@@ -0,0 +1,10 @@
+restore [locate_data_file bug28163_merged_input.brep] s
+
+OFFSETSHAPE 4 {} $calcul $type
+
+checkprops result -v 4.44822e+007 -s 1.70739e+006
+
+unifysamedom result_unif result
+checknbshapes result_unif -face 423 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XM9 b/tests/offset/shape_type_i_c/XM9
new file mode 100644 (file)
index 0000000..654b38d
--- /dev/null
@@ -0,0 +1,10 @@
+restore [locate_data_file bug28163_merged_input_trim1.brep] s
+
+OFFSETSHAPE 4 {} $calcul $type
+
+checkprops result -v 1.68905e+007 -s 606317
+
+unifysamedom result_unif result
+checknbshapes result_unif -face 91 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XN1 b/tests/offset/shape_type_i_c/XN1
new file mode 100644 (file)
index 0000000..87b0dbf
--- /dev/null
@@ -0,0 +1,10 @@
+restore [locate_data_file bug28163_merged_input_trim3.brep] s
+
+OFFSETSHAPE 4 {} $calcul $type
+
+checkprops result -v 1.34032e+006 -s 107264
+
+unifysamedom result_unif result
+checknbshapes result_unif -face 36 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XN2 b/tests/offset/shape_type_i_c/XN2
new file mode 100644 (file)
index 0000000..dc691b0
--- /dev/null
@@ -0,0 +1,10 @@
+restore [locate_data_file bug28163_merged_input_trim5.brep] s
+
+OFFSETSHAPE 4 {} $calcul $type
+
+checkprops result -v 220952 -s 26863.2
+
+unifysamedom result_unif result
+checknbshapes result_unif -face 12 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index ed536b138f273039387809086ed7f70c781ccbad..e5e99d3606008f69155a57b4b53e93672121be38 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 43.7 {} $calcul $type
 checkprops result -v 2.70147e+009
 checkprops result -s 1.63922e+007
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 38 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index de81d16f6646cb13861437235077418d03c5b85f..00f26552ee35e28f135bd3310b88d7a90f02f858 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 43.7 {} $calcul $type
 checkprops result -v 4.55952e+006
 checkprops result -s 178524
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 14 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index 5f784419dc5429e194e571122de469b7d2cdcb53..2ee1535b501c04ce2cc4feda65033daff3f78a58 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 14 {} $calcul $type
 checkprops result -v 702756
 checkprops result -s 58381.3
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 9 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index cae34a8e1903ee7c0ee8f3f0ea892c9b68803c43..3b3eff909e2acb6c51bf0dbe40d1e680383e3df7 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 43.7 {} $calcul $type
 checkprops result -v 3.77467e+006
 checkprops result -s 155537
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 8 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index 61a523eaf2a7fffe06ac27be3cf4aa548e32e04a..96d76f41b509d59c7294e8c96f0264ee241fed8e 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 4 {} $calcul $type
 checkprops result -v 3771.44
 checkprops result -s 1506.76
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 12 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index ce6fc96dc4033c33cdea528a7144450196789844..a01c955830ea95ecc678dfce607e03f7408a5889 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 5 {} $calcul $type
 checkprops result -v 5453.96
 checkprops result -s 1912.14
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 13 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index 1ae6cf9138fec84c4c5217c3adc1e3d3516c2979..e7416e60a434129c3125a8fb76e4e34ea3f0dbb2 100644 (file)
@@ -9,4 +9,7 @@ offsetperform result
 checkprops result -v 5530.7
 checkprops result -s 1919.49
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 13 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index b47a2963e5a58dcaff8ddf29a96410d210e9a934..eb0b0e2d7692b07289af99d984a7fb4f4290ac5c 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 15 {} $calcul $type
 checkprops result -v 48955.7
 checkprops result -s 8048.95
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 8 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index c97b3d69f7ac1dbbb2f2d5aca743d5329eac4648..50ce6f061576294b6a394c40f58ecc9df6cc9d7f 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 6 {} $calcul $type
 checkprops result -v 7543.63
 checkprops result -s 2359.85
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 13 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index 3910b68835a321cb0c729460f8d648c480144a9d..ac5f60e8517893c7af9b3340d7916d15b86dba1e 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 43 {} $calcul $type
 checkprops result -v 7.05903e+008
 checkprops result -s 5.59084e+006
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 21 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index 6bd9877625a90e227c47541ae70097454baf58c8..17e216662efdfcc0ea9d60af416d1a828e60e6ae 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 35 {} $calcul $type
 checkprops result -v 7.94674e+008
 checkprops result -s 6.11963e+006
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 22 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index 5936be0e293ba9189aab8d611be1daa426d9bf1e..22979a735a5b9ac35b0f0d19dcf116f4ec1e2e0e 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 43 {} $calcul $type
 checkprops result -v 7.05903e+008
 checkprops result -s 5.59084e+006
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 21 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index de7b0afebba0d1ca0f9fc49e71791506b85784c1..993428c5f43f994738f989a439ad46fc966bed15 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 43 {} $calcul $type
 checkprops result -v 9.12393e+008
 checkprops result -s 7.01321e+006
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 21 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index 86445e1beae44fadf1b2b2eaca34340a9ad53902..fad0518ec3badcaae997e2ee949d55b87da51d1c 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 43 {} $calcul $type
 checkprops result -v 5.23391e+008
 checkprops result -s 4.7898e+006
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 22 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index 070bfda43251896d15f4c615b5b5ddf9557bbb50..20c26e739beeb417aaca120a6822614e5187d47e 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 43 {} $calcul $type
 checkprops result -v 1.58077e+009
 checkprops result -s 1.04396e+007
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 38 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index c96b9e09e7f7453939cc4575d026881ce064249b..d887861a73898c76520b69252def0feed4e60076 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 43 {} $calcul $type
 checkprops result -v 2.09462e+009
 checkprops result -s 1.32364e+007
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 38 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index a6b5f5d5234c2b2c1f2354db0e18bac8ffc9a3c4..83c94c169ac5ef97b0a5b4378003ca0790d9cdb3 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 43 {} $calcul $type
 checkprops result -v 7.05903e+008
 checkprops result -s 5.59084e+006
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 21 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index 0b63ea5457fa5a0ec42e5853a5fe76e92bdf2806..5cb63eff3b9fe5a726a4cae012ceef95229e1333 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 43 {} $calcul $type
 checkprops result -v 5.23391e+008
 checkprops result -s 4.7898e+006
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 22 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index a93a4246a1f521d370cced088a0d3f5ad4c4bf1d..f5dc033655f93e0ac8cc55ed2319da88ff72eb7c 100644 (file)
@@ -4,4 +4,7 @@ OFFSETSHAPE 6 {} $calcul $type
 
 checkprops result -v 813077 -s 70451.1
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 14 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index d97a14107f3d7dfa13517ed6ed15227d37060284..68eb376d60157dac615056b0d5842d1d05af8d84 100644 (file)
@@ -5,4 +5,7 @@ OFFSETSHAPE 3 {} $calcul $type
 checkprops result -v 4422.98
 checkprops result -s 1736.95
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -face 14 -shell 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index afa9394e28c2f3fed51638af0645f76ac7ec7e02..f235788aaf7e203c43b24436368af3c4f0728992 100755 (executable)
@@ -1,6 +1,6 @@
-puts "TODO CR27414 ALL: Error : The area of result shape is"
-puts "TODO CR27414 ALL: Error : The volume of result shape is"
-puts "TODO CR27414 ALL: is not equal to zero"
+puts "TODO OCC27414 ALL: Error: The command cannot be built"
+puts "TODO OCC27414 ALL: gives an empty result"
+puts "TODO OCC27414 ALL: TEST INCOMPLETE"
 
 restore [locate_data_file bug26917_input_segfault.brep] s
 
index 40a461796ce7b055ef5fab47a10d3c124c778e96..728bad4a1be322ff2cf3574fb488e9123d8ca68f 100755 (executable)
@@ -1,13 +1,10 @@
-puts "TODO CR27414 ALL: Error : The area of result shape is"
-puts "TODO CR27414 ALL: Error : The volume of result shape is"
-puts "TODO CR27414 ALL: Error :  is WRONG because number of SHELL entities in shape"
-puts "TODO CR27414 ALL: is not equal to zero"
-
 restore [locate_data_file bug26917_offset_topology.brep] s
 
 OFFSETSHAPE 10 {} $calcul $type
 
-checkprops result -v 0
-checkprops result -s 0
+checkprops result -s 4.24638e+006 -v 2.9367e+008
+
+unifysamedom result_unif result
+checknbshapes result_unif -face 100 -shell 1
 
-checknbshapes result -shell 1
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png