B-spline curve function

282 Views Asked by At

It's well known fact that B-spline curve can be obtained using the equation $$C\left( \xi \right) = \sum\limits_{i = 1}^n {{N_{i,p}}\left( \xi \right)} {B_i}$$ However, I can't find an example of how to do that having basis functions and control points coordinates. Let's assume the knot vector $\mathcal{S} = \left\{ {0,0,0,0.3,0.5,0.5,0.6,1,1,1} \right\}$ with $m=10$ , so that $p=2$ order basis functions for this knot vector are $$ \begin{aligned} {N_{0,2}}\left( \xi \right) &= \begin{cases} {\left( {1 - \frac{{10}}{3}\xi } \right)^2},& 0 \leqslant \xi < 0.3 \end{cases} \\ {N_{1,2}}\left( \xi \right) &= \begin{cases} {\frac{{20}}{3}\left( {\xi - \frac{8}{3}{\xi ^2}} \right)},& 0 \leqslant \xi < 0.3\\ {2.5{\left( {1 - 2\xi } \right)^2}},& 0.3 \leqslant \xi < 0.5 \end{cases} \\ {N_{2,2}}\left( \xi \right) &= \begin{cases} {\frac{{20}}{3}{\xi ^2}},& 0 \leqslant \xi < 0.3\\ {- 3.75 + 25\xi - 35{\xi ^2}},& 0.3 \leqslant \xi < 0.5 \end{cases} \\ {N_{3,2}}\left( \xi \right) &= \begin{cases} {{\left( {5\xi - 1.5} \right)^2}},& 0.3 \leqslant \xi < 0.5\\ {{\left( {6 - 10\xi } \right)^2}},& 0.5 \leqslant \xi < 0.6 \end{cases} \\ {N_{4,2}}\left( \xi \right) &= \begin{cases} {- 40 + 140\xi - 120{\xi ^2}},& 0.5 \leqslant \xi < 0.6\\ {5{\left( {1 - \xi } \right)^2}},& 0.6 \leqslant \xi < 1 \end{cases} \\ {N_{5,2}}\left( \xi \right) &= \begin{cases} {20{\xi ^2} - 20\xi + 5},& 0.5 \leqslant \xi < 0.6\\ {- 11.25{\xi ^2} + 17.5u - 6.25},& 0.6 \leqslant \xi < 1 \end{cases} \\ {N_{6,2}}\left( \xi \right) &= \begin{cases} {6.25{\xi ^2} - 7.5\xi + 2.25},& 0.6 \leqslant \xi < 1 \end{cases} \end{aligned} $$ Let's assume $m-p-1=7$ control points with certain coordinates in physical space $\mathcal{B} = \left\{ {\left( {1,1} \right),\left( {2,2} \right),\left( {3,1} \right),\left( {4,2} \right),\left( {5,1} \right),\left( {6,2} \right),\left( {7,2} \right)} \right\}$.

Now I need to draw the B-spline curve with the given data in physical space. How should I do that? What is the general procedure?

1

There are 1 best solutions below

0
On BEST ANSWER

The general procedure for drawing a B-spline curve (or any curve) is to compute many points from 0.0 to 1.0 and ask your drawing function to draw a line in between each two consecutive points. Of course, if you did not use sufficient points, your curve will not look smooth enough.

Typically, the number of points used for drawing a curve will be decided by a tolerance, which is the maximum chord-height deviation between the polyline and the curve. This tolerance will then be somehow related to zoom factor. Namely, the closer you are to the curve, the smaller the tolerance would be. There is another issue of how should these points distribute on the curve as uniformly distribute these points between [0,1] range does not always produce a good result.