From c1c03615f606465893a832f4748a636c66607dfd Mon Sep 17 00:00:00 2001 From: khlebnikov Date: Thu, 25 Sep 2014 12:47:03 +0400 Subject: [PATCH] 0025024: BSplCLib::PrepareInsertKnots reports incorrect number of poles Added test bugs fclasses bug25024 --- src/BSplCLib/BSplCLib.cxx | 16 +++++++++++++--- tests/bugs/fclasses/bug25024 | 11 +++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 tests/bugs/fclasses/bug25024 diff --git a/src/BSplCLib/BSplCLib.cxx b/src/BSplCLib/BSplCLib.cxx index 345e3c6c1b..f41a893726 100644 --- a/src/BSplCLib/BSplCLib.cxx +++ b/src/BSplCLib/BSplCLib.cxx @@ -1702,6 +1702,7 @@ Standard_Boolean BSplCLib::PrepareInsertKnots ak++; } + Standard_Integer aLastKnotMult = Mults (Knots.Upper()); Standard_Real au,oldau = AddKnots(ak),Eps; while (ak <= AddKnots.Upper()) { @@ -1741,7 +1742,15 @@ Standard_Boolean BSplCLib::PrepareInsertKnots } else if (amult > mult) { if (amult > Degree) amult = Degree; - sigma += amult - mult; + if (k == Knots.Upper () && Periodic) + { + aLastKnotMult = Max (amult, mult); + sigma += 2 * (aLastKnotMult - mult); + } + else + { + sigma += amult - mult; + } } /* // on periodic curves if this is the last knot @@ -1779,7 +1788,7 @@ Standard_Boolean BSplCLib::PrepareInsertKnots //instance); //respectively AddMults() must meet this requirement if AddKnots() contains //knot(s) coincident with first or last - NbPoles = sigma - Mults(Knots.Upper()); + NbPoles = sigma - aLastKnotMult; } else { NbPoles = sigma - Degree - 1; @@ -1968,7 +1977,8 @@ void BSplCLib::InsertKnots if (Periodic) { // on periodic curve the first and last knot are delayed to the end if (curk == Knots.Lower() || (curk == Knots.Upper())) { - firstmult += depth; + if (firstmult == 0) // do that only once + firstmult += depth; depth = 0; } } diff --git a/tests/bugs/fclasses/bug25024 b/tests/bugs/fclasses/bug25024 new file mode 100644 index 0000000000..2c639554de --- /dev/null +++ b/tests/bugs/fclasses/bug25024 @@ -0,0 +1,11 @@ +puts "============" +puts "OCC25024" +puts "============" +puts "" +####################################################################### +# BSplCLib::PrepareInsertKnots reports incorrect number of poles +####################################################################### + +restore [locate_data_file bug25024_wires.brep] w +explode w +thrusections r 0 0 w_1 w_2