How to Plot the Trajectory of points on a bendRightAngle when Rotated 90 degrees

조회 수: 5 (최근 30일)
I am working on the moving sofa problem in mathematics and am trying to plot the trajectory of several points on an L shape when rotated 90 degrees. I have made a right angle L of unit width (see code below). What I would like to do is define sseveral reference points along the inside of my L. I would like to draw a trajectory of these points as the L is rotated 90 degrees. I would also like the coordinates of the trajectory of the reference points along the rotation. I am not sure if this is asking too much.
RightAngle = bendRightAngle(Name='RightAngle',ReferencePoint=[0,0],Length=[3,3],Width=[1,1])
I greatly appreciate any help.
Steven

답변 (2개)

William Rose
William Rose 2022년 11월 12일
Matlab can define a polygon. It could be convenient for your work. The only possible disadvantage is that a polyshape includes the corners only. A polyshape does not include additional points along a straight edge. If you want to track those with polyshape(), you might have to define sub-polygons.
Let's try Matlab's polygon functions:
sofa=polyshape([0,3,3,2,2,0],[0,0,2,2,1,1]); %vertices of sofa
plot(sofa);
Now rotate the sofa with Matlab's rotate function.
theta=[15,30,45,60,75]; %rotation angles
refpoint=[0.5,0.5]; %point to rotate about
hold on; axis equal %hold the current plot
for i=1:length(theta)
plot(rotate(sofa,theta(i),refpoint));
end
  댓글 수: 3

댓글을 달려면 로그인하십시오.


William Rose
William Rose 2022년 11월 11일
편집: William Rose 2022년 11월 11일
You can define a nx2 array of points on the sofa
S=[0,0;1,0;2,0;3,0;3,2;2,2;2,1;1,1;0,1;0,0];
And plot it
plot(S(:,1),S(:,2),’-b.’);
Then multiply S by 2x2 rotation matrix R to get a new array with the rotated points. You can also combine with translation of the array of points.
Sorry can’t format this correctly, answering on phone.
R=[cos(t),sin(t);-sin(t),cos(t)];
t=angle to rotate by in radians
S1=S*R; %rotated array of points
Plot S1 like S but with a new color.
  댓글 수: 1
William Rose
William Rose 2022년 11월 11일
Oh by that was formatted even worse than I expected. All my carriage returns disappeared!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Acoustics, Noise and Vibration에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by