Tilting is defined as a rotation about the xaxis followed by rotation about the
ID: 3910991 • Letter: T
Question
Tilting is defined as a rotation about the xaxis followed by rotation about the y-axis. A pentagon is subjected to a tilt of 30o about the x-axis and 20o about the y-axis. The 3-D pentagon has 10 vertices in (x, y, z): A(8,0,2), B(2,0,2), C(-1,5,2), D(3,9,2), E(8,6,2), F(8,0,-3), G(2,0,-3), H(-1,5,-3), I(3,9,-3), J(8,6,-3). Determine the final transformed coordinates of the pyramid after tilting: A’, B’, C’, etc. Also, determine the total transformation matrix [TT] which transforms the original vertices directly to the final verticesit is a single matrix. Caution: use radians if you use “sin” or “cos” commands in MATLAB or you can use “sind” or “cosd” for arguments in degrees.
Explanation / Answer
Find the required MATLAB code as the following:
%================================================
clear all;
clc;
alpha=20;
beta=30;
A=[8,0,2];
B=[2,0,2];
C=[-1,5,2];
D=[3,9,2];
E=[8,6,2];
F=[8,0,-3];
G=[2,0,-3];
H=[-1,5,-3];
I=[3,9,-3];
J=[8,6,-3];
cord = [A;B;C;D;E;F;G;H;I;J]';
% Rotation about X axis
rx = [1 0 0;0 cosd(alpha) -sind(alpha);0 sind(alpha) cosd(alpha)];
% Rotation about Y axis
ry = [cosd(beta) 0 sind(beta);0 1 0;-sind(beta) 10 cosd(beta)];
% Calculating titled coordinates
cord_tilt=ry*(rx*cord);
cord_tilt=cord_tilt';
display('The titled coordiantes are:');
display(cord_tilt);
% Calculating total transformation matrix
TT=(ry*rx);
display('The total transformation matrix is:');
display(TT);
%================================================
Sample output:
The titled coordiantes are:
cord_tilt =
7.8679 -0.6840 -9.2128
2.6717 -0.6840 -6.2128
0.9287 4.0144 43.7528
5.0769 7.7732 80.5253
8.8940 4.9541 48.9459
5.5187 1.0261 3.8192
0.3225 1.0261 6.8192
-1.4205 5.7245 56.7848
2.7276 9.4833 93.5573
6.5447 6.6642 61.9780
The total transformation matrix is:
TT =
0.8660 0.1710 0.4698
0 0.9397 -0.3420
-0.5000 9.6931 -2.6064