1 function B = numbasisfun (iv, uv, p, U)
3 % NUMBASISFUN: List non-zero Basis functions for B-Spline in a given knot-span
7 % N = numbasisfun(i,u,p,U)
11 % i - knot span ( from FindSpan() )
12 % u - parametric point
18 % N - Basis functions (numel(u)x(p+1))
20 % Copyright (C) 2009 Carlo de Falco
22 % This program is free software: you can redistribute it and/or modify
23 % it under the terms of the GNU General Public License as published by
24 % the Free Software Foundation, either version 2 of the License, or
25 % (at your option) any later version.
27 % This program is distributed in the hope that it will be useful,
28 % but WITHOUT ANY WARRANTY; without even the implied warranty of
29 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 % GNU General Public License for more details.
32 % You should have received a copy of the GNU General Public License
33 % along with this program. If not, see <http://www.gnu.org/licenses/>.
35 B = bsxfun (@(a, b) a+b,iv-p, (0:p).').';
41 %! U = [0 0 0 1/2 1 1 1];
43 %! u = linspace (0, 1, 10);
44 %! s = findspan (n, p, u, U);
45 %! Bref = [0 0 0 0 0 1 1 1 1 1; ...
46 %! 1 1 1 1 1 2 2 2 2 2; ...
47 %! 2 2 2 2 2 3 3 3 3 3].';
48 %! B = numbasisfun (s, u, p, U);