]> Creatis software - CreaPhase.git/blob - octave_packages/nurbs-1.3.6/nrbcylind.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / nurbs-1.3.6 / nrbcylind.m
1 function surf = nrbcylind(height,radius,center,sang,eang)
2
3 % NRBCYLIND: Construct a cylinder or cylindrical patch.
4
5 % Calling Sequence:
6
7 %   srf = nrbcylind()
8 %   srf = nrbcylind(height)
9 %   srf = nrbcylind(height,radius)
10 %   srf = nrbcylind(height,radius,center)
11 %   srf = nrbcylind(height,radius,center,sang,eang)
12
13 % INPUT:
14
15 %   height      : Height of the cylinder along the axis, default 1.0
16
17 %   radius      : Radius of the cylinder, default 1.0
18
19 %   center      : Center of the cylinder, default (0,0,0)
20
21 %   sang        : Start angle relative to the origin, default 0.
22
23 %   eang        : End angle relative to the origin, default 2*pi.
24 %
25 % OUTPUT: 
26 %
27 %   srf     : cylindrical surface patch 
28
29 % Description:
30
31 %   Construct a cylinder or cylindrical patch by extruding a circular arc.
32 %
33 %    Copyright (C) 2000 Mark Spink
34 %
35 %    This program is free software: you can redistribute it and/or modify
36 %    it under the terms of the GNU General Public License as published by
37 %    the Free Software Foundation, either version 2 of the License, or
38 %    (at your option) any later version.
39
40 %    This program is distributed in the hope that it will be useful,
41 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
42 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
43 %    GNU General Public License for more details.
44 %
45 %    You should have received a copy of the GNU General Public License
46 %    along with this program.  If not, see <http://www.gnu.org/licenses/>.
47
48 if nargin < 1
49   height = 1;
50 end
51
52 if nargin < 2
53   radius = 1;
54 end
55
56 if nargin < 3
57   center = [];
58 end
59    
60 if nargin < 5
61   sang = 0;
62   eang = 2*pi;
63 end
64
65 surf = nrbextrude(nrbcirc(radius,center,sang,eang),[0.0 0.0 height]);
66
67 end
68
69 %!demo
70 %! srf = nrbcylind(3,1,[],deg2rad(270),deg2rad(180));
71 %! nrbplot(srf,[20,20]);
72 %! axis equal;
73 %! title('Cylinderical section by extrusion of a circular arc.');
74 %! hold off