/usr/share/octave/packages/nurbs-1.3.13/bspeval.m is in octave-nurbs 1.3.13-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | function p = bspeval(d,c,k,u)
% BSPEVAL: Evaluate B-Spline at parametric points.
%
% Calling Sequence:
%
% p = bspeval(d,c,k,u)
%
% INPUT:
%
% d - Degree of the B-Spline.
% c - Control Points, matrix of size (dim,nc).
% k - Knot sequence, row vector of size nk.
% u - Parametric evaluation points, row vector of size nu.
%
% OUTPUT:
%
% p - Evaluated points, matrix of size (dim,nu)
%
% Copyright (C) 2000 Mark Spink, 2007 Daniel Claxton, 2010 C. de Falco
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
nu = numel(u);
[mc,nc] = size(c);
% int bspeval(int d, double *c, int mc, int nc, double *k, int nk, double *u,int nu, double *p){
% int ierr = 0;
% int i, s, tmp1, row, col;
% double tmp2;
%
% // Construct the control points
% double **ctrl = vec2mat(c,mc,nc);
%
% // Contruct the evaluated points
% double **pnt = vec2mat(p,mc,nu);
%
% // space for the basis functions
%N = zeros(d+1,1); % double *N = (double*) mxMalloc((d+1)*sizeof(double));
%
% // for each parametric point i
%for col=1:nu % for (col = 0; col < nu; col++) {
% // find the span of u[col]
s = findspan(nc-1, d, u(:), k); % s = findspan(nc-1, d, u[col], k);
N = basisfun(s,u(:),d,k); % basisfun(s, u[col], d, k, N);
%
tmp1 = s - d + 1; % tmp1 = s - d;
%for row=1:mc % for (row = 0; row < mc; row++) {
p = zeros (mc, nu); % tmp2 = 0.0;
for i=0:d % for (i = 0; i <= d; i++)
p = p + repmat (N(:,i+1)', mc, 1).*c(:,tmp1+i); % tmp2 += N[i] * ctrl[tmp1+i][row];
end %
%p(row,:) = tmp2; % pnt[col][row] = tmp2;
%end % }
%end % }
%
% mxFree(N);
% freevec2mat(pnt);
% freevec2mat(ctrl);
%
% return ierr;
end % }
|