2
## Copyright (C) 2009 Carlo de Falco
4
## This program is free software; you can redistribute it and/or modify
5
## it under the terms of the GNU General Public License as published by
6
## the Free Software Foundation; either version 2 of the License, or
7
## (at your option) any later version.
9
## This program is distributed in the hope that it will be useful,
10
## but WITHOUT ANY WARRANTY; without even the implied warranty of
11
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
## GNU General Public License for more details.
14
## You should have received a copy of the GNU General Public License
15
## along with Octave; see the file COPYING. If not, see
16
## <http://www.gnu.org/licenses/>.
18
## Author: Carlo de Falco <cdf _AT_ users.sourceforge.net>
19
## Created: 2009-09-09
1
/* Copyright (C) 2009 Carlo de Falco
3
This program is free software: you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation, either version 2 of the License, or
6
(at your option) any later version.
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License
14
along with this program. If not, see <http://www.gnu.org/licenses/>.
22
17
#include <octave/oct.h>
26
21
DEFUN_DLD(curvederivcpts, args, nargout,"\
27
\nCURVEDERIVCPTS: Compute control points of n-th derivatives of a NURBS curve.\n \
22
\nCURVEDERIVCPTS: Compute control points of n-th derivatives of a B-spline curve.\n \
29
24
\n usage: pk = curvederivcpts (n, p, U, P, d) \
25
\n pk = curvederivcpts (n, p, U, P, d, r1 r2) \
27
\n If r1, r2 are not given, all the control points are computed. \
32
30
\n n+1 = number of control points \
34
32
\n d = maximum derivative order (d<=p) \
36
34
\n P = control points \
35
\n r1 = first control point to compute \
36
\n r2 = auxiliary index for the last control point to compute \
38
\n pk(k,i) = i-th control point (k-1)-th derivative \
39
\n pk(k,i) = i-th control point (k-1)-th derivative, r1 <= i <= r2-k \
40
41
\n Adaptation of algorithm A3.3 from the NURBS book\n")
49
50
NDArray P = args(3).array_value ();
50
51
octave_idx_type d = args(4).idx_type_value ();
52
octave_idx_type r1, r2;
53
if (args.length () <= 5)
55
else if (args.length () == 7)
53
octave_idx_type r1(0), r2(n);
54
if (args.length () == 7)
57
56
r1 = args (5).idx_type_value ();
58
57
r2 = args (6).idx_type_value ();
59
else if (args.length () > 5)