The plane motion of rigid body is realized by matrix multiplication, and the graph before and after the rigid body motion is drawn.
A closed shape in a planar coordinate system is used to describe a rigid body, and a matrix X is used to describe it. A column of x represents the coordinates of a vertex of a rigid body. For the graph to close, the last column of x is the same as the first column;
To achieve the translation of a rigid body, add a row of element value 1 to the matrix X so that the shape of the matrix X is 3Xn
If there is a matrix:
It can be proved that the matrix Y1 is the result of the rigid body moving C1 in the positive direction of the x-axis and C2 in the positive direction of the y-axis; The matrix Y2 is the result of the rigid body x rotating the T-arc counterclockwise from the coordinate origin.
Example: Use the following data to represent capital A, the following plane motion for graph A, and draw before and after the movement of the graphic
X 0 4 6 10 8 5 3.5 6.1 6.5 3.2 2 0
Y 0 14 14 0 0 11 6 6 4.5 4.5 0 0
(1) Move up 15, move left 30
(2) Turn ∏/3 counterclockwise
(3) First turn the ∏3/4 counterclockwise, then move up 30, move to the right 20
Clear All
x = [0 4 6 10 8 5 3.5 6.1 6.5 3.2 2 0];
y = [0 14 14 0 0 11 6 6 4.5 4.5 0 0];
A = [X;y;ones (1,length (x))];
Axis equal% vertical and horizontal axes with equal length scale
Plot (x, y)
Hold on% Keep current graphics window
% Move Up 15
M = [1 0 0;0 1 15;0 0 1];% Row 3 column set to 0, two row 3 column set to 15
Y1 = M*a;
% then, move left 30
M = [1 0-30;0 1 0;0 0 1];
Y1 = m*y1;
Fill (Y1 (1,:), Y1 (2,:), ' Red ')
% counterclockwise Turn PI/3
M = [cos (PI/3)-sin (PI/3) 0;sin (pi/3) cos (PI/3) 0;0 0 1];
Y1 = M*a;
Fill (Y1 (1,:), Y1 (2,:), ' Blue ')
% turn PI*3/4 counterclockwise, then move up 30, move right 20
M = [cos (3*PI/4)-sin (3*PI/4) 0;sin (3*pi/4) cos (3*PI/4) 0;0 0 1];
Y1 = M*a;
M = [1 0 0;0 1 30;0 0 1];% Row 3 column set to 0, two row 3 column set to 30
Y1 = m*y1;
M = [1 0 20;0 1 0;0 0 1];
Y1 = m*y1;
Fill (Y1 (1,:), Y1 (2,:), ' green ')
Grid on% add grid lines
Hold off
Plane motion of a rigid body