-// Copyright (C) 2019-2020 CEA/DEN, EDF R&D
+// Copyright (C) 2019-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
return newBSpline2d(thePoles, theWeights, theDegree, thePeriodic);
int anAuxPole = 0;
- if (thePeriodic && thePoles.front()->distance(thePoles.back()) < Precision::Confusion())
- anAuxPole = -1;
+ if (thePeriodic && thePoles.front()->distance(thePoles.back()) < Precision::Confusion()) {
+ // additionally check the number of poles is greater than needed for th periodic B-spline
+ int aNbPoles = 0;
+ std::list<int>::const_iterator it = theMults.begin();
+ for (++it; it != theMults.end(); ++it)
+ aNbPoles += *it;
+ if ((int)thePoles.size() > aNbPoles)
+ anAuxPole = -1;
+ }
// collect arrays of poles, weights, knots and multiplicities
TColgp_Array1OfPnt2d aPoles(1, (int)thePoles.size() + anAuxPole);