Rotating a circle drawn using rectangle()

3 次查看(过去 30 天)
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 !

采纳的回答

Image Analyst
Image Analyst 2016-5-7
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 个评论
sumana
sumana 2016-5-8
编辑:sumana 2016-5-8
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 2016-5-8
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().

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Animation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by