1 function curve = nrbline(p1,p2)
3 % NRBLINE: Construct a straight line.
12 % p1 : 2D or 3D cartesian coordinate of the start point.
14 % p2 : 2D or 3D cartesian coordinate of the end point.
18 % crv : NURBS curve for a straight line.
22 % Constructs NURBS data structure for a straight line. If no rhs
23 % coordinates are included the function returns a unit straight
24 % line along the x-axis.
26 % Copyright (C) 2000 Mark Spink
28 % This program is free software: you can redistribute it and/or modify
29 % it under the terms of the GNU General Public License as published by
30 % the Free Software Foundation, either version 2 of the License, or
31 % (at your option) any later version.
33 % This program is distributed in the hope that it will be useful,
34 % but WITHOUT ANY WARRANTY; without even the implied warranty of
35 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 % GNU General Public License for more details.
38 % You should have received a copy of the GNU General Public License
39 % along with this program. If not, see <http://www.gnu.org/licenses/>.
41 coefs = [zeros(3,2); ones(1,2)];
46 coefs(1:length(p1),1) = p1(:);
47 coefs(1:length(p2),2) = p2(:);
50 curve = nrbmak(coefs, [0 0 1 1]);
55 %! crv = nrbline([0.0 0.0 0.0]',[5.0 4.0 2.0]');
58 %! title('3D straight line.');