1 function pk = curvederivcpts (n, p, U, P, d, r1, r2)
2 % Compute control points of n-th derivatives of a B-spline curve.
4 % usage: pk = curvederivcpts (n, p, U, P, d)
5 % pk = curvederivcpts (n, p, U, P, d, r1, r2)
7 % If r1, r2 are not given, all the control points are computed.
10 % n+1 = number of control points
11 % p = degree of the spline
12 % d = maximum derivative order (d<=p)
15 % r1 = first control point to compute
16 % r2 = auxiliary index for the last control point to compute
18 % pk(k,i) = i-th control point of (k-1)-th derivative, r1 <= i <= r2-k
20 % Adaptation of algorithm A3.3 from the NURBS book, pg98.
22 % Copyright (C) 2009 Carlo de Falco
24 % This program is free software: you can redistribute it and/or modify
25 % it under the terms of the GNU General Public License as published by
26 % the Free Software Foundation, either version 2 of the License, or
27 % (at your option) any later version.
29 % This program is distributed in the hope that it will be useful,
30 % but WITHOUT ANY WARRANTY; without even the implied warranty of
31 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 % GNU General Public License for more details.
34 % You should have received a copy of the GNU General Public License
35 % along with this program. If not, see <http://www.gnu.org/licenses/>.
44 pk(1, i+1) = P(r1+i+1);
50 pk (k+1, i+1) = tmp * (pk(k,i+2)-pk(k,i+1)) / ...
51 (U(r1+i+p+2)-U(r1+i+k+1));
57 %! line = nrbmak([0.0 1.5; 0.0 3.0],[0.0 0.0 1.0 1.0]);
58 %! pk = curvederivcpts (line.number-1, line.order-1, line.knots,...
59 %! line.coefs(1,:), 2);
60 %! assert (pk, [0 3/2; 3/2 0], 100*eps);