diff --git a/src/BRepOffset/BRepOffset_Inter2d.cxx b/src/BRepOffset/BRepOffset_Inter2d.cxx index e4823b8d4d..69d234834a 100644 --- a/src/BRepOffset/BRepOffset_Inter2d.cxx +++ b/src/BRepOffset/BRepOffset_Inter2d.cxx @@ -586,6 +586,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()) { diff --git a/src/BRepOffset/BRepOffset_MakeOffset_1.cxx b/src/BRepOffset/BRepOffset_MakeOffset_1.cxx index f78f8cc20e..6462ea6348 100644 --- a/src/BRepOffset/BRepOffset_MakeOffset_1.cxx +++ b/src/BRepOffset/BRepOffset_MakeOffset_1.cxx @@ -70,6 +70,8 @@ typedef NCollection_DataMap BRepOffset_DataMapOfShapeMapOfShape; +typedef NCollection_DataMap + BRepOffset_DataMapOfShapeIndexedMapOfShape; static void IntersectTrimmedEdges(const TopTools_ListOfShape& theLF, @@ -161,24 +163,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, @@ -234,6 +237,7 @@ static void RemoveInvalidSplitsFromValid(const TopTools_IndexedDataMapOfShapeListOfShape& theInvFaces, const TopTools_DataMapOfShapeShape& theArtInvFaces, const TopTools_MapOfShape& theMEInverted, + const BRepOffset_DataMapOfShapeMapOfShape& theDMFMVIE, TopTools_IndexedDataMapOfShapeListOfShape& theFImages); static @@ -286,8 +290,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); @@ -295,7 +300,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); @@ -836,18 +841,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; // @@ -937,7 +944,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF, } // if (bArtificialCase) { - TopTools_ListOfShape aLEInv; + TopTools_IndexedMapOfShape aMEInv; // make the face invalid theArtInvFaces.Bind(aF, aCE); // @@ -950,7 +957,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); @@ -958,7 +965,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF, } } // - aDMFLIE.Bind(aF, aLEInv); + aDMFMIE.Bind(aF, aMEInv); aLFDone.Append(aF); // continue; @@ -967,8 +974,8 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF, // // find invalid edges FindInvalidEdges(aF, aLFImages, theEdgesOrigins, theFacesOrigins, theAnalyse, 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) { @@ -982,7 +989,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF, aLFDone.Append(aF); } // - if (theInvEdges.IsEmpty() && theArtInvFaces.IsEmpty()) { + if (theInvEdges.IsEmpty() && theArtInvFaces.IsEmpty() && aDMFMIE.IsEmpty()) { return; } // @@ -1035,7 +1042,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF, } } - TopTools_ListOfShape anEmptyList; + TopTools_MapOfShape anEmptyMap; // invalid faces inside the holes TopTools_IndexedMapOfShape aMFInvInHole; // all hole faces @@ -1055,18 +1062,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; + const TopTools_MapOfShape* pMNE = aDMFMNE.ChangeSeek(aF); + if (!pMNE) { + pMNE = &anEmptyMap; } - // valid inverted edges - TopTools_ListOfShape* pLIVE = aDMFLVIE.ChangeSeek(aF); - if (!pLIVE) { - pLIVE = &anEmptyList; - } - // // find faces inside holes wires TopTools_MapOfShape aMFHoles; const TopoDS_Face& aFOr = TopoDS::Face(theFacesOrigins.Find(aF)); @@ -1079,8 +1081,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); } // @@ -1128,7 +1130,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; @@ -1157,7 +1160,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(); @@ -1180,7 +1183,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 @@ -1562,13 +1565,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; @@ -1590,6 +1594,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()) { @@ -1619,6 +1625,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, theAnalyse, aSInF)) + continue; + TopTools_ListOfShape* pImages = anImages.ChangeSeek (aSInF); + if (!pImages) + pImages = anImages.Bound (aSInF, TopTools_ListOfShape()); + AppendToList (*pImages, aE); + } } } // @@ -1631,9 +1653,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()) { @@ -1660,6 +1682,8 @@ void FindInvalidEdges(const TopoDS_Face& theF, ++aNbVOr; } } + if (aNbVOr > 1 && (aLEOr.Extent() - aNbVOr) > 1) + continue; // TopTools_MapOfShape aME, aMV, aMF; Standard_Boolean bInvalid = Standard_False, bChecked = Standard_False; @@ -1690,12 +1714,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 { @@ -1712,22 +1746,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; } @@ -1744,13 +1812,10 @@ void FindInvalidEdges(const TopoDS_Face& theF, itFA.More(); itFA.Next()) aMF.Add (itFA.Value()); } - } - // - if (aCos < Precision::Confusion()) { - bInvalid = Standard_True; - aNbInv++; - if (bVertex) { - theEdgesInvalidByVertex.Add(aEIm); + // + if (aCos < Precision::Confusion()) { + bInvalid = Standard_True; + aNbInv++; } } bChecked = Standard_True; @@ -1760,7 +1825,7 @@ void FindInvalidEdges(const TopoDS_Face& theF, continue; } // - Standard_Boolean bLocalOnly = Standard_False; + Standard_Boolean bLocalOnly = (aNbVOr > 1 && (aLEOr.Extent() - aNbVOr) > 1); Standard_Integer aNbE = aME.Extent(), aNbV = aMV.Extent(); if (aNbE > 1 && aNbV == 2*aNbE) { @@ -1796,7 +1861,7 @@ void FindInvalidEdges(const TopoDS_Face& theF, if (bInvalid) { if (!bLocalOnly) theInvEdges.Add(aEIm); - aLIE.Append(aEIm); + aMIE.Add (aEIm); aMEInv.Add(aEIm); continue; } @@ -1809,27 +1874,29 @@ void FindInvalidEdges(const TopoDS_Face& theF, if (!bInverted || !aNbVOr) { if (!bLocalOnly) 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) { @@ -1837,8 +1904,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; } // @@ -1864,18 +1932,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); } } @@ -1886,12 +1956,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, @@ -1910,21 +1980,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); // @@ -1934,26 +1990,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; @@ -1970,29 +2022,34 @@ void FindInvalidFaces(TopTools_ListOfShape& theLFImages, // bValid = theValidEdges.Contains(aEIm); bInvalid = theInvEdges.Contains(aEIm); - bNeutral = aMEN.Contains(aEIm); + bNeutral = theMENeutral.Contains(aEIm); // 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); + bInvalidLoc = pMIE && pMIE->Contains (aEIm); bHasReallyInvalid = bInvalid && bInvalidLoc && !bValid && !theEdgesInvalidByVertex.Contains(aEIm); if (bHasReallyInvalid) { break; } // - bValidLoc = aMVE.Contains(aEIm); - // + bValidLoc = pMVE && pMVE->Contains(aEIm); bInverted = theMEInverted.Contains(aEIm); if (!bInvalid && !bInvalidLoc && bTreatInvertedAsInvalid) { bInvalid = bInverted; } // - if (bValidLoc && (bNeutral || aMEValInverted.Contains(aEIm))) { + if (bValidLoc && bNeutral) { bHasValid = Standard_True; } // @@ -2053,27 +2110,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; @@ -2086,14 +2130,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; } // @@ -2836,6 +2880,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. @@ -2911,22 +2956,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()); + } } } } @@ -3752,8 +3824,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) @@ -3764,10 +3837,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); // @@ -3785,7 +3860,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) { @@ -3837,6 +3912,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); @@ -3852,7 +3976,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) { @@ -3907,10 +4031,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); } diff --git a/src/DBRep/DBRep_Debug.cxx b/src/DBRep/DBRep_Debug.cxx index 1a19b88abf..672b2f2252 100644 --- a/src/DBRep/DBRep_Debug.cxx +++ b/src/DBRep/DBRep_Debug.cxx @@ -18,6 +18,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include @@ -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 +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 (theListPtr, aC) + || fromContainer (theListPtr, aC) + || fromContainer (theListPtr, aC) + || fromContainer (theListPtr, aC) + || fromContainer (theListPtr, aC) + || fromContainer > (theListPtr, aC)) + { + DBRep::Set (theNameStr, aC); return theNameStr; } - catch (Standard_Failure const& anException) + else { - return anException.GetMessageString(); + return "Error: Invalid type"; } } diff --git a/tests/offset/shape_type_i_c/J2 b/tests/offset/shape_type_i_c/J2 index 989a750547..740ec79bf4 100644 --- a/tests/offset/shape_type_i_c/J2 +++ b/tests/offset/shape_type_i_c/J2 @@ -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 diff --git a/tests/offset/shape_type_i_c/XC1 b/tests/offset/shape_type_i_c/XC1 index 5f1185871b..08fd725c96 100644 --- a/tests/offset/shape_type_i_c/XC1 +++ b/tests/offset/shape_type_i_c/XC1 @@ -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 diff --git a/tests/offset/shape_type_i_c/XE5 b/tests/offset/shape_type_i_c/XE5 index c0f44c9ba4..ac508a5b34 100644 --- a/tests/offset/shape_type_i_c/XE5 +++ b/tests/offset/shape_type_i_c/XE5 @@ -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 diff --git a/tests/offset/shape_type_i_c/XE7 b/tests/offset/shape_type_i_c/XE7 index 40a1e66eaf..f917a79649 100644 --- a/tests/offset/shape_type_i_c/XE7 +++ b/tests/offset/shape_type_i_c/XE7 @@ -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 diff --git a/tests/offset/shape_type_i_c/XE8 b/tests/offset/shape_type_i_c/XE8 index 7f3a7652ef..c9a62958e2 100644 --- a/tests/offset/shape_type_i_c/XE8 +++ b/tests/offset/shape_type_i_c/XE8 @@ -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 diff --git a/tests/offset/shape_type_i_c/XF1 b/tests/offset/shape_type_i_c/XF1 index 30fac369f1..858bd4872a 100644 --- a/tests/offset/shape_type_i_c/XF1 +++ b/tests/offset/shape_type_i_c/XF1 @@ -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 diff --git a/tests/offset/shape_type_i_c/XG2 b/tests/offset/shape_type_i_c/XG2 index ad576bc57d..2f0655ac93 100644 --- a/tests/offset/shape_type_i_c/XG2 +++ b/tests/offset/shape_type_i_c/XG2 @@ -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 index 0000000000..3cf4060546 --- /dev/null +++ b/tests/offset/shape_type_i_c/XT3 @@ -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 index 0000000000..564d09d342 --- /dev/null +++ b/tests/offset/shape_type_i_c/XT4 @@ -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 index 0000000000..402b06863e --- /dev/null +++ b/tests/offset/shape_type_i_c/XT5 @@ -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 index 0000000000..35273843a3 --- /dev/null +++ b/tests/offset/shape_type_i_c/XT6 @@ -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 index 0000000000..658887ae86 --- /dev/null +++ b/tests/offset/shape_type_i_c/XT7 @@ -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 index 0000000000..cf9b06dc5c --- /dev/null +++ b/tests/offset/shape_type_i_c/XT8 @@ -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 index 0000000000..42bef258b3 --- /dev/null +++ b/tests/offset/shape_type_i_c/XT9 @@ -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 index 0000000000..4b24598222 --- /dev/null +++ b/tests/offset/shape_type_i_c/XU1 @@ -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 index 0000000000..a61a5cf4e1 --- /dev/null +++ b/tests/offset/shape_type_i_c/XU2 @@ -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 index 0000000000..36281a1d0e --- /dev/null +++ b/tests/offset/shape_type_i_c/XU3 @@ -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 diff --git a/tests/offset/shape_type_i_c/ZC7 b/tests/offset/shape_type_i_c/ZC7 index 86335bbec9..647b14293f 100644 --- a/tests/offset/shape_type_i_c/ZC7 +++ b/tests/offset/shape_type_i_c/ZC7 @@ -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 diff --git a/tests/offset/shape_type_i_c/ZG5 b/tests/offset/shape_type_i_c/ZG5 index beb2671fe8..0de58d4547 100644 --- a/tests/offset/shape_type_i_c/ZG5 +++ b/tests/offset/shape_type_i_c/ZG5 @@ -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 diff --git a/tests/offset/shape_type_i_c/ZS1 b/tests/offset/shape_type_i_c/ZS1 index 2aeebfc79e..3f409e5c7c 100644 --- a/tests/offset/shape_type_i_c/ZS1 +++ b/tests/offset/shape_type_i_c/ZS1 @@ -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