Advertisement
Guest User

Untitled

a guest
Nov 9th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.84 KB | None | 0 0
  1. Po = [1 2 2 1;1 1 2 2;1 1 1 1];
  2. hold on;
  3.  
  4. %plot(Po(1,1), Po(2,1));
  5. %plot(Po(1,2), Po(2,2));
  6. %plot(Po(1,3), Po(2,3));
  7. %plot(Po(1,4), Po(2,4));
  8.  
  9. line([Po(1,1), Po(2,1)],[Po(1,2), Po(2,2)]);
  10. line([Po(1,2), Po(2,2)],[Po(1,3), Po(2,3)]);
  11. line([Po(1,3), Po(2,3)],[Po(1,4), Po(2,4)]);
  12. line([Po(1,4), Po(2,4)],[Po(1,1), Po(2,1)]);
  13.  
  14. Xcentro = (max(Po(1,:)) + min(Po(1,:)))/2;
  15. Ycentro = (max(Po(2,:)) + min(Po(2,:)))/2;
  16. ang = 5;
  17. T1 = [1 0 -Xcentro;0 1 -Ycentro;0 0 1];
  18. T2 = [cos(ang) -sin(ang) 0;sin(ang) cos(ang) 0;0 0 1];
  19. T3 = [1 0 Xcentro;0 1 Ycentro;0 0 1];
  20.  
  21. Pt = (T3 * T2 * T1) * Po;
  22. figure;
  23.  
  24. line([Pt(1,1), Pt(2,1)],[Pt(1,2), Pt(2,2)]);
  25. line([Pt(1,2), Pt(2,2)],[Pt(1,3), Pt(2,3)]);
  26. line([Pt(1,3), Pt(2,3)],[Pt(1,4), Pt(2,4)]);
  27. line([Pt(1,4), Pt(2,4)],[Pt(1,1), Pt(2,1)]);
  28.  
  29. while (ang<2000)
  30.   ang = ang + 5;
  31. endwhile
  32.  
  33.  
  34. hold off;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement