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 | |
---|
9 | function norm_plane=rotate(PlaneAngle) |
---|
10 | |
---|
11 | om=norm(PlaneAngle);%norm of rotation angle in degrees |
---|
12 | OmAxis=PlaneAngle/om; %unit vector marking the rotation axis |
---|
13 | cos_om=cos(pi*om/180); |
---|
14 | sin_om=sin(pi*om/180); |
---|
15 | coeff=OmAxis(3)*(1-cos_om); |
---|
16 | norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om; |
---|
17 | norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om; |
---|
18 | norm_plane(3)=OmAxis(3)*coeff+cos_om; |
---|
Note: See
TracBrowser
for help on using the repository browser.