source: trunk/src/angle2normal.m @ 1179

Last change on this file since 1179 was 1179, checked in by sommeria, 4 weeks ago

a few bug repairs and cleaning

File size: 690 bytes
Line 
1%angle2normal: calculate the components of the unit vector defined by a rotation vector
2% this gives the equation of the plane as norm_plane(1)x + norm_plane(2)y +norm_plane(3)z = cte
3
4% OUTPUT:
5%norm_plane: three components of the normal unit vector
6% INPUT:
7%PlaneAngle: rotation vector, with three components in degree)
8
9function norm_plane=rotate(PlaneAngle)
10
11om=norm(PlaneAngle);%norm of rotation angle in degrees
12OmAxis=PlaneAngle/om; %unit vector marking the rotation axis
13cos_om=cos(pi*om/180);
14sin_om=sin(pi*om/180);
15coeff=OmAxis(3)*(1-cos_om);
16norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om;
17norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om;
18norm_plane(3)=OmAxis(3)*coeff+cos_om;
Note: See TracBrowser for help on using the repository browser.