Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Po = [1 2 2 1;1 1 2 2;1 1 1 1];
- hold on;
- %plot(Po(1,1), Po(2,1));
- %plot(Po(1,2), Po(2,2));
- %plot(Po(1,3), Po(2,3));
- %plot(Po(1,4), Po(2,4));
- line([Po(1,1), Po(2,1)],[Po(1,2), Po(2,2)]);
- line([Po(1,2), Po(2,2)],[Po(1,3), Po(2,3)]);
- line([Po(1,3), Po(2,3)],[Po(1,4), Po(2,4)]);
- line([Po(1,4), Po(2,4)],[Po(1,1), Po(2,1)]);
- Xcentro = (max(Po(1,:)) + min(Po(1,:)))/2;
- Ycentro = (max(Po(2,:)) + min(Po(2,:)))/2;
- ang = 5;
- T1 = [1 0 -Xcentro;0 1 -Ycentro;0 0 1];
- T2 = [cos(ang) -sin(ang) 0;sin(ang) cos(ang) 0;0 0 1];
- T3 = [1 0 Xcentro;0 1 Ycentro;0 0 1];
- Pt = (T3 * T2 * T1) * Po;
- figure;
- line([Pt(1,1), Pt(2,1)],[Pt(1,2), Pt(2,2)]);
- line([Pt(1,2), Pt(2,2)],[Pt(1,3), Pt(2,3)]);
- line([Pt(1,3), Pt(2,3)],[Pt(1,4), Pt(2,4)]);
- line([Pt(1,4), Pt(2,4)],[Pt(1,1), Pt(2,1)]);
- while (ang<2000)
- ang = ang + 5;
- endwhile
- hold off;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement