source: trunk/src/angle2normal.m @ 1078

Last change on this file since 1078 was 1078, checked in by sommeria, 4 years ago

various updates

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