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

3 views (last 30 days)
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.

Answers (2)

William Rose
William Rose on 12 Nov 2022
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
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)

Sign in to comment.

William Rose
William Rose on 11 Nov 2022
Edited: William Rose on 11 Nov 2022
You can define a nx2 array of points on the sofa
And plot it
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.
t=angle to rotate by in radians
S1=S*R; %rotated array of points
Plot S1 like S but with a new color.




Community Treasure Hunt

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

Start Hunting!