/usr/share/octave/packages/nurbs-1.3.13/private/onebasisfun__.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 | function Nip = onebasisfun__ (u, p, U)
% __ONEBASISFUN__: Undocumented internal function
%
% Adapted from Algorithm A2.4 from 'The NURBS BOOK' pg74.
%
% Copyright (C) 2009 Carlo de Falco
% Copyright (C) 2012 Rafael Vazquez
% This software comes with ABSOLUTELY NO WARRANTY; see the file
% COPYING for details. This is free software, and you are welcome
% to distribute it under the conditions laid out in COPYING.
Nip = zeros (size (u));
N = zeros (p+1, 1);
for ii = 1:numel(u)
if ((u(ii) == U(1)) && (U(1) == U(end-1)) || ...
(u(ii) == U(end)) && (U(end) == U(2)))
Nip(ii) = 1;
continue
end
if (~ any (U <= u(ii))) || (~ any (U > u(ii)))
continue;
end
for jj = 1:p+1 % Initialize zero-th degree functions
if (u(ii) >= U(jj) && u(ii) < U(jj+1))
N(jj) = 1;
else
N(jj) = 0;
end
end
for k = 1:p
if (N(1) == 0)
saved = 0;
else
saved = (u(ii) - U(1))*N(1) / (U(k+1)-U(1));
end
for jj = 1:p-k+1
Uleft = U(1+jj);
Uright = U(1+jj+k);
if (N(jj+1) == 0)
N(jj) = saved;
saved = 0;
else
temp = N(jj+1)/(Uright-Uleft);
N(jj) = saved + (Uright - u(ii))*temp;
saved = (u(ii) - Uleft)*temp;
end
end
end
Nip(ii) = N(1);
end
end
|