Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p1=[0;0];
- p2=[0.5;2];
- p3=[0;1];
- plotx=[p1(1) p2(1) p3(1) p1(1)];
- ploty=[p1(2) p2(2) p3(2) p1(2)];
- deg=input('Geef een rotatiehoek in: ');
- rad=deg*(pi/180);
- rotate=[cos(rad) -sin(rad); sin(rad) cos(rad)];
- tp1=rotate*p1;
- tp2=rotate*p2;
- tp3=rotate*p3;
- plottx=[tp1(1) tp2(1) tp3(1) tp1(1)];
- plotty=[tp1(2) tp2(2) tp3(2) tp1(2)];
- figure(1);
- plot(plotx, ploty,'-');
- hold;
- plot(plottx, plotty, '-.');
- legend('origineel',strcat(mat2str(deg), ' graden geroteerd'));
- axis equal;
- axis([-2.5 2.5 -2.5 2.5]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement