From da02839efe071cfb4fb59efa12475129aaeae305 Mon Sep 17 00:00:00 2001 From: akaftasev Date: Tue, 4 May 2021 13:28:25 +0300 Subject: [PATCH] 0029645: Hang on making pipe shell using BRepOffsetAPI_MakePipeShell Added new boolean parameter to GeomLib::FuseIntervals() to select method of defining an element with close values --- src/GeomFill/GeomFill_CorrectedFrenet.cxx | 4 ++-- src/GeomFill/GeomFill_Frenet.cxx | 4 ++-- src/GeomLib/GeomLib.cxx | 12 ++++++++++-- src/GeomLib/GeomLib.hxx | 14 +++++++++++++- tests/pipe/bugs/bug29645 | 15 +++++++++++++++ 5 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 tests/pipe/bugs/bug29645 diff --git a/src/GeomFill/GeomFill_CorrectedFrenet.cxx b/src/GeomFill/GeomFill_CorrectedFrenet.cxx index accb9fb5eb..b3dbcdb33a 100644 --- a/src/GeomFill/GeomFill_CorrectedFrenet.cxx +++ b/src/GeomFill/GeomFill_CorrectedFrenet.cxx @@ -882,7 +882,7 @@ Standard_Real GeomFill_CorrectedFrenet::GetAngleAT(const Standard_Real Param) co frenet->Intervals(FrenetInt, S); EvolAroundT->Intervals(LawInt, S); - GeomLib::FuseIntervals(FrenetInt, LawInt, Fusion); + GeomLib::FuseIntervals(FrenetInt, LawInt, Fusion, Precision::PConfusion(), Standard_True); return Fusion.Length()-1; } @@ -913,7 +913,7 @@ Standard_Real GeomFill_CorrectedFrenet::GetAngleAT(const Standard_Real Param) co frenet->Intervals(FrenetInt, S); EvolAroundT->Intervals(LawInt, S); - GeomLib::FuseIntervals(FrenetInt, LawInt, Fusion); + GeomLib::FuseIntervals(FrenetInt, LawInt, Fusion, Precision::PConfusion(), Standard_True); for(Standard_Integer i = 1; i <= Fusion.Length(); i++) T.ChangeValue(i) = Fusion.Value(i); diff --git a/src/GeomFill/GeomFill_Frenet.cxx b/src/GeomFill/GeomFill_Frenet.cxx index 04f82610e1..a541ddcf34 100644 --- a/src/GeomFill/GeomFill_Frenet.cxx +++ b/src/GeomFill/GeomFill_Frenet.cxx @@ -692,7 +692,7 @@ Standard_Boolean myCurve->Intervals(TrimInt, tmpS); TColStd_SequenceOfReal Fusion; - GeomLib::FuseIntervals(TrimInt, mySngl->Array1(), Fusion); + GeomLib::FuseIntervals(TrimInt, mySngl->Array1(), Fusion, Precision::PConfusion(), Standard_True); return Fusion.Length() - 1; } @@ -726,7 +726,7 @@ Standard_Boolean myCurve->Intervals(TrimInt, tmpS); TColStd_SequenceOfReal Fusion; - GeomLib::FuseIntervals(TrimInt, mySngl->Array1(), Fusion); + GeomLib::FuseIntervals(TrimInt, mySngl->Array1(), Fusion, Precision::PConfusion(), Standard_True); for (Standard_Integer i = 1; i <= Fusion.Length(); i++) T.ChangeValue(i) = Fusion.Value(i); diff --git a/src/GeomLib/GeomLib.cxx b/src/GeomLib/GeomLib.cxx index 7563ccaadf..e1646bc098 100644 --- a/src/GeomLib/GeomLib.cxx +++ b/src/GeomLib/GeomLib.cxx @@ -412,7 +412,8 @@ void GeomLib::DensifyArray1OfReal(const Standard_Integer MinNumPoints, void GeomLib::FuseIntervals(const TColStd_Array1OfReal& I1, const TColStd_Array1OfReal& I2, TColStd_SequenceOfReal& Seq, - const Standard_Real Epspar) + const Standard_Real Epspar, + const Standard_Boolean IsAdjustToFirstInterval) { Standard_Integer ind1=1, ind2=1; Standard_Real v1, v2; @@ -429,7 +430,14 @@ void GeomLib::FuseIntervals(const TColStd_Array1OfReal& I1, v2 = I2(ind2); if (Abs(v1-v2)<= Epspar) { // Ici les elements de I1 et I2 conviennent . - Seq.Append((v1+v2)/2); + if (IsAdjustToFirstInterval) + { + Seq.Append(v1); + } + else + { + Seq.Append((v1 + v2) / 2); + } ind1++; ind2++; } diff --git a/src/GeomLib/GeomLib.hxx b/src/GeomLib/GeomLib.hxx index 3ed9415b27..d83e4ef08a 100644 --- a/src/GeomLib/GeomLib.hxx +++ b/src/GeomLib/GeomLib.hxx @@ -164,7 +164,19 @@ public: //! non decreasing Standard_EXPORT static void DensifyArray1OfReal (const Standard_Integer MinNumPoints, const TColStd_Array1OfReal& InParameters, Handle(TColStd_HArray1OfReal)& OutParameters); - Standard_EXPORT static void FuseIntervals (const TColStd_Array1OfReal& Interval1, const TColStd_Array1OfReal& Interval2, TColStd_SequenceOfReal& Fusion, const Standard_Real Confusion = 1.0e-9); + //! This method fuse intervals Interval1 and Interval2 with specified Confusion + //! @param Interval1 [in] first interval to fuse + //! @param Interval2 [in] second interval to fuse + //! @param Confision [in] tolerance to compare intervals + //! @param IsAdjustToFirstInterval [in] flag to set method of fusion, if intervals are close + //! if false, intervals are fusing by half-division methdod + //! if true, intervals are fusing by selecting value from Interval1 + //! @param Fusion [out] output interval + Standard_EXPORT static void FuseIntervals (const TColStd_Array1OfReal& Interval1, + const TColStd_Array1OfReal& Interval2, + TColStd_SequenceOfReal& Fusion, + const Standard_Real Confusion = 1.0e-9, + const Standard_Boolean IsAdjustToFirstInterval = Standard_False); //! this will compute the maximum distance at the //! parameters given in the Parameters array by diff --git a/tests/pipe/bugs/bug29645 b/tests/pipe/bugs/bug29645 new file mode 100644 index 0000000000..9ec819f4f6 --- /dev/null +++ b/tests/pipe/bugs/bug29645 @@ -0,0 +1,15 @@ +puts "========" +puts "0029645: Hang on making pipe shell using BRepOffsetAPI_MakePipeShell" +puts "========" +puts "" + +restore [locate_data_file bug29645_spine.brep] spine +restore [locate_data_file bug29645_profile.brep] profile + +mksweep spine +addsweep profile +buildsweep result -S -C + +puts "TEST COMPLETED" + +