Neha Patil (Editor)

De Boor's algorithm

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

In the mathematical subfield of numerical analysis de Boor's algorithm is a fast and numerically stable algorithm for evaluating spline curves in B-spline form. It is a generalization of de Casteljau's algorithm for Bézier curves. The algorithm was devised by Carl R. de Boor. Simplified, potentially faster variants of the de Boor algorithm have been created but they suffer from comparatively lower stability.

Contents

Introduction

The general setting is as follows. We would like to construct a curve whose shape is described by a sequence of p points d 0 , d 1 , , d p 1 , which plays the role of a control polygon. The curve can be described as a function s ( x ) of one parameter x. To pass through the sequence of points, the curve must satisfy s ( u 0 ) = d 0 , , s ( u p 1 ) = d p 1 . But this is not quite the case: in general we are satisfied that the curve "approximates" the control polygon. We assume that u0, ..., up-1 are given to us along with d 0 , d 1 , , d p 1 .

One approach to solve this problem is by splines. A spline is a curve that is a piecewise nth degree polynomial. This means that, on any interval [ui, ui+1), the curve must be equal to a polynomial of degree at most n. It may be equal to different polynomials on different intervals. The polynomials must be synchronized: when the polynomials from intervals [ui-1, ui) and [ui, ui+1) meet at the point ui, they must have the same value at this point and their derivatives must be equal (to ensure that the curve is smooth).

De Boor's algorithm is an algorithm which, given u0, ..., up-1 and d 0 , d 1 , , d p 1 , finds the value of spline curve s ( x ) at a point x. It uses O(n2) + O(n + p) operations where n is the degree and p the number of control points of s.

Outline of the algorithm

Suppose we want to evaluate the spline curve for a parameter value x [ u , u + 1 ] . We can express the curve as

s ( x ) = i = 0 p 1 d i N i n ( x ) ,

where

N i n ( x ) = x u i u i + n u i N i n 1 ( x ) + u i + n + 1 x u i + n + 1 u i + 1 N i + 1 n 1 ( x ) ,

and

N i 0 ( x ) = { 1 , if  x [ u i , u i + 1 ] 0 , otherwise 


Due to the spline locality property,

s ( x ) = i = n d i N i n ( x )

So the value s ( x ) is determined by the control points d n , d n + 1 , , d ; the other control points d i have no influence. De Boor's algorithm, described in the next section, is a procedure which efficiently calculates the expression for s ( x ) .

The algorithm

We can compute the above s ( x ) by defining some x [ u , u + 1 ) , setting d i [ 0 ] = d i for i = n , , , and with these, computing:

d i [ k ] = ( 1 α k , i ) d i 1 [ k 1 ] + α k , i d i [ k 1 ] ; k = 1 , , n ; i = n + k , ,

Where the ratio α is described by:

α k , i = x u i u i + n + 1 k u i

Doing so gives us s ( x ) = d [ n ]

Computer code

TinySpline: Open source C-library for splines which implements De Boor's algorithm

References

De Boor's algorithm Wikipedia