How do I rotate a rectangle around its bottom left corner by some angle 'theta_end'?
Show older comments
Command to create rectangle:
rectangle('Position',[xPos,yPos,W,H]);
xPos and yPos are the x and y positions of the bottom left corner of the rectangle in a 2-D Cartesian system.
I want to rotate the entire rectangle around its bottom left corner by some angle 'theta_end'. The bottom side of the rectangle should form the angle 'theta_end' with the x-axis.
r = rectangle('Position',[x_IN_end,y_IN_end,W1,l_F1]);
rRot = rotate(r,theta_end,[0,0,1]);
...but it came back with this message:
Error using rotate
Too many output arguments.
Accepted Answer
More Answers (1)
Hang Yu
on 28 Jun 2018
Hi Harry,
Firstly, the rotate function does not return any output, therefore you see the error message "Too many output arguments" when you are expecting the result to be stored in rRot.
Secondly, the rectangle object cannot rotate since there's no property of this object to capture the rotation.
>> doc rectangle
To achieve your goal, please refer to this answer and treat the corners of the rectangle as a set of points.
2 Comments
Harry Sood
on 28 Jun 2018
Jason Chen
on 19 Oct 2018
rotate() command works for line object but NOT rectangle object. Why it that?
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!