Hi there I have been given a problem:
"A triangle is defined by the points (1, 1), (2, 4) and (7, 2). Using the three constituent simple transformations, transform the triangle with a rotation about the point (1, 3) by 60◦ anti-clockwise".
If I am being honest I have no idea how to start this
Any help would be great
Daniel

2 件のコメント

madhan ravi
madhan ravi 2018 年 11 月 15 日
why do you close the question?
madhan ravi
madhan ravi 2018 年 11 月 15 日
If you keep closing the question , you wont get any further help hereafter

サインインしてコメントする。

 採用された回答

Jim Riggs
Jim Riggs 2018 年 11 月 15 日
編集済み: Jim Riggs 2018 年 11 月 15 日

1 投票

If you want the equations they are as follows;
X = [1 2 7 1];
Y = [1 4 2 1];
ang = -60 % degrees
Xc = 1; % X cener of rotation
Yc = 3; % Y center of rotation
% Shift X/Y to the rotation center
Xshift = X - Xc;
Yshift = Y - Yc;
% Rotate the coordinates
Xsrot = Xshift*cosd(ang) + Yshift*sind(ang);
Ysrot = -Xshift*sind(ang) + Yshift*cosd(ang);
% Shift the rotated coordinates back to the original reference center
Xrot = Xsrot + Xc;
Yrot = Ysrot + Yc;
Now X,Y is the original triangle and Xrot,Yrot is the rotated triangle
This can be shortened to:
X = [1 2 7 1];
Y = [1 4 2 1];
ang = -60; % degrees
Xc = 1;
Yc = 3;
Xrot = (X-Xc)*cosd(ang) + (Y-Yc)*sind(ang) + Xc;
Yrot = -(X-Xc)*sind(ang) + (Y-Yc)*cosd(ang) + Yc;

その他の回答 (1 件)

madhan ravi
madhan ravi 2018 年 11 月 15 日
編集済み: madhan ravi 2018 年 11 月 15 日

0 投票

x=[1 2 7 1];
y=[1 4 2 1];
fig=figure
h=plot(x,y)
center = [1 3];
rotate(h,center,-60)
title('ROTATED TRIANGLE @CENTER (1,3) anticlockwise')
print(fig,'Rotated_triangle','-dpng')
fig1=figure
plot(x,y)
title('ORIGINAL TRIANGLE')
print(fig1,'Orignal_triangle','-dpng')

4 件のコメント

Daniel Campbell
Daniel Campbell 2018 年 11 月 15 日
Hi there this is great but how do you print the rotated triangle as well?
madhan ravi
madhan ravi 2018 年 11 月 15 日
if my answer worked make sure to accept the answer
Daniel Campbell
Daniel Campbell 2018 年 11 月 15 日
I need to display the triangle and the rotated triangle.
madhan ravi
madhan ravi 2018 年 11 月 15 日
see edited answer

サインインしてコメントする。

カテゴリ

製品

リリース

R2018b

質問済み:

2018 年 11 月 15 日

編集済み:

2018 年 11 月 15 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by