Advertisement
Guest User

Rotation around line

a guest
Jul 26th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scilab 0.58 KB | None | 0 0
  1. format('v',15)
  2.  
  3. //rotation axis
  4. u = [rand(), rand(), rand()];
  5. u = u./ sqrt(u*u')
  6.  
  7. //angle
  8. t = 2*%pi*rand();
  9.  
  10. c = cos(t);
  11. s = sin(t);
  12.  
  13. T= [rand(); rand(); rand()]
  14.  
  15. R = [c+u(1)*u(1)*(1-c), u(1)*u(2)*(1-c)-u(3)*s, u(1)*u(3)*(1-c)+u(2)*s;
  16.  u(1)*u(2)*(1-c)+u(3)*s, c+u(2)*u(2)*(1-c), u(2)*u(3)*(1-c)-u(1)*s;
  17.  u(1)*u(3)*(1-c)-u(2)*s, u(2)*u(3)*(1-c)+u(1)*s, c+u(3)*u(3)*(1-c)]
  18.  
  19. M = [eye(3,3),T;0,0,0,1]*[R,[0;0;0];0,0,0,1]*[eye(3,3),-T;0,0,0,1]
  20. //M = [eye(3,3),T;0,0,0,1]*[R,[0;0;0];0,0,0,1]
  21.  
  22. //identity
  23. I = eye(4,4);
  24.  
  25. //system
  26. A = I-M
  27.  
  28. //row reduction
  29. S = rref(A)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement