1 function srf = nrbtestsrf
2 % NRBTESTSRF: Constructs a simple test surface.
4 % Copyright (C) 2000 Mark Spink
6 % This program is free software: you can redistribute it and/or modify
7 % it under the terms of the GNU General Public License as published by
8 % the Free Software Foundation, either version 2 of the License, or
9 % (at your option) any later version.
11 % This program is distributed in the hope that it will be useful,
12 % but WITHOUT ANY WARRANTY; without even the implied warranty of
13 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 % GNU General Public License for more details.
16 % You should have received a copy of the GNU General Public License
17 % along with this program. If not, see <http://www.gnu.org/licenses/>.
19 % allocate multi-dimensional array of control points
22 % define a grid of control points
23 % in this case a regular grid of u,v points
27 pnts(:,:,1) = [ 0.0 3.0 5.0 8.0 10.0; % w*x
28 0.0 0.0 0.0 0.0 0.0; % w*y
29 2.0 2.0 7.0 7.0 8.0]; % w*z
31 pnts(:,:,2) = [ 0.0 3.0 5.0 8.0 10.0;
35 pnts(:,:,3) = [ 0.0 3.0 5.0 8.0 10.0;
39 pnts(:,:,4) = [ 0.0 3.0 5.0 8.0 10.0;
41 5.0 5.0 8.0 8.0 10.0];
43 pnts(:,:,5) = [ 0.0 3.0 5.0 8.0 10.0;
44 10.0 10.0 10.0 10.0 10.0;
45 5.0 5.0 8.0 8.0 10.0];
48 knots{1} = [0 0 0 1/3 2/3 1 1 1]; % knots along u
49 knots{2} = [0 0 0 1/3 2/3 1 1 1]; % knots along v
51 % make and draw nurbs surface
52 srf = nrbmak(pnts,knots);
58 %! nrbplot(srf,[20 30])
59 %! title('Test surface')