1 function srf = nrb4surf(p11,p12,p21,p22)
3 % NRB4SURF: Constructs a NURBS bilinear surface.
7 % srf = nrb4surf(p11,p12,p21,p22)
11 % p11 : Cartesian coordinate of the lhs bottom corner point.
13 % p12 : Cartesian coordinate of the rhs bottom corner point.
15 % p21 : Cartesian coordinate of the lhs top corner point.
17 % p22 : Cartesian coordinate of the rhs top corner point.
21 % srf : NURBS bilinear surface, see nrbmak.
25 % Constructs a bilinear surface defined by four coordinates.
27 % The position of the corner points
37 % -------------------> U direction
40 % Copyright (C) 2000 Mark Spink
42 % This program is free software: you can redistribute it and/or modify
43 % it under the terms of the GNU General Public License as published by
44 % the Free Software Foundation, either version 2 of the License, or
45 % (at your option) any later version.
47 % This program is distributed in the hope that it will be useful,
48 % but WITHOUT ANY WARRANTY; without even the implied warranty of
49 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50 % GNU General Public License for more details.
52 % You should have received a copy of the GNU General Public License
53 % along with this program. If not, see <http://www.gnu.org/licenses/>.
56 error('Four corner points must be defined');
59 coefs = cat (1, zeros (3,2,2), ones (1,2,2));
60 coefs(1:length(p11),1,1) = p11(:);
61 coefs(1:length(p12),2,1) = p12(:);
62 coefs(1:length(p21),1,2) = p21(:);
63 coefs(1:length(p22),2,2) = p22(:);
65 knots = {[0 0 1 1] [0 0 1 1]};
66 srf = nrbmak(coefs, knots);
71 %! srf = nrb4surf([0.0 0.0 0.5],[1.0 0.0 -0.5],[0.0 1.0 -0.5],[1.0 1.0 0.5]);
72 %! nrbplot(srf,[10,10]);
73 %! title('Construction of a bilinear surface.');