Advertisement
billybaloop

zxz rotation

Oct 7th, 2011
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.54 KB | None | 0 0
  1. %% zxz rotation from yxz rotation
  2. t1 = pi/4 ; % 45 deg
  3. t2 = pi/6 ; % 30 deg
  4. t3 = pi/3 ; % 60 deg
  5.  
  6. c1 = cos(t1);
  7. c2 = cos(t2);
  8. c3 = cos(t3);
  9. s1 = sin(t1);
  10. s2 = sin(t2);
  11. s3 = sin(t3);
  12.  
  13. %yaw
  14. y = [
  15.   c1, 0, s1;
  16.    0, 1,  0;
  17.  -s1, 0, c1
  18. ];
  19.  
  20. %pitch
  21. x = [
  22.   1,  0,   0;
  23.   0, c2, -s2;
  24.   0, s2,  c2
  25. ] ;
  26.  
  27. %roll
  28. z = [
  29.   c3, -s3, 0;
  30.   s3,  c3, 0;
  31.    0,   0, 1
  32. ];
  33.  
  34. zxz = [
  35.   c1*c3 - c2*s1*s3, -c1*s3 - c3*c2*s1,  s2*s1;
  36.   c2*c1*s3 + c3*s1,  c1*c2*c3 - s1*s3, -c1*s2;
  37.              s3*s2,             c3*s2,     c2
  38. ]
  39.  
  40.  
  41. yxz = y*x*z
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement