1 function tsrf = nrbtransp(srf)
3 % NRBTRANSP: Transpose a NURBS surface, by swapping U and V directions.
7 % tsrf = nrbtransp(srf)
11 % srf : NURBS surface, see nrbmak.
15 % tsrf : NURBS surface with U and V diretions transposed.
19 % Utility function that transposes a NURBS surface, by swapping U and
20 % V directions. NURBS curves cannot be transposed.
22 % Copyright (C) 2000 Mark Spink
24 % This program is free software: you can redistribute it and/or modify
25 % it under the terms of the GNU General Public License as published by
26 % the Free Software Foundation, either version 2 of the License, or
27 % (at your option) any later version.
29 % This program is distributed in the hope that it will be useful,
30 % but WITHOUT ANY WARRANTY; without even the implied warranty of
31 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 % GNU General Public License for more details.
34 % You should have received a copy of the GNU General Public License
35 % along with this program. If not, see <http://www.gnu.org/licenses/>.
38 error(' A NURBS curve cannot be transposed.');
39 elseif size(srf.knots,2) == 3
40 error('The transposition of NURBS volumes has not been implemented.');
43 tsrf = nrbmak(permute(srf.coefs,[1 3 2]), fliplr(srf.knots));
48 %! srf = nrb4surf([0 0 0], [1 0 1], [0 1 1], [1 1 2]);
49 %! nrbplot(srf,[20 5]);
50 %! title('Plane surface and its transposed (translated)')
52 %! srf.coefs(3,:,:) = srf.coefs(3,:,:) + 10;
53 %! srf = nrbtransp(srf);
54 %! nrbplot(srf,[20 5]);