This file is indexed.

/usr/share/octave/packages/nurbs-1.3.13/nrbsquare.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
73
74
75
76
77
78
79
function srf = nrbsquare (corner, lengthx, lengthy, varargin)
%
% NRBSQUARE: create the NURBS surface for a square.
%
% Calling Sequence:
% 
% srf = nrbsquare (corner, lengthx, lengthy);
% srf = nrbsquare (corner, lengthx, lengthy, degree);
% srf = nrbsquare (corner, lengthx, lengthy, degree, nsub);
%
% INPUT:
%   corner  : the coordinates of the bottom left corner of the square. 
%   lenghtx : the length along the x direction.
%   lenghty : the length along the y direction.
%   degree  : the degree of the NURBS surface, in each direction.
%   nsub    : the number of subdivision of the NURBS surface, in each direction.
%
% OUTPUT:
%   srf     : the NURBS surface.
%
%    Copyright (C) 2016 Jacopo Corno, Rafael Vazquez
%
%    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/>.

if (isempty (corner))
  corner = [0 0];
end

nsub = [1 1];
degree = [1 1];

if (numel (varargin) >= 1)
  if (numel (varargin{1}) == 1)
    degree = [varargin{1} varargin{1}];
  elseif (numel (varargin{1}) == 2)
    degree = varargin{1};
  else
    error ('The degree vector should provide the degree in each direction (two values).');
  end

  if (numel (varargin) == 2)
    if (numel (varargin{2}) == 1)
      nsub = [varargin{2} varargin{2}];
    elseif (numel (varargin{2}) == 2)
      nsub = varargin{2};
    else
      error ('The nsub vector should provide the number of intervals in each direction (two values).');
    end
  end
end

srf = nrb4surf (corner, corner+[lengthx 0], corner+[0 lengthy], corner+[lengthx lengthy]);
srf = nrbdegelev (srf, degree-[1 1]);
[~,~,new_knots] = kntrefine (srf.knots, nsub-1, degree, degree-[1 1]);
srf = nrbkntins (srf, new_knots);

end

%!test
%! srf = nrbsquare ([], 1, 2, 2, 4);
%! assert (srf.order, [3 3]);
%! knt = [0 0 0 1/4 1/2 3/4 1 1 1];
%! assert (srf.knots, {knt knt})
%! x = linspace (0, 1, 100);
%! [X,Y] = ndgrid (x, x);
%! vals = nrbeval (srf, {x x});
%! assert (squeeze(vals(1,:,:)), X, 1e-15);
%! assert (squeeze(vals(2,:,:)), 2*Y, 1e-15);