]> Creatis software - CreaPhase.git/blob - octave_packages/nurbs-1.3.6/vecroty.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / nurbs-1.3.6 / vecroty.m
1 function ry = vecroty(angle)
2
3 % VECROTY: Transformation matrix for a rotation around the y axis. 
4
5 % Calling Sequence:
6
7 %   ry = vecroty(angle);
8
9 % INPUT:
10
11 %   angle               : rotation angle defined in radians
12
13 % OUTPUT:
14 %
15 %   ry          : (4x4) Transformation matrix.
16
17
18 % Description:
19
20 %   Return the (4x4) Transformation matrix for a rotation about the y axis
21 %   by the defined angle.
22
23 %   The matrix is:
24
25 %         [  cos(angle)       0        sin(angle)       0]
26 %         [      0            1            0            0]
27 %         [ -sin(angle)       0        cos(angle)       0]
28 %         [      0            0            0            1]
29
30 % Examples:
31
32 %    Rotate the NURBS line (0.0 0.0 0.0) - (3.0 3.0 3.0) by 45 degrees
33 %    around the y-axis
34
35 %    line = nrbline([0.0 0.0 0.0],[3.0 3.0 3.0]);
36 %    trans = vecroty(%pi/4);
37 %    rline = nrbtform(line, trans);
38
39 % See also:
40
41 %    nrbtform
42 %
43 %    Copyright (C) 2000 Mark Spink
44 %
45 %    This program is free software: you can redistribute it and/or modify
46 %    it under the terms of the GNU General Public License as published by
47 %    the Free Software Foundation, either version 2 of the License, or
48 %    (at your option) any later version.
49
50 %    This program is distributed in the hope that it will be useful,
51 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
52 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
53 %    GNU General Public License for more details.
54 %
55 %    You should have received a copy of the GNU General Public License
56 %    along with this program.  If not, see <http://www.gnu.org/licenses/>.
57
58 sn = sin(angle);
59 cn = cos(angle);
60 ry = [cn 0 sn 0; 0 1 0 0; -sn 0 cn 0; 0 0 0 1];
61
62 end