Wed, 01/17/2024 - 13:42
I'm reading OCCT source code, and meet problem.
I've read "The NURBS Book 2nd edition". In that book, the knots is stored in sequence format. In OCCT, knots is stored in 2 sequences: knots and mults.
In that book, the algorithm to calculate N_i_p is based on expanded sequence of knots. In OCCT, in src/BSplClib/BSplClib.cxx in function "BSplCLib::Eval" seems like equation 2.5 in the book, but some different.
in the book
N_i_p_u=(U-knots[i])/(knots[i+p]-knots[i])*N_i_(p-1)_u+(knots[i+p+1]-U)/(knots[i+p+1]-knots[i+1])*N_(i+1)_(p-1)_u
the coefficient of first item at right side seems like X in "BSplCLib::Eval", and coefficient of the second item at right side seems like Y. Look at the equation, the 2 coefficients summary is not 1
also the denominator of the 2 coefficient could be 0. In OCCT, knots stores in 2 sequences: knots and mults, but in the book the knots are expanded into 1 sequence. So if "BSplCLib::Eval" is based on that equation, the knots should be in 1 sequence, if the mults is bigger than 1, (knots[Dpi] - knots[Sti]) is possible to be 0. I tried, if the mults is bigger than 1 at begin or end, it's ok, if the mults is bigger than 1 at internal position, divide 0 error would happen.
in the code there is no comment or detailed description of the input parameter of "BSplCLib::Eval", so I'm not sure the input format, whatever mults is not input parameter of "BSplCLib::Eval", so I guess the input knots is expanded sequence.
also, there are some other differences between the book and the source code. In the book, periodic B-spline is not introduced, but in the source code, there is periodic B-spline.
is there any reference documentation of the NURBS algorithm in OCCT? I want to read and understand OCCT better.