~ubuntu-branches/ubuntu/precise/octave-nurbs/precise

« back to all changes in this revision

Viewing changes to inst/bspdegelev.m

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Weber
  • Date: 2011-04-20 21:53:46 UTC
  • mfrom: (3.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110420215346-mtrs63hlmsh5yuaz
Tags: 1.3.3-1
* New upstream release
* Bump standards version to 3.9.1, no changes needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%% Copyright (C) 2003 Mark Spink, 2007 Daniel Claxton
2
 
%% 
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.
7
 
%% 
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.
12
 
%% 
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/>.
15
 
 
16
1
function [ic,ik] = bspdegelev(d,c,k,t)
17
2
 
18
3
% BSPDEGELEV:  Degree elevate a univariate B-Spline. 
21
6
22
7
%   [ic,ik] = bspdegelev(d,c,k,t)
23
8
24
 
% Parameters:
 
9
%   INPUT:
25
10
26
11
%   d - Degree of the B-Spline.
27
12
%   c - Control points, matrix of size (dim,nc).
28
13
%   k - Knot sequence, row vector of size nk.
29
14
%   t - Raise the B-Spline degree t times.
30
15
 
16
%   OUTPUT:
 
17
%
31
18
%   ic - Control points of the new B-Spline. 
32
19
%   ik - Knot vector of the new B-Spline.
33
20
 
21
%    Copyright (C) 2000 Mark Spink, 2007 Daniel Claxton
 
22
%
 
23
%    This program is free software: you can redistribute it and/or modify
 
24
%    it under the terms of the GNU General Public License as published by
 
25
%    the Free Software Foundation, either version 2 of the License, or
 
26
%    (at your option) any later version.
 
27
 
 
28
%    This program is distributed in the hope that it will be useful,
 
29
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
30
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
31
%    GNU General Public License for more details.
 
32
%
 
33
%    You should have received a copy of the GNU General Public License
 
34
%    along with this program.  If not, see <http://www.gnu.org/licenses/>.
34
35
 
35
36
[mc,nc] = size(c);
36
37
                                                          %
269
270
                                                          %   mxFree(alfs);
270
271
                                                          %
271
272
                                                          %   return(ierr);
272
 
                                                          % }
 
273
end                                                       % }
273
274
 
274
275
                                                          
275
276
function b = bincoeff(n,k)
286
287
                                                          % double bincoeff(int n, int k)
287
288
                                                          % {
288
289
b = floor(0.5+exp(factln(n)-factln(k)-factln(n-k)));      %   return floor(0.5+exp(factln(n)-factln(k)-factln(n-k)));
289
 
                                                          % }
 
290
end                                                       % }
290
291
 
291
292
function f = factln(n)
292
293
% computes ln(n!)
293
294
if n <= 1, f = 0; return, end
294
 
f = gammaln(n+1); %log(factorial(n));
 
 
b'\\ No newline at end of file'
 
295
f = gammaln(n+1); %log(factorial(n));
 
296
end
 
 
b'\\ No newline at end of file'