View Full Version : Trouble with NURBS (implementation)...

04 April 2005, 02:51 PM

I might sound stupid here, but could someone please explain evaluation of a b-spline for me? First off, when doing interpolation through corner points you have to duplicate 'k' of the first and final knot vector elements (k being the degree + 1). If we now evaluate using the vector elements as duplicates we get a division by zero, which is clearly not mathematically correct...

The division comes from this:

vec = { 0, 0, 1, 2, 3, 3 };
B1(u) = ( (u - vec[0])/(vec[i+1] - vec[i]) );

...because vec[i+1] and vec[i] are equal when i == 0.

This example is only for linear b-splines (but the same applies for any degree).

Is there something I'm doing wrong? Please explain to me the whole process of evaluation... How to avoid the situation where there would be a division by zero?

Timo Heubach

04 April 2005, 05:22 PM
It's been a very long time since I looked at this but I believe when evaluating B-splines you define 0/0 == 0. So you just have to check for the divide by zero and set the result to 0.

04 April 2005, 12:31 PM
I guess you mean the Mansfield-de Boor-Cox formula for b-spline. In definiton we have: if k is a degree then if vec[i]=...=vec[i+k] or vec[i+1]=...=vec[i+k+1] then accordingly B_i^{k-1}(u)=0 or B_{i+1}^{k-1}(u)=0.


CGTalk Moderation
04 April 2005, 12:31 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.