B-Spline only uniform for positive-only or negative-only knots?

According to the documentation, a B-spline with equidistant knot values is 'uniform' if all its multiplicities are 1 (see documentation). However, I only get this behavior when the knots are either non-positive or non-negative (i.e., the knot values never cross 0). Is this intended behavior?

I am using pyocct, thus I cannot provide an immediate example but an analysis of the C++ code shows that the culprit seems to be in the function BSplCLib::KnotForm in the file src/BSplCLib/BSplCLib.cxx. There, the difference between each consecutive pair of knot values kts[i] and kts[i+1] is checked. If two consecutive differences differ by more than some epsilon value, the spline is declared 'non-uniform'.

However, the absolute value is taken for each knot value and the differences, which has the following consequence for knot values [-2.3, -1.3, -0.3, 0.7, 1.7]:
While the difference between each pair of knot values is 1., the code in lines 609-621 computes the difference of their absolute values, which yields differences with absolute values of [1., 1., 0.4, 1.]. Thus, the spline is deemed 'non-uniform'. I would argue that it should be 'uniform' since the knots are equidistant.

I am hesitant to file a bug report given that this file is already decades old and I want to inquire here if this is intended behavior.

Kirill Gavrilov's picture

The fact that the file is decades old doesn't mean it cannot contain bugs and mistakes.

Filing a bug on Bugtracker (ideally with a patch) might be more productive than looking for a feedback on a forum - so fill free reporting an issue with necessary samples. It would be also good to know how it actually affects your logic (e.g. which issues causes misclassification of B-Spline as non-uniform?).