]> OCCT Git - occt-copy.git/commitdiff
0031307: Modeling Algorithms - Offset algorithm produces incorrect result in mode...
authoremv <emv@opencascade.com>
Mon, 20 Jan 2020 13:45:34 +0000 (16:45 +0300)
committeremv <emv@opencascade.com>
Thu, 30 Apr 2020 13:11:00 +0000 (16:11 +0300)
Do not classify edges originated from combination of edges and vertices as the classification will likely be unstable.

Extend the debug command DBRep_SetComp to allow different containers for creating the TopoDS_Compound.

23 files changed:
src/BRepOffset/BRepOffset_Inter2d.cxx
src/BRepOffset/BRepOffset_MakeOffset_1.cxx
src/DBRep/DBRep_Debug.cxx
tests/offset/shape_type_i_c/J2
tests/offset/shape_type_i_c/XC1
tests/offset/shape_type_i_c/XE5
tests/offset/shape_type_i_c/XE7
tests/offset/shape_type_i_c/XE8
tests/offset/shape_type_i_c/XF1
tests/offset/shape_type_i_c/XG2
tests/offset/shape_type_i_c/XT3 [new file with mode: 0644]
tests/offset/shape_type_i_c/XT4 [new file with mode: 0644]
tests/offset/shape_type_i_c/XT5 [new file with mode: 0644]
tests/offset/shape_type_i_c/XT6 [new file with mode: 0644]
tests/offset/shape_type_i_c/XT7 [new file with mode: 0644]
tests/offset/shape_type_i_c/XT8 [new file with mode: 0644]
tests/offset/shape_type_i_c/XT9 [new file with mode: 0644]
tests/offset/shape_type_i_c/XU1 [new file with mode: 0644]
tests/offset/shape_type_i_c/XU2 [new file with mode: 0644]
tests/offset/shape_type_i_c/XU3 [new file with mode: 0644]
tests/offset/shape_type_i_c/ZC7
tests/offset/shape_type_i_c/ZG5
tests/offset/shape_type_i_c/ZS1

index ad0e625c64f07f9258acc23645dd5899c0011393..4f19d55dd7ca95044bee124b549b0363790768fc 100644 (file)
@@ -585,6 +585,17 @@ static void RefEdgeInter(const TopoDS_Face&              F,
   Handle(Geom2d_Curve) pcurve2 = BRep_Tool::CurveOnSurface(E2, F, f[2], l[2]);
   Geom2dAdaptor_Curve GAC1(pcurve1, f[1], l[1]);
   Geom2dAdaptor_Curve GAC2(pcurve2, f[2], l[2]);
+  if ((GAC1.GetType() == GeomAbs_Line) &&
+      (GAC2.GetType() == GeomAbs_Line))
+  {
+    // Just quickly check if lines coincide
+    if (GAC1.Line().Direction().IsParallel (GAC2.Line().Direction(), 1.e-8))
+    {
+      theCoincide = Standard_True;
+      return;
+    }
+  }
+
   Geom2dInt_GInter Inter2d( GAC1, GAC2, TolDub, TolDub );
   //
   if (!Inter2d.IsDone() || !Inter2d.NbPoints()) {
index 6157856b19e27689a0ec4724f18834b82e5b1141..975354dfb9cd726bfbd42c83a6ad7ba269ee2e87 100644 (file)
@@ -70,6 +70,8 @@
 
 typedef NCollection_DataMap
   <TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher> BRepOffset_DataMapOfShapeMapOfShape;
+typedef NCollection_DataMap
+  <TopoDS_Shape, TopTools_IndexedMapOfShape, TopTools_ShapeMapHasher> BRepOffset_DataMapOfShapeIndexedMapOfShape;
 
 static
   void IntersectTrimmedEdges(const TopTools_ListOfShape& theLF,
@@ -159,24 +161,25 @@ static
                         const TopTools_DataMapOfShapeListOfShape& theOEOrigins,
                         TopTools_IndexedMapOfShape& theInvEdges,
                         TopTools_IndexedMapOfShape& theValidEdges,
-                        TopTools_DataMapOfShapeListOfShape& theDMFLVE,
-                        TopTools_DataMapOfShapeListOfShape& theDMFLNE,
-                        TopTools_DataMapOfShapeListOfShape& theDMFLIE,
-                        TopTools_DataMapOfShapeListOfShape& theDMFLVIE,
+                        BRepOffset_DataMapOfShapeMapOfShape& theDMFMVE,
+                        BRepOffset_DataMapOfShapeMapOfShape& theDMFMNE,
+                        BRepOffset_DataMapOfShapeIndexedMapOfShape& theDMFMIE,
+                        BRepOffset_DataMapOfShapeMapOfShape& theDMFMVIE,
                         TopTools_DataMapOfShapeListOfShape& theDMEOrLEIm,
                         TopTools_MapOfShape& theMEInverted,
-                        TopTools_MapOfShape& theEdgesInvalidByVertex);
+                        TopTools_MapOfShape& theEdgesInvalidByVertex,
+                        TopTools_MapOfShape& theEdgesValidByVertex);
 
 static
   void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
                         const TopTools_IndexedMapOfShape& theInvEdges,
                         const TopTools_IndexedMapOfShape& theValidEdges,
-                        const TopTools_DataMapOfShapeListOfShape& theDMFLVE,
-                        const TopTools_DataMapOfShapeListOfShape& theDMFLIE,
-                        const TopTools_ListOfShape& theLENeutral,
-                        const TopTools_ListOfShape& theLEValInverted,
+                        const BRepOffset_DataMapOfShapeMapOfShape& theDMFMVE,
+                        const BRepOffset_DataMapOfShapeIndexedMapOfShape& theDMFMIE,
+                        const TopTools_MapOfShape& theLENeutral,
                         const TopTools_MapOfShape& theMEInverted,
                         const TopTools_MapOfShape& theEdgesInvalidByVertex,
+                        const TopTools_MapOfShape& theEdgesValidByVertex,
                         const TopTools_MapOfShape& theMFHoles,
                         TopTools_IndexedMapOfShape& theMFInvInHole,
                         TopTools_ListOfShape& theInvFaces,
@@ -232,6 +235,7 @@ static
   void RemoveInvalidSplitsFromValid(const TopTools_IndexedDataMapOfShapeListOfShape& theInvFaces,
                                     const TopTools_DataMapOfShapeShape& theArtInvFaces,
                                     const TopTools_MapOfShape& theMEInverted,
+                                    const BRepOffset_DataMapOfShapeMapOfShape& theDMFMVIE,
                                     TopTools_IndexedDataMapOfShapeListOfShape& theFImages);
 
 static
@@ -284,8 +288,9 @@ static
                          TopTools_DataMapOfShapeListOfShape& theOEOrigins);
 
 static
-  void FilterInvalidFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
+  void FilterInvalidFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
                           const TopTools_IndexedDataMapOfShapeListOfShape& theDMEF,
+                          const TopTools_IndexedMapOfShape& theInvEdges,
                           const TopTools_IndexedMapOfShape& theMERemoved,
                           TopTools_IndexedDataMapOfShapeListOfShape& theInvFaces,
                           TopTools_DataMapOfShapeShape& theArtInvFaces);
@@ -293,7 +298,7 @@ static
 static
   void FilterInvalidEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theInvFaces,
                           const TopTools_DataMapOfShapeShape& theArtInvFaces,
-                          const TopTools_DataMapOfShapeListOfShape& theDMFLIE,
+                          const BRepOffset_DataMapOfShapeIndexedMapOfShape& theDMFMIE,
                           const TopTools_IndexedMapOfShape& theMERemoved,
                           TopTools_IndexedMapOfShape& theInvEdges);
 
@@ -831,18 +836,20 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
   //
   // processed faces
   TopTools_ListOfShape aLFDone;
-  // extended face - list of neutral edges, i.e. in one splits - valid and in others - invalid
-  TopTools_DataMapOfShapeListOfShape aDMFLNE;
-  // list of valid edges for each face
-  TopTools_DataMapOfShapeListOfShape aDMFLVE;
-  // list of invalid edges for each face
-  TopTools_DataMapOfShapeListOfShape aDMFLIE;
+  // extended face - map of neutral edges, i.e. in one split - valid and in other - invalid
+  BRepOffset_DataMapOfShapeMapOfShape aDMFMNE;
+  // map of valid edges for each face
+  BRepOffset_DataMapOfShapeMapOfShape aDMFMVE;
+  // map of invalid edges for each face
+  BRepOffset_DataMapOfShapeIndexedMapOfShape aDMFMIE;
   // map of valid inverted edges for the face
-  TopTools_DataMapOfShapeListOfShape aDMFLVIE;
+  BRepOffset_DataMapOfShapeMapOfShape aDMFMVIE;
   // map of splits to check for internals
   TopTools_IndexedMapOfShape aMFToCheckInt;
   // map of edges created from vertex and marked as invalid
   TopTools_MapOfShape aMEdgeInvalidByVertex;
+  // map of edges created from vertex and marked as valid
+  TopTools_MapOfShape aMEdgeValidByVertex;
   // connection map from old edges to new ones
   TopTools_DataMapOfShapeListOfShape aDMEOrLEIm;
   //
@@ -932,7 +939,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
       }
       //
       if (bArtificialCase) {
-        TopTools_ListOfShape aLEInv;
+        TopTools_IndexedMapOfShape aMEInv;
         // make the face invalid
         theArtInvFaces.Bind(aF, aCE);
         //
@@ -945,7 +952,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
             const TopoDS_Shape& aE = aExpE.Current();
             if (aMapEInv.Contains(aE)) {
               theInvEdges.Add(aE);
-              AppendToList(aLEInv, aE);
+              aMEInv.Add (aE);
             }
             else {
               theValidEdges.Add(aE);
@@ -953,7 +960,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
           }
         }
         //
-        aDMFLIE.Bind(aF, aLEInv);
+        aDMFMIE.Bind(aF, aMEInv);
         aLFDone.Append(aF);
         //
         continue;
@@ -962,8 +969,8 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
     //
     // find invalid edges
     FindInvalidEdges(aF, aLFImages, theEdgesOrigins, theFacesOrigins, theOEImages,
-                     theOEOrigins, theInvEdges, theValidEdges, aDMFLVE, aDMFLNE, aDMFLIE,
-                     aDMFLVIE, aDMEOrLEIm, theInvertedEdges, aMEdgeInvalidByVertex);
+                     theOEOrigins, theInvEdges, theValidEdges, aDMFMVE, aDMFMNE, aDMFMIE,
+                     aDMFMVIE, aDMEOrLEIm, theInvertedEdges, aMEdgeInvalidByVertex, aMEdgeValidByVertex);
     //
     // save the new splits
     if (!pLFIm) {
@@ -977,7 +984,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
     aLFDone.Append(aF);
   }
   //
-  if (theInvEdges.IsEmpty() && theArtInvFaces.IsEmpty()) {
+  if (theInvEdges.IsEmpty() && theArtInvFaces.IsEmpty() && aDMFMIE.IsEmpty()) {
     return;
   }
   //
@@ -1030,7 +1037,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
     }
   }
 
-  TopTools_ListOfShape anEmptyList;
+  TopTools_MapOfShape anEmptyMap;
   // invalid faces inside the holes
   TopTools_IndexedMapOfShape aMFInvInHole;
   // all hole faces
@@ -1050,18 +1057,13 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
     if (bArtificialCase) {
       aLFInv = aLFImages;
     }
-    else {
+    else
+    {
       // neutral edges
-      TopTools_ListOfShape* pLNE = aDMFLNE.ChangeSeek(aF);
-      if (!pLNE) {
-        pLNE = &anEmptyList;
-      }
-      // valid inverted edges
-      TopTools_ListOfShape* pLIVE = aDMFLVIE.ChangeSeek(aF);
-      if (!pLIVE) {
-        pLIVE = &anEmptyList;
+      const TopTools_MapOfShape* pMNE = aDMFMNE.ChangeSeek(aF);
+      if (!pMNE) {
+        pMNE = &anEmptyMap;
       }
-      //
       // find faces inside holes wires
       TopTools_MapOfShape aMFHoles;
       const TopoDS_Face& aFOr = TopoDS::Face(theFacesOrigins.Find(aF));
@@ -1074,8 +1076,8 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
       }
       //
       // find invalid faces
-      FindInvalidFaces(aLFImages, theInvEdges, theValidEdges, aDMFLVE, aDMFLIE,
-                       *pLNE, *pLIVE, theInvertedEdges, aMEdgeInvalidByVertex,
+      FindInvalidFaces(aLFImages, theInvEdges, theValidEdges, aDMFMVE, aDMFMIE,
+                       *pMNE, theInvertedEdges, aMEdgeInvalidByVertex, aMEdgeValidByVertex,
                        aMFHoles, aMFInvInHole, aLFInv, anInvertedFaces);
     }
     //
@@ -1123,7 +1125,8 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
   }
   //
   // remove invalid splits from valid splits
-  RemoveInvalidSplitsFromValid(theInvFaces, theArtInvFaces, theInvertedEdges, theFImages);
+  RemoveInvalidSplitsFromValid (theInvFaces, theArtInvFaces, theInvertedEdges,
+                                aDMFMVIE, theFImages);
   //
   // remove inside faces
   TopTools_IndexedMapOfShape aMEInside;
@@ -1152,7 +1155,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
   FilterEdgesImages(aCFIm, theOEImages, theOEOrigins);
   //
   // filter invalid faces
-  FilterInvalidFaces(theFImages, aDMEF, aMEInside, theInvFaces, theArtInvFaces);
+  FilterInvalidFaces(theFImages, aDMEF, theInvEdges, aMEInside, theInvFaces, theArtInvFaces);
   aNb = theInvFaces.Extent();
   if (!aNb) {
     theInvEdges.Clear();
@@ -1175,7 +1178,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
 #endif
   //
   // filter invalid edges
-  FilterInvalidEdges(theInvFaces, theArtInvFaces, aDMFLIE, aMERemoved, theInvEdges);
+  FilterInvalidEdges(theInvFaces, theArtInvFaces, aDMFMIE, aMERemoved, theInvEdges);
   //
 #ifdef OFFSET_DEBUG
   // show invalid edges
@@ -1556,13 +1559,14 @@ void FindInvalidEdges(const TopoDS_Face& theF,
                       const TopTools_DataMapOfShapeListOfShape& theOEOrigins,
                       TopTools_IndexedMapOfShape& theInvEdges,
                       TopTools_IndexedMapOfShape& theValidEdges,
-                      TopTools_DataMapOfShapeListOfShape& theDMFLVE,
-                      TopTools_DataMapOfShapeListOfShape& theDMFLNE,
-                      TopTools_DataMapOfShapeListOfShape& theDMFLIE,
-                      TopTools_DataMapOfShapeListOfShape& theDMFLVIE,
+                      BRepOffset_DataMapOfShapeMapOfShape& theDMFMVE,
+                      BRepOffset_DataMapOfShapeMapOfShape& theDMFMNE,
+                      BRepOffset_DataMapOfShapeIndexedMapOfShape& theDMFMIE,
+                      BRepOffset_DataMapOfShapeMapOfShape& theDMFMVIE,
                       TopTools_DataMapOfShapeListOfShape& theDMEOrLEIm,
                       TopTools_MapOfShape& theMEInverted,
-                      TopTools_MapOfShape& theEdgesInvalidByVertex)
+                      TopTools_MapOfShape& theEdgesInvalidByVertex,
+                      TopTools_MapOfShape& theEdgesValidByVertex)
 {
   // Edge is considered as invalid in the following cases:
   // 1. Its orientation on the face has changed comparing to the originals edge and face;
@@ -1584,6 +1588,8 @@ void FindInvalidEdges(const TopoDS_Face& theF,
   // maps for checking the inverted edges
   TopTools_IndexedDataMapOfShapeListOfShape aDMVE, aDMEF;
   TopTools_IndexedMapOfShape aMEdges;
+  // back map from the original shapes to their offset images
+  TopTools_DataMapOfShapeListOfShape anImages;
   //
   TopTools_ListIteratorOfListOfShape aItLF(theLFImages);
   for (; aItLF.More(); aItLF.Next()) {
@@ -1613,6 +1619,22 @@ void FindInvalidEdges(const TopoDS_Face& theF,
         }
         AppendToList(*pLE, aE);
       }
+
+      // back map from original edges to their offset images
+      const TopTools_ListOfShape* pLOr = theEdgesOrigins.Seek (aE);
+      if (!pLOr)
+        continue;
+      for (TopTools_ListOfShape::Iterator itOr (*pLOr); itOr.More(); itOr.Next())
+      {
+        const TopoDS_Shape& aSOr = itOr.Value();
+        TopoDS_Shape aSInF;
+        if (!FindShape (aSOr, aFOr, aSInF))
+          continue;
+        TopTools_ListOfShape* pImages = anImages.ChangeSeek (aSInF);
+        if (!pImages)
+          pImages = anImages.Bound (aSInF, TopTools_ListOfShape());
+        AppendToList (*pImages, aE);
+      }
     }
   }
   //
@@ -1625,9 +1647,9 @@ void FindInvalidEdges(const TopoDS_Face& theF,
     const TopoDS_Face& aFIm = *(TopoDS_Face*)&aItLF.Value();
     //
     // valid edges for this split
-    TopTools_ListOfShape aLVE;
+    TopTools_MapOfShape aMVE;
     // invalid edges for this split
-    TopTools_ListOfShape aLIE;
+    TopTools_IndexedMapOfShape aMIE;
     //
     TopExp_Explorer aExp(aFIm, TopAbs_EDGE);
     for (; aExp.More(); aExp.Next()) {
@@ -1654,6 +1676,8 @@ void FindInvalidEdges(const TopoDS_Face& theF,
           ++aNbVOr;
         }
       }
+      if (aNbVOr > 1 && (aLEOr.Extent() - aNbVOr) > 1)
+        continue;
       //
       TopTools_MapOfShape aME, aMV;
       Standard_Boolean bInvalid = Standard_False, bChecked = Standard_False;
@@ -1684,12 +1708,22 @@ void FindInvalidEdges(const TopoDS_Face& theF,
           if (pLEFOr) {
             TopoDS_Compound aCEOr;
             BRep_Builder().MakeCompound(aCEOr);
+            // Avoid classification of edges originated from vertices
+            // located between tangent edges
+            Standard_Boolean bAllTgt = Standard_True;
             TopTools_ListIteratorOfListOfShape aItLEFOr(*pLEFOr);
-            for (; aItLEFOr.More(); aItLEFOr.Next()) {
+            gp_Vec aVRef = GetAverageTangent (aItLEFOr.Value(), aNbP);
+            for (; aItLEFOr.More(); aItLEFOr.Next())
+            {
               const TopoDS_Shape& aEOr = aItLEFOr.Value();
               BRep_Builder().Add(aCEOr, aEOr);
+
+              gp_Vec aVCur = GetAverageTangent (aEOr, aNbP);
+              if (!aVRef.IsParallel (aVCur, Precision::Angular()))
+                bAllTgt = Standard_False;
             }
-            aEOrF = aCEOr;
+            if (!bAllTgt)
+              aEOrF = aCEOr;
           }
         }
         else {
@@ -1706,22 +1740,56 @@ void FindInvalidEdges(const TopoDS_Face& theF,
           // the edge has not been found
           continue;
         }
-        //
-        // Check orientations of the image edge and original edge.
-        // In case the 3d curves are having the same direction the orientations 
-        // must be the same. Otherwise the orientations should also be different.
-        //
-        // get average tangent vector for each curve taking into account
-        // the orientations of the edges, i.e. the edge is reversed
-        // the vector is reversed as well
-        gp_Vec aVSum1 = GetAverageTangent(aEIm, aNbP);
-        gp_Vec aVSum2 = GetAverageTangent(aEOrF, aNbP);
-        //
-        aVSum1.Normalize();
-        aVSum2.Normalize();
-        //
-        Standard_Real aCos = aVSum1.Dot(aVSum2);
-        if (!bVertex) {
+
+        if (bVertex)
+        {
+          TopTools_MapOfShape aMVTotal;
+          Standard_Integer aNbChecked = 0;
+          // Just check if the original edges sharing the vertex do not share it any more.
+          for (TopoDS_Iterator it (aEOrF); it.More(); it.Next())
+          {
+            const TopoDS_Shape& aEOr = it.Value();
+            const TopTools_ListOfShape* aLIm = anImages.Seek (aEOr);
+            if (!aLIm)
+              continue;
+            ++aNbChecked;
+            TopTools_IndexedDataMapOfShapeListOfShape aMVLoc;
+            for (TopTools_ListOfShape::Iterator itLIM (*aLIm); itLIM.More(); itLIM.Next())
+              TopExp::MapShapesAndAncestors (itLIM.Value(), TopAbs_VERTEX, TopAbs_EDGE, aMVLoc);
+            for (Standard_Integer i = 1; i <= aMVLoc.Extent(); ++i)
+            {
+              if (aMVLoc(i).Extent() > 1 && !aMVTotal.Add (aMVLoc.FindKey (i)))
+              {
+                bInvalid = Standard_True;
+                theEdgesInvalidByVertex.Add(aEIm);
+                break;
+              }
+            }
+            if (bInvalid)
+              break;
+          }
+          if (!bInvalid && aNbChecked < 2)
+            continue;
+          else
+            theEdgesValidByVertex.Add (aEIm);
+        }
+        else
+        {
+          //
+          // Check orientations of the image edge and original edge.
+          // In case the 3d curves are having the same direction the orientations 
+          // must be the same. Otherwise the orientations should also be different.
+          //
+          // get average tangent vector for each curve taking into account
+          // the orientations of the edges, i.e. the edge is reversed
+          // the vector is reversed as well
+          gp_Vec aVSum1 = GetAverageTangent(aEIm, aNbP);
+          gp_Vec aVSum2 = GetAverageTangent(aEOrF, aNbP);
+          //
+          aVSum1.Normalize();
+          aVSum2.Normalize();
+          //
+          Standard_Real aCos = aVSum1.Dot(aVSum2);
           if (Abs(aCos) < 0.9999) {
             continue;
           }
@@ -1732,12 +1800,10 @@ void FindInvalidEdges(const TopoDS_Face& theF,
             const TopoDS_Shape& aV = aExpE.Current();
             aMV.Add(aV);
           }
-        }
-        //
-        if (aCos < Precision::Confusion()) {
-          bInvalid = Standard_True;
-          if (bVertex) {
-            theEdgesInvalidByVertex.Add(aEIm);
+          //
+          if (aCos < Precision::Confusion())
+          {
+            bInvalid = Standard_True;
           }
         }
         bChecked = Standard_True;
@@ -1754,7 +1820,7 @@ void FindInvalidEdges(const TopoDS_Face& theF,
       //
       if (bInvalid) {
         theInvEdges.Add(aEIm);
-        aLIE.Append(aEIm);
+        aMIE.Add (aEIm);
         aMEInv.Add(aEIm);
         continue;
       }
@@ -1766,27 +1832,29 @@ void FindInvalidEdges(const TopoDS_Face& theF,
       //
       if (!bInverted || !aNbVOr) {
         theValidEdges.Add(aEIm);
-        aLVE.Append(aEIm);
+        aMVE.Add (aEIm);
         aMEVal.Add(aEIm);
       }
     }
     //
     // valid edges
-    if (aLVE.Extent()) {
-      theDMFLVE.Bind(aFIm, aLVE);
+    if (aMVE.Extent())
+    {
+      theDMFMVE.Bind (aFIm, aMVE);
     }
     //
     // invalid edges
-    if (aLIE.Extent()) {
-      theDMFLIE.Bind(aFIm, aLIE);
+    if (aMIE.Extent())
+    {
+      theDMFMIE.Bind (aFIm, aMIE);
     }
   }
   //
   // process invalid edges:
   // check for the inverted edges
-  TopTools_ListOfShape aLVIE;
+  TopTools_MapOfShape aMVIE;
   // fill neutral edges
-  TopTools_ListOfShape aLNE;
+  TopTools_MapOfShape aMNE;
   //
   Standard_Integer i, aNbEInv = aMEInv.Extent();
   for (i = 1; i <= aNbEInv; ++i) {
@@ -1794,8 +1862,9 @@ void FindInvalidEdges(const TopoDS_Face& theF,
     //
     // neutral edges - on the splits of the same offset face
     // it is valid for one split and invalid for other
-    if (aMEVal.Contains(aEIm)) {
-      aLNE.Append(aEIm);
+    if (aMEVal.Contains(aEIm))
+    {
+      aMNE.Add (aEIm);
       continue;
     }
     //
@@ -1821,18 +1890,20 @@ void FindInvalidEdges(const TopoDS_Face& theF,
             !aMEInv.Contains(aEIm1) && !aMEInt.Contains(aEIm1) &&
             theMEInverted.Contains(aEIm1)) {
           theInvEdges.Add(aEIm1);
-          aLVIE.Append(aEIm1);
+          aMVIE.Add (aEIm1);
         }
       }
     }
   }
   //
-  if (aLNE.Extent()) {
-    theDMFLNE.Bind(theF, aLNE);
+  if (aMNE.Extent())
+  {
+    theDMFMNE.Bind (theF, aMNE);
   }
   //
-  if (aLVIE.Extent()) {
-    theDMFLVIE.Bind(theF, aLVIE);
+  if (aMVIE.Extent())
+  {
+    theDMFMVIE.Bind (theF, aMVIE);
   }
 }
 
@@ -1843,12 +1914,12 @@ void FindInvalidEdges(const TopoDS_Face& theF,
 void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
                       const TopTools_IndexedMapOfShape& theInvEdges,
                       const TopTools_IndexedMapOfShape& theValidEdges,
-                      const TopTools_DataMapOfShapeListOfShape& theDMFLVE,
-                      const TopTools_DataMapOfShapeListOfShape& theDMFLIE,
-                      const TopTools_ListOfShape& theLENeutral,
-                      const TopTools_ListOfShape& theLEValInverted,
+                      const BRepOffset_DataMapOfShapeMapOfShape& theDMFMVE,
+                      const BRepOffset_DataMapOfShapeIndexedMapOfShape& theDMFMIE,
+                      const TopTools_MapOfShape& theMENeutral,
                       const TopTools_MapOfShape& theMEInverted,
                       const TopTools_MapOfShape& theEdgesInvalidByVertex,
+                      const TopTools_MapOfShape& theEdgesValidByVertex,
                       const TopTools_MapOfShape& theMFHoles,
                       TopTools_IndexedMapOfShape& theMFInvInHole,
                       TopTools_ListOfShape& theInvFaces,
@@ -1867,21 +1938,7 @@ void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
   Standard_Boolean bHasValid, bAllValid, bAllInvalid, bHasReallyInvalid, bAllInvNeutral;
   Standard_Boolean bValid, bValidLoc, bInvalid, bInvalidLoc, bNeutral, bInverted;
   Standard_Boolean bIsInvalidByInverted;
-  Standard_Integer i, aNbChecked;
-  //
-  // neutral edges
-  TopTools_MapOfShape aMEN;
-  for (TopTools_ListIteratorOfListOfShape aItLE(theLENeutral); aItLE.More(); aItLE.Next())
-  {
-    aMEN.Add(aItLE.Value());
-  }
-  //
-  // valid inverted edges
-  TopTools_MapOfShape aMEValInverted;
-  for (TopTools_ListIteratorOfListOfShape aItLE(theLEValInverted); aItLE.More(); aItLE.Next())
-  {
-    aMEValInverted.Add(aItLE.Value());
-  }
+  Standard_Integer aNbChecked;
   //
   Standard_Boolean bTreatInvertedAsInvalid = (theLFImages.Extent() == 1);
   //
@@ -1891,26 +1948,22 @@ void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
   // faces for post treat
   TopTools_ListOfShape aLFPT;
   //
+  TopTools_IndexedDataMapOfShapeListOfShape aDMEF;
   TopTools_ListIteratorOfListOfShape aItLF(theLFImages);
+  for (; aItLF.More(); aItLF.Next())
+  {
+    const TopoDS_Face& aFIm = *(TopoDS_Face*)&aItLF.Value();
+    TopExp::MapShapesAndAncestors (aFIm, TopAbs_EDGE, TopAbs_FACE, aDMEF);
+  }
+
+  aItLF.Initialize (theLFImages);
   for (; aItLF.More(); ) {
     const TopoDS_Face& aFIm = *(TopoDS_Face*)&aItLF.Value();
     //
     // valid edges for this split
-    TopTools_MapOfShape aMVE;
+    const TopTools_MapOfShape* pMVE = theDMFMVE.Seek (aFIm);
     // invalid edges for this split
-    TopTools_MapOfShape aMIE;
-    //
-    for (i = 0; i < 2; ++i) {
-      TopTools_MapOfShape& aME = !i ? aMVE : aMIE;
-      const TopTools_ListOfShape* pLE = !i ? theDMFLVE.Seek(aFIm) : theDMFLIE.Seek(aFIm);
-      if (pLE) {
-        TopTools_ListIteratorOfListOfShape aItLE(*pLE);
-        for (; aItLE.More(); aItLE.Next()) {
-          const TopoDS_Shape& aE = aItLE.Value();
-          aME.Add(aE);
-        }
-      }
-    }
+    const TopTools_IndexedMapOfShape* pMIE = theDMFMIE.Seek (aFIm);
     //
     bHasValid = Standard_False;
     bAllValid = Standard_True;
@@ -1927,29 +1980,34 @@ void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
       //
       bValid = theValidEdges.Contains(aEIm);
       bInvalid = theInvEdges.Contains(aEIm);
+      bNeutral = theMENeutral.Contains(aEIm);
       //
-      if (!bValid && !bInvalid) {
+      if (!bValid && !bInvalid && !bNeutral) {
         // edge has not been checked for some reason
         continue;
       }
-      //
+
+      // skip not-boundary edges originated from vertex
+      if ((theEdgesInvalidByVertex.Contains (aEIm) ||
+           theEdgesValidByVertex.Contains (aEIm)) &&
+           aDMEF.FindFromKey (aEIm).Extent() != 1)
+        continue;
+
       ++aNbChecked;
       //
-      bInvalidLoc = aMIE.Contains(aEIm);
-      bHasReallyInvalid = bInvalidLoc && !bValid && !theEdgesInvalidByVertex.Contains(aEIm);
+      bInvalidLoc = pMIE && pMIE->Contains (aEIm);
+      bHasReallyInvalid = bInvalid && bInvalidLoc && !bValid && !theEdgesInvalidByVertex.Contains(aEIm);
       if (bHasReallyInvalid) {
         break;
       }
       //
-      bNeutral = aMEN.Contains(aEIm);
-      bValidLoc = aMVE.Contains(aEIm);
-      //
+      bValidLoc = pMVE && pMVE->Contains(aEIm);
       bInverted = theMEInverted.Contains(aEIm);
       if (!bInvalid && bTreatInvertedAsInvalid) {
         bInvalid = bInverted;
       }
       //
-      if (bValidLoc && (bNeutral || aMEValInverted.Contains(aEIm))) {
+      if (bValidLoc && bNeutral) {
         bHasValid = Standard_True;
       }
       //
@@ -2010,27 +2068,14 @@ void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
   if (aLFPT.IsEmpty() || aMENRem.IsEmpty()) {
     return;
   }
-  //
-  Standard_Integer aNb = aMENRem.Extent();
-  for (i = 1; i <= aNb; ++i) {
-    aMEN.Remove(aMENRem(i));
-  }
-  //
+
   // check the splits once more
   aItLF.Initialize(aLFPT);
   for (; aItLF.More(); aItLF.Next()) {
     const TopoDS_Face& aFIm = *(TopoDS_Face*)&aItLF.Value();
     //
     // valid edges for this split
-    TopTools_MapOfShape aMVE;
-    const TopTools_ListOfShape* pLVE = theDMFLVE.Seek(aFIm);
-    if (pLVE) {
-      TopTools_ListIteratorOfListOfShape aItLE(*pLVE);
-      for (; aItLE.More(); aItLE.Next()) {
-        const TopoDS_Shape& aE = aItLE.Value();
-        aMVE.Add(aE);
-      }
-    }
+    const TopTools_MapOfShape* pMVE = theDMFMVE.Seek(aFIm);
     //
     bHasValid = Standard_False;
     bAllValid = Standard_True;
@@ -2043,14 +2088,14 @@ void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
       //
       bValid = theValidEdges.Contains(aEIm);
       bInvalid = theInvEdges.Contains(aEIm);
-      bNeutral = aMEN.Contains(aEIm);
-      bValidLoc = aMVE.Contains(aEIm);
+      bNeutral = theMENeutral.Contains(aEIm) && !aMENRem.Contains (aEIm);
+      bValidLoc = pMVE && pMVE->Contains(aEIm);
       //
       if (!bInvalid && bTreatInvertedAsInvalid) {
         bInvalid = theMEInverted.Contains(aEIm);
       }
       //
-      if (bValidLoc && (bNeutral || aMEValInverted.Contains(aEIm))) {
+      if (bValidLoc && bNeutral) {
         bHasValid = Standard_True;
       }
       //
@@ -2793,6 +2838,7 @@ void RemoveInvalidSplitsByInvertedEdges(const TopTools_MapOfShape& theMEInverted
 void RemoveInvalidSplitsFromValid(const TopTools_IndexedDataMapOfShapeListOfShape& theInvFaces,
                                   const TopTools_DataMapOfShapeShape& theArtInvFaces,
                                   const TopTools_MapOfShape& theMEInverted,
+                                  const BRepOffset_DataMapOfShapeMapOfShape& theDMFMVIE,
                                   TopTools_IndexedDataMapOfShapeListOfShape& theFImages)
 {
   // Decide whether to remove the found invalid faces or not.
@@ -2868,22 +2914,49 @@ void RemoveInvalidSplitsFromValid(const TopTools_IndexedDataMapOfShapeListOfShap
     TopTools_IndexedDataMapOfShapeListOfShape aDMEF;
     TopExp::MapShapesAndAncestors(aCB, TopAbs_EDGE, TopAbs_FACE, aDMEF);
     //
+    TopTools_DataMapOfShapeListOfShape aDMFF;
     aExp.Init(aCB, TopAbs_FACE);
     for (; aExp.More(); aExp.Next()) {
       const TopoDS_Shape& aFCB = aExp.Current();
-      //
-      TopExp_Explorer aExpE(aFCB, TopAbs_EDGE);
-      for (; aExpE.More(); aExpE.Next()) {
-        const TopoDS_Shape& aECB = aExpE.Current();
-        if (aDMEF.FindFromKey(aECB).Extent() > 1) {
-          if (!theMEInverted.Contains(aECB)) {
+      const TopoDS_Shape& aF = aDMIFOF.Find (aFCB);
+      TopTools_ListOfShape* pList = aDMFF.ChangeSeek (aF);
+      if (!pList)
+        pList = aDMFF.Bound (aF, TopTools_ListOfShape());
+      pList->Append (aFCB);
+    }
+
+    for (TopTools_DataMapOfShapeListOfShape::Iterator itM (aDMFF); itM.More(); itM.Next())
+    {
+      const TopoDS_Shape& aF = itM.Key();
+      const TopTools_MapOfShape* pValidInverted = theDMFMVIE.Seek (aF);
+
+      // either remove all of these faces or none.
+      const TopTools_ListOfShape& aLFCB = itM.Value();
+      TopTools_ListOfShape::Iterator itL (aLFCB);
+      for (; itL.More(); itL.Next())
+      {
+        const TopoDS_Shape& aFCB = itL.Value();
+        TopExp_Explorer aExpE(aFCB, TopAbs_EDGE);
+        for (; aExpE.More(); aExpE.Next()) {
+          const TopoDS_Shape& aECB = aExpE.Current();
+          if (pValidInverted && pValidInverted->Contains (aECB))
             break;
+          if (aDMEF.FindFromKey(aECB).Extent() > 1)
+          {
+            if (!theMEInverted.Contains(aECB))
+              break;
           }
         }
+        if (!aExpE.More())
+          // if one removed - remove all
+          break;
       }
-      //
-      if (!aExpE.More()) {
-        aMFToRem.Add(aFCB);
+      if (itL.More())
+      {
+        for (itL.Initialize (aLFCB); itL.More(); itL.Next())
+        {
+          aMFToRem.Add (itL.Value());
+        }
       }
     }
   }
@@ -3709,8 +3782,9 @@ void FilterEdgesImages(const TopoDS_Shape& theS,
 //function : FilterInvalidFaces
 //purpose  : Filtering of the invalid faces
 //=======================================================================
-void FilterInvalidFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
+void FilterInvalidFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
                         const TopTools_IndexedDataMapOfShapeListOfShape& theDMEF,
+                        const TopTools_IndexedMapOfShape& theInvEdges,
                         const TopTools_IndexedMapOfShape& theMERemoved,
                         TopTools_IndexedDataMapOfShapeListOfShape& theInvFaces,
                         TopTools_DataMapOfShapeShape& theArtInvFaces)
@@ -3721,10 +3795,12 @@ void FilterInvalidFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFIma
   // do not remove invalid faces if it creates free edges
   //
   TopTools_IndexedDataMapOfShapeListOfShape aReallyInvFaces;
+  // Edge-Face connexity map of all splits, both invalid and valid
+  TopTools_IndexedDataMapOfShapeListOfShape aDMEFAll;
   TopTools_ListIteratorOfListOfShape aItLF;
   //
-  Standard_Integer i, aNb = theInvFaces.Extent();
-  for (i = 1; i <= aNb; ++i) {
+  const Standard_Integer aNb = theInvFaces.Extent();
+  for (Standard_Integer i = 1; i <= aNb; ++i) {
     const TopoDS_Shape& aF = theInvFaces.FindKey(i);
     const TopTools_ListOfShape& aLFInv = theInvFaces(i);
     //
@@ -3742,7 +3818,7 @@ void FilterInvalidFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFIma
       continue;
     }
     //
-    const TopTools_ListOfShape& aLFIm = theFImages.FindFromKey(aF);
+    TopTools_ListOfShape& aLFIm = theFImages.ChangeFromKey(aF);
     Standard_Boolean bInvalid = aLFIm.IsEmpty();
     //
     if (!bInvalid) {
@@ -3794,6 +3870,55 @@ void FilterInvalidFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFIma
         bInvalid = aItLF.More();
       }
     }
+    if (bInvalid)
+    {
+      if (aDMEFAll.IsEmpty())
+      {
+        aDMEFAll = theDMEF;
+        for (Standard_Integer iF = 1; iF <= aNb; ++iF)
+          for (TopTools_ListOfShape::Iterator itLFInv (theInvFaces(iF)); itLFInv.More(); itLFInv.Next())
+            TopExp::MapShapesAndAncestors (itLFInv.Value(), TopAbs_EDGE, TopAbs_FACE, aDMEFAll);
+      }
+
+      TopTools_MapOfShape aLocalSplits;
+      for (Standard_Integer j = 0; j < 2; ++j)
+        for (aItLF.Initialize((!j ? aLFIm : aLFInv)); aItLF.More(); aItLF.Next())
+          aLocalSplits.Add (aItLF.Value());
+
+      // Check if all invalid edges are located inside the split and do not touch
+      // any other faces both invalid and valid
+      aItLF.Initialize(aLFInv);
+      for (; aItLF.More(); aItLF.Next())
+      {
+        const TopoDS_Shape& aFIm = aItLF.Value();
+        TopExp_Explorer aExp(aFIm, TopAbs_EDGE);
+        for (; aExp.More(); aExp.Next())
+        {
+          const TopoDS_Shape& aE = aExp.Current();
+          if (theInvEdges.Contains (aE) && !theMERemoved.Contains (aE))
+          {
+            const TopTools_ListOfShape& aLF = aDMEFAll.FindFromKey (aE);
+            TopTools_ListOfShape::Iterator itLF (aLF);
+            for (; itLF.More(); itLF.Next())
+            {
+              if (!aLocalSplits.Contains (itLF.Value()))
+                break;
+            }
+            if (itLF.More())
+              break;
+          }
+        }
+        if (aExp.More())
+          break;
+      }
+      bInvalid = aItLF.More();
+      if (!bInvalid)
+      {
+        aItLF.Initialize(aLFInv);
+        for (; aItLF.More(); aItLF.Next())
+          AppendToList (aLFIm, aItLF.Value());
+      }
+    }
     //
     if (bInvalid) {
       aReallyInvFaces.Add(aF, aLFInv);
@@ -3809,7 +3934,7 @@ void FilterInvalidFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFIma
 //=======================================================================
 void FilterInvalidEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theInvFaces,
                         const TopTools_DataMapOfShapeShape& theArtInvFaces,
-                        const TopTools_DataMapOfShapeListOfShape& theDMFLIE,
+                        const BRepOffset_DataMapOfShapeIndexedMapOfShape& theDMFMIE,
                         const TopTools_IndexedMapOfShape& theMERemoved,
                         TopTools_IndexedMapOfShape& theInvEdges)
 {
@@ -3864,10 +3989,11 @@ void FilterInvalidEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theInvF
   for (i = 1; i <= aNb; ++i) {
     const TopoDS_Shape& aF = theInvFaces.FindKey(i);
     if (theArtInvFaces.IsBound(aF)) {
-      const TopTools_ListOfShape& aLEInv = theDMFLIE.Find(aF);
-      aItLF.Initialize(aLEInv);
-      for (; aItLF.More(); aItLF.Next()) {
-        const TopoDS_Shape& aE = aItLF.Value();
+      const TopTools_IndexedMapOfShape& aMIE = theDMFMIE.Find(aF);
+      const Standard_Integer aNbIE = aMIE.Extent();
+      for (Standard_Integer iE = 1; iE <= aNbIE; ++iE)
+      {
+        const TopoDS_Shape& aE = aMIE (iE);
         if (aMEInv.Contains(aE) && !aMEInvToAvoid.Contains(aE)) {
           aReallyInvEdges.Add(aE);
         }
index 1a19b88abffe9bcbe74033ecf236eb0000b74827..672b2f22527f31cdd8fb94e7d545b4187549d5a0 100644 (file)
 #include <Standard_ErrorHandler.hxx>
 #include <Standard_Failure.hxx>
 #include <TopTools_ListOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_SequenceOfShape.hxx>
+#include <TopTools_Array1OfShape.hxx>
+#include <NCollection_Vector.hxx>
 #include <TopoDS_Compound.hxx>
 #include <BRep_Builder.hxx>
 
@@ -41,9 +46,32 @@ Standard_EXPORT const char* DBRep_Set (const char* theNameStr, void* theShapePtr
   }
 }
 
+//=======================================================================
+//function : fromContainer
+//purpose  : static function to copy shapes from container into compound
+//=======================================================================
+template <class T>
+static Standard_Boolean fromContainer (void* theContainer,
+                                       TopoDS_Compound& theShape)
+{
+  try
+  {
+    T *pContainer = (T*) theContainer;
+    for (typename T::Iterator it (*pContainer); it.More(); it.Next())
+    {
+      BRep_Builder().Add (theShape, it.Value());
+    }
+    return true;
+  }
+  catch (Standard_Failure const&)
+  {
+    return false;
+  }
+}
+
 //=======================================================================
 //function : DBRep_SetComp
-//purpose  : make compound from the given list of shapes
+//purpose  : make compound from the given container of shapes
 //=======================================================================
 Standard_EXPORT const char* DBRep_SetComp(const char* theNameStr, void* theListPtr)
 {
@@ -51,26 +79,23 @@ Standard_EXPORT const char* DBRep_SetComp(const char* theNameStr, void* theListP
   {
     return "Error: name or list of shapes is null";
   }
-  try {
-    TopTools_ListOfShape *pLS;
-    pLS = (TopTools_ListOfShape *)theListPtr;
 
-    TopoDS_Compound aC;
-    BRep_Builder aBB;
-    TopTools_ListIteratorOfListOfShape aIt;
+  TopoDS_Compound aC;
+  BRep_Builder().MakeCompound(aC);
 
-    aBB.MakeCompound(aC);
-    aIt.Initialize(*pLS);
-    for (; aIt.More(); aIt.Next()) {
-      const TopoDS_Shape& aE = aIt.Value();
-      aBB.Add(aC, aE);
-    }
-    DBRep::Set(theNameStr, aC);
+  if (fromContainer<TopTools_ListOfShape>       (theListPtr, aC)
+   || fromContainer<TopTools_MapOfShape>        (theListPtr, aC)
+   || fromContainer<TopTools_IndexedMapOfShape> (theListPtr, aC)
+   || fromContainer<TopTools_SequenceOfShape>   (theListPtr, aC)
+   || fromContainer<TopTools_Array1OfShape>     (theListPtr, aC)
+   || fromContainer<NCollection_Vector<TopoDS_Shape> > (theListPtr, aC))
+  {
+    DBRep::Set (theNameStr, aC);
     return theNameStr;
   }
-  catch (Standard_Failure const& anException)
+  else
   {
-    return anException.GetMessageString();
+    return "Error: Invalid type";
   }
 }
 
index 989a750547e3c96eddb4b92be058b62cd9ce3f14..740ec79bf4be3fd6fa42aaf6f026f186567ddb76 100644 (file)
@@ -1,7 +1,7 @@
 restore [locate_data_file bug25926_input_slanted.brep] s
 
 set distance 5
-offsetparameter 1.e-7 $calcul $type
+offsetparameter 1.e-7 $calcul $type r
 offsetload s $distance
 explode s f
 # s_1 s_6 s_8 s_10 s_12 s_14
index 5f1185871b8106f42905d06fe2b21113a66bfa4f..08fd725c9660ce320fa650e0a5f639500cc5b18f 100644 (file)
@@ -1,6 +1,5 @@
-puts "TODO OCC27414 ALL: Error: The command cannot be built"
-puts "TODO OCC27414 ALL: gives an empty result"
-puts "TODO OCC27414 ALL: TEST INCOMPLETE"
+puts "TODO OCC27414 ALL: Error : The area of result shape is"
+puts "TODO OCC27414 ALL: Error : The volume of result shape is"
 
 restore [locate_data_file bug26917_input.dom7742_trim1.brep] s
 
index c0f44c9ba4c4d8526851cd721704590f94ac5d17..ac508a5b344e628045d30325bba0151e9cd02c60 100644 (file)
@@ -1,11 +1,8 @@
-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_dom-7724_trim3.brep] s
 
 OFFSETSHAPE 15 {} $calcul $type
 
-checkprops result -v 0 -s 0
+checkprops result -s 153867 -v 2.22586e+06
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -wire 18 -face 18 -shell 1 -solid 1
index 40a1e66eaf0fe0ecdd625b82a82448c9e6ae4711..f917a79649ab3c45bcbab39de4c0359b3c4974e3 100644 (file)
@@ -1,10 +1,8 @@
-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_trim6.brep] s
 
 OFFSETSHAPE 15 {} $calcul $type
 
-checkprops result -v 0 -s 0
+checkprops result -s 62819.5 -v 519234
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -wire 13 -face 13 -shell 1 -solid 1
index 7f3a7652efdffb9632bdc85661af6b21aa01d6f3..c9a62958e2d50bbaf38d52c3583d61df5d15d33c 100644 (file)
@@ -1,10 +1,8 @@
-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_trim7.brep] s
 
 OFFSETSHAPE 15 {} $calcul $type
 
-checkprops result -v 0 -s 0
+checkprops result -s 55789.4 -v 416299
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -wire 9 -face 9 -shell 1 -solid 1
index 30fac369f16afbd2bd391d0c5d3f4b78dc927482..858bd4872a207a09d1564de98ad3dd7ad516fdbe 100644 (file)
@@ -1,11 +1,10 @@
-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_dom-7724_trim9.brep] s
 
 OFFSETSHAPE 15 {} $calcul $type
 
-checkprops result -v 0 -s 0
+checkprops result -s 167920 -v 2.69245e+06
+
+unifysamedom result_unif result
+
+checknbshapes result_unif -wire 19 -face 19 -shell 1 -solid 1
 
-checknbshapes result -shell 1
index ad576bc57dc415af0ca9a4c585400c7a50618c35..2f0655ac9392da954caa77eed7a7cc3328833777 100644 (file)
@@ -1,5 +1,3 @@
-puts "TODO CR27414 ALL: Error :  is WRONG because number of FACE entities in shape"
-
 restore [locate_data_file bug26917_dom-7724_trim1.brep] s
 
 offsetparameter 1e-7 c i
diff --git a/tests/offset/shape_type_i_c/XT3 b/tests/offset/shape_type_i_c/XT3
new file mode 100644 (file)
index 0000000..3cf4060
--- /dev/null
@@ -0,0 +1,29 @@
+puts "========"
+puts "0031307: Modeling Algorithms - Offset algorithm produces incorrect result in mode Complete join type Intersection"
+puts "========"
+puts ""
+
+restore [locate_data_file bug31307_input.brep] s
+offsetparameter 1e-7 c i r
+offsetload s 0
+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($z - 1) < 1.e-7} {
+    offsetonface $f 0
+  } else {
+    if {$found && abs($z) < 1.e-7} {
+      offsetonface $f 10
+    } else {
+      offsetonface $f 9.961946980917444
+    }
+  }
+}
+offsetperform result
+
+checkprops result -s 2.31278e+06 -v 2.94585e+07
+
+unifysamedom result_unif result
+checknbshapes result_unif -vertex 188 -edge 285 -wire 101 -face 100 -shell 1 -solid 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XT4 b/tests/offset/shape_type_i_c/XT4
new file mode 100644 (file)
index 0000000..564d09d
--- /dev/null
@@ -0,0 +1,29 @@
+puts "========"
+puts "0031307: Modeling Algorithms - Offset algorithm produces incorrect result in mode Complete join type Intersection"
+puts "========"
+puts ""
+
+restore [locate_data_file bug31307_input.good.brep] s
+offsetparameter 1e-7 c i r
+offsetload s 0
+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($z - 1) < 1.e-7} {
+    offsetonface $f 0
+  } else {
+    if {$found && abs($z) < 1.e-7} {
+      offsetonface $f 10
+    } else {
+      offsetonface $f 9.961946980917444
+    }
+  }
+}
+offsetperform result
+
+checkprops result -s 2.31278e+06 -v 2.94585e+07
+
+unifysamedom result_unif result
+checknbshapes result_unif -vertex 188 -edge 285 -wire 101 -face 100 -shell 1 -solid 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XT5 b/tests/offset/shape_type_i_c/XT5
new file mode 100644 (file)
index 0000000..402b068
--- /dev/null
@@ -0,0 +1,29 @@
+puts "========"
+puts "0031307: Modeling Algorithms - Offset algorithm produces incorrect result in mode Complete join type Intersection"
+puts "========"
+puts ""
+
+restore [locate_data_file bug31307_input_trim.brep] s
+offsetparameter 1e-7 c i r
+offsetload s 0
+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($z - 1) < 1.e-7} {
+    offsetonface $f 0
+  } else {
+    if {$found && abs($z) < 1.e-7} {
+      offsetonface $f 10
+    } else {
+      offsetonface $f 9.961946980917444
+    }
+  }
+}
+offsetperform result
+
+checkprops result -s 245702 -v 2.91993e+06
+
+unifysamedom result_unif result
+checknbshapes result_unif -vertex 22 -edge 34 -wire 14 -face 14 -shell 1 -solid 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XT6 b/tests/offset/shape_type_i_c/XT6
new file mode 100644 (file)
index 0000000..3527384
--- /dev/null
@@ -0,0 +1,18 @@
+puts "========"
+puts "0031307: Modeling Algorithms - Offset algorithm produces incorrect result in mode Complete join type Intersection"
+puts "========"
+puts ""
+
+restore [locate_data_file bug31307_input_trim.brep] s
+offsetparameter 1e-7 c i r
+offsetload s 0
+explode s f
+offsetonface s_1 1
+offsetperform result
+
+checkprops result -s 221506 -v 1.89037e+06
+
+unifysamedom result_unif result
+checknbshapes result_unif -vertex 22 -edge 34 -wire 14 -face 14 -shell 1 -solid 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XT7 b/tests/offset/shape_type_i_c/XT7
new file mode 100644 (file)
index 0000000..658887a
--- /dev/null
@@ -0,0 +1,16 @@
+puts "========"
+puts "0031307: Modeling Algorithms - Offset algorithm produces incorrect result in mode Complete join type Intersection"
+puts "========"
+puts ""
+
+restore [locate_data_file bug31307_input_trim.brep] s
+offsetparameter 1e-7 c i r
+offsetload s 10
+offsetperform result
+
+checkprops result -s 266169 -v 4.26434e+06
+
+unifysamedom result_unif result
+checknbshapes result_unif -vertex 24 -edge 36 -wire 14 -face 14 -shell 1 -solid 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XT8 b/tests/offset/shape_type_i_c/XT8
new file mode 100644 (file)
index 0000000..cf9b06d
--- /dev/null
@@ -0,0 +1,16 @@
+puts "========"
+puts "0031307: Modeling Algorithms - Offset algorithm produces incorrect result in mode Complete join type Intersection"
+puts "========"
+puts ""
+
+restore [locate_data_file bug31307_input.brep] s
+offsetparameter 1e-7 c i r
+offsetload s 10
+offsetperform result
+
+checkprops result -s  2.38187e+06 -v 4.36539e+07
+
+unifysamedom result_unif result
+checknbshapes result_unif -vertex 194 -edge 291 -wire 101 -face 100 -shell 1 -solid 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XT9 b/tests/offset/shape_type_i_c/XT9
new file mode 100644 (file)
index 0000000..42bef25
--- /dev/null
@@ -0,0 +1,16 @@
+puts "========"
+puts "0031307: Modeling Algorithms - Offset algorithm produces incorrect result in mode Complete join type Intersection"
+puts "========"
+puts ""
+
+restore [locate_data_file bug31307_input.good.brep] s
+offsetparameter 1e-7 c i r
+offsetload s 10
+offsetperform result
+
+checkprops result -s  2.38187e+06 -v 4.36539e+07
+
+unifysamedom result_unif result
+checknbshapes result_unif -vertex 194 -edge 291 -wire 101 -face 100 -shell 1 -solid 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XU1 b/tests/offset/shape_type_i_c/XU1
new file mode 100644 (file)
index 0000000..4b24598
--- /dev/null
@@ -0,0 +1,18 @@
+puts "========"
+puts "0031307: Modeling Algorithms - Offset algorithm produces incorrect result in mode Complete join type Intersection"
+puts "========"
+puts ""
+
+restore [locate_data_file bug31307_input_trim.brep] s
+offsetparameter 1e-7 c i r
+offsetload s 0
+explode s f
+offsetonface s_13 2
+offsetperform result
+
+checkprops result -s 220139 -v 1.8442e+06
+
+unifysamedom result_unif result
+checknbshapes result_unif -vertex 24 -edge 36 -wire 14 -face 14 -shell 1 -solid 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XU2 b/tests/offset/shape_type_i_c/XU2
new file mode 100644 (file)
index 0000000..a61a5cf
--- /dev/null
@@ -0,0 +1,18 @@
+puts "========"
+puts "0031307: Modeling Algorithms - Offset algorithm produces incorrect result in mode Complete join type Intersection"
+puts "========"
+puts ""
+
+restore [locate_data_file bug31307_input_trim.brep] s
+offsetparameter 1e-7 c i r
+offsetload s 0
+explode s f
+offsetonface s_9 2
+offsetperform result
+
+checkprops result -s 221321 -v 1.85565e+06
+
+#unifysamedom result_unif result
+#checknbshapes result_unif -vertex 24 -edge 36 -wire 14 -face 14 -shell 1 -solid 1
+
+#checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/offset/shape_type_i_c/XU3 b/tests/offset/shape_type_i_c/XU3
new file mode 100644 (file)
index 0000000..36281a1
--- /dev/null
@@ -0,0 +1,23 @@
+puts "TODO OCC27414 ALL: Error : The area of result shape is"
+puts "TODO OCC27414 ALL: Error : The volume of result shape is"
+puts "TODO OCC27414 ALL: Error :  is WRONG because number of"
+
+puts "========"
+puts "0031307: Modeling Algorithms - Offset algorithm produces incorrect result in mode Complete join type Intersection"
+puts "========"
+puts ""
+
+restore [locate_data_file bug31307_input_trim.brep] s
+offsetparameter 1e-7 c i r
+offsetload s 0
+explode s f
+offsetonface s_9 7
+offsetperform result
+
+checkprops result -s 222993 -v 1.87721e+06
+
+unifysamedom result_unif result
+
+checknbshapes result_unif -vertex 26 -edge 39 -wire 15 -face 15 -shell 1 -solid 1
+
+checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
index 86335bbec9d6c6f9e0040e93ddc7e57bec308b4d..647b14293f7874cb432cb499835bcc9369a8ef56 100644 (file)
@@ -1,5 +1,6 @@
-puts "TODO CR27414 ALL: Error : The area of result shape is"
-puts "TODO CR27414 ALL: Faulty shapes in variables faulty_1 to faulty_"
+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_M2_trim34.brep] s
 
index beb2671fe8232298033829271d58e624e0cf68f9..0de58d4547519778044bd9956d47e393e6fa7910 100644 (file)
@@ -1,8 +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_M2_trim32.brep] s
 
 OFFSETSHAPE 15  {} $calcul $type
 
-checkprops result -v 1.87061e+006
-checkprops result -s 95780.7
+checkprops result -s 0 -v 0
 
 checknbshapes result -shell 1
index 2aeebfc79e52ff607cb36ae4d565763dceb10f42..3f409e5c7c0fe92be4d6f96d52ef9a0226b22888 100644 (file)
@@ -1,11 +1,10 @@
-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_dom-7724.brep] s
 
-OFFSETSHAPE 15 {} $calcul $type
+offsetparameter 1.e-7 c i r
+offsetload s 15
+offsetperform result
 
-checkprops result -v 8.95633e+008 -s 6.22693e+006
+checkprops result -s 6.21471e+06 -v 8.95633e+08
 
-checknbshapes result -shell 1
+unifysamedom result_unif result
+checknbshapes result_unif -wire 142 -face 140 -shell 1 -solid 1