Rev | Line | |
---|

[1086] | 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 | |
---|

| 5 | function [X,Y,Z]=rotate_vector(PlaneAngle,x,y,z) |
---|

| 6 | M=rodrigues(PlaneAngle); |
---|

| 7 | |
---|

| 8 | X=M(1,1)*x+M(1,2)*y+M(1,3)*z; |
---|

| 9 | Y=M(2,1)*x+M(2,2)*y+M(2,3)*z; |
---|

| 10 | Z=M(3,1)*x+M(3,2)*y+M(3,3)*z; |
---|

| 11 | |
---|

| 12 | |
---|

| 13 | % |
---|

| 14 | % om=norm(PlaneAngle);%norm of rotation angle in degrees |
---|

| 15 | % OmAxis=PlaneAngle/om; %unit vector marking the rotation axis |
---|

| 16 | % cos_om=cos(pi*om/180); |
---|

| 17 | % sin_om=sin(pi*om/180); |
---|

| 18 | % coeff=OmAxis(3)*(1-cos_om); |
---|

| 19 | % norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om; |
---|

| 20 | % norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om; |
---|

| 21 | % norm_plane(3)=OmAxis(3)*coeff+cos_om; |
---|

**Note:** See

TracBrowser
for help on using the repository browser.