/usr/share/octave/packages/nurbs-1.3.13/nrbpermute.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 tvol = nrbpermute (vol, ord)
%
% NRBPERMUTE: Rearrange the directions of a NURBS volume or surface.
%
% Calling Sequence:
%
% tvol = nrbpermute(vol,order)
%
% INPUT:
%
% vol : NURBS volume or surface, see nrbmak.
% order : the order to rearrange the directions of the NURBS entity.
%
% OUTPUT:
%
% tvol : NURBS volume or surface with rearranged directions.
%
% Description:
%
% Utility function that rearranges the directions of a NURBS volume or
% surface. For surfaces, nrbpermute(srf,[2 1]) is the same as
% nrbtransp(srf). NURBS curves cannot be rearranged.
%
% Example:
%
% nrbpermute (vol, [1 3 2])
%
% Copyright (C) 2013 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 (~iscell(vol.knots))
error('A NURBS curve cannot be rearranged.');
end
tvol = nrbmak (permute (vol.coefs, [1, ord+1]), {vol.knots{ord}});
%!demo
%! vol = nrbrevolve (nrb4surf ([1 0], [2 0], [1 1], [2 1]), [0 0 0], [0 1 0], pi/8);
%! nrbplot(vol,[5 10 20]);
%! title('NURBS volume and the same after reordering the directions')
%! hold on
%! vol.coefs(1,:,:) = vol.coefs(1,:,:) + 2;
%! vol = nrbpermute(vol,[2 3 1]);
%! nrbplot(vol,[5 10 20]);
%! hold off
%!test
%! vol = nrbrevolve (nrb4surf ([1 0], [2 0], [1 1], [2 1]), [0 0 0], [0 1 0], pi/8);
%! perm1 = [1 3 2];
%! perm2 = [2 1 3];
%! vol2 = nrbpermute (vol, perm1);
%! vol3 = nrbpermute (vol, perm2);
%! assert (vol.number(perm1), vol2.number)
%! assert (vol.order(perm1), vol2.order)
%! assert ({vol.knots{perm1}}, vol2.knots)
%! assert (permute(vol.coefs, [1, perm1+1]), vol2.coefs)
%! assert (vol.number(perm2), vol3.number)
%! assert (vol.order(perm2), vol3.order)
%! assert ({vol.knots{perm2}}, vol3.knots)
%! assert (permute(vol.coefs, [1, perm2+1]), vol3.coefs)
|