Rotating a circle drawn using rectangle()

3 views (last 30 days)
Hi, I am drawing circles using rectangle() in a simulation for bouncing balls which has x,y and theta position attributes. I know how to change the position for every time step, how do I change the rotation of the ball? I have seen this link (<http://www.mathworks.com/matlabcentral/newsreader/view_thread/71705)>, but this does not help me, how do I add the rotation inside rectangle() ? Thank you for the help !

Accepted Answer

Image Analyst
Image Analyst on 7 May 2016
You cannot rotate the circles drawn by rectangle(). Even if you could, you would not notice any difference since they're circles.
You said you know how to change the position so if you were not rotating them about their centers, but about some other location, then you know how to do that - you said so. You just calculate the new upper left coordinate and call rectangle with an updated 'Position' vector. So it's not the location of the circle you're asking about, it's the rotation at a given location, and like I said, you can't do that, nor would you notice any difference even if you could.
  2 Comments
sumana
sumana on 8 May 2016
Edited: sumana on 8 May 2016
Hi, thank you for your response. How do you simulate a rolling ball (or even rolling dice) then, it has translational and rotational velocity components right? Even if I can't see I can feel that it is rolling right ? So you are saying that using rectangle() I cannot do that, may be I will have to go for plot(). Wouldn't it be amazing if they add the property 'rotation' to rectangle() ?
Image Analyst
Image Analyst on 8 May 2016
To see a circle or disc "rolling" you'd have to have a pattern on the circle so that you can see it move. To do that you'd have to paste images, not just put up a circle perimeter with a function like plot() or rectangle().

Sign in to comment.

More Answers (0)

Categories

Find more on Animation 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!