From: jfa Date: Thu, 30 Dec 2004 08:42:58 +0000 (+0000) Subject: PAL7275: Gluing two cones. Fix done by PKV. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=72706d9fdebe29588db29b35f1d87e0c05a1d6b0;p=modules%2Fgeom.git PAL7275: Gluing two cones. Fix done by PKV. --- diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx index 9d6d346e5..bd497c1f3 100755 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx @@ -676,12 +676,16 @@ void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV, void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE, TopoDS_Edge& aNewEdge) { + //modified by NIZNHY-PKV Thu Dec 30 11:15:23 2004 f myErrorStatus=0; // + Standard_Boolean bIsDE; Standard_Real aT1, aT2; TopoDS_Vertex aV1, aV2, aVR1, aVR2; TopoDS_Edge aEx; // + bIsDE=BRep_Tool::Degenerated(aE); + // aEx=aE; aEx.Orientation(TopAbs_FORWARD); // @@ -695,7 +699,31 @@ void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE, aVR2=TopoDS::Vertex(myOrigins.Find(aV2)); aVR2.Orientation(TopAbs_REVERSED); // - BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge); + if (bIsDE) { + Standard_Real aTol; + BRep_Builder aBB; + TopoDS_Edge E; + TopAbs_Orientation anOrE; + // + anOrE=aE.Orientation(); + aTol=BRep_Tool::Tolerance(aE); + // + E=aEx; + E.EmptyCopy(); + // + aBB.Add (E, aVR1); + aBB.Add (E, aVR2); + aBB.Range(E, aT1, aT2); + aBB.Degenerated(E, Standard_True); + aBB.UpdateEdge(E, aTol); + // + aNewEdge=E; + } + // + else { + BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge); + } + //modified by NIZNHY-PKV Thu Dec 30 11:15:28 2004 t } // //======================================================================= @@ -736,17 +764,23 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF, for (; aExpE.More(); aExpE.Next()) { const TopoDS_Edge& aE=TopoDS::Edge(aExpE.Current()); aER=TopoDS::Edge(myOrigins.Find(aE)); + // aER.Orientation(TopAbs_FORWARD); - // build p-curve - if (bIsUPeriodic) { - GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax); + if (!BRep_Tool::Degenerated(aER)) {//modified by NIZNHY-PKV Thu Dec 30 11:31:37 2004 ft + // build p-curve + if (bIsUPeriodic) { + GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax); + } + BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aER, aFFWD); + + // orient image + bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext); + if (bIsToReverse) { + aER.Reverse(); + } } - BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aER, aFFWD); - - // orient image - bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext); - if (bIsToReverse) { - aER.Reverse(); + else { + aER.Orientation(aE.Orientation()); } // aBB.Add(newWire, aER); @@ -772,29 +806,34 @@ Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR, bRet=Standard_False; // aExp.Init(aF, TopAbs_EDGE); - if (!aExp.More()) { - return bRet; - } - const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current()); - const TopoDS_Edge& aER=TopoDS::Edge(myOrigins.Find(aE)); - // - aC3D=BRep_Tool::Curve(aE, aT1, aT2); - aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2); - aC3D->D0(aT, aP); - myContext.ProjectPointOnEdge(aP, aER, aTR); - // - BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF); - if (aF.Orientation()==TopAbs_REVERSED) { - aDNF.Reverse(); - } - // - BOPTools_Tools3D::GetNormalToFaceOnEdge (aER, aFR, aTR, aDNFR); - if (aFR.Orientation()==TopAbs_REVERSED) { - aDNFR.Reverse(); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current()); + //modified by NIZNHY-PKV Thu Dec 30 11:38:05 2004 f + if (BRep_Tool::Degenerated(aE)) { + continue; + } + //modified by NIZNHY-PKV Thu Dec 30 11:38:08 2004 t + const TopoDS_Edge& aER=TopoDS::Edge(myOrigins.Find(aE)); + // + aC3D=BRep_Tool::Curve(aE, aT1, aT2); + aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2); + aC3D->D0(aT, aP); + myContext.ProjectPointOnEdge(aP, aER, aTR); + // + BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF); + if (aF.Orientation()==TopAbs_REVERSED) { + aDNF.Reverse(); + } + // + BOPTools_Tools3D::GetNormalToFaceOnEdge (aER, aFR, aTR, aDNFR); + if (aFR.Orientation()==TopAbs_REVERSED) { + aDNFR.Reverse(); + } + // + aScPr=aDNF*aDNFR; + return (aScPr<0.); } - // - aScPr=aDNF*aDNFR; - return (aScPr<0.); + return bRet; } // diff --git a/src/GEOMAlgo/GEOMAlgo_Tools.cxx b/src/GEOMAlgo/GEOMAlgo_Tools.cxx index 1ba9203b8..97bdbb03e 100644 --- a/src/GEOMAlgo/GEOMAlgo_Tools.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Tools.cxx @@ -51,8 +51,8 @@ Standard_Integer GEOMAlgo_Tools::RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKey aNbE=aMPKLE.Extent(); for (i=1; i<=aNbE; ++i) { TopTools_ListOfShape& aLSDE=aMPKLE.ChangeFromIndex(i); - aMEE.Clear(); // + aMEE.Clear(); iErr=GEOMAlgo_Tools::FindSDShapes(aLSDE, aTol, aMEE, aCtx); if (iErr) { return iErr; @@ -107,11 +107,17 @@ Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopTools_ListOfShape& aLE, TopTools_ListOfShape aLESD; TopTools_ListIteratorOfListOfShape aIt, aIt1; TopTools_IndexedMapOfShape aMProcessed; + TopAbs_ShapeEnum aType; // aNbE=aLE.Extent(); if (!aNbE) { return 3; // Err - } + } + //modified by NIZNHY-PKV Thu Dec 30 10:56:52 2004 f + if (aNbE==1) { + return 0; // Nothing to do + } + //modified by NIZNHY-PKV Thu Dec 30 10:56:56 2004 t // while(1) { aNbEProcessed=aMProcessed.Extent(); @@ -122,10 +128,22 @@ Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopTools_ListOfShape& aLE, aIt.Initialize(aLE); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aS=aIt.Value(); + // if (aMProcessed.Contains(aS)) { continue; } // + //modified by NIZNHY-PKV Thu Dec 30 10:57:01 2004 f + aType=aS.ShapeType(); + if (aType==TopAbs_EDGE) { + const TopoDS_Edge& aE=TopoDS::Edge(aS); + if (BRep_Tool::Degenerated(aE)) { + aMProcessed.Add(aE); + continue; + } + } + //modified by NIZNHY-PKV Thu Dec 30 10:57:03 2004 t + // aLESD.Clear(); iErr=GEOMAlgo_Tools::FindSDShapes(aS, aLE, aTol, aLESD, aCtx); if (iErr) {