Rotating a circle drawn using rectangle()

2 ビュー (過去 30 日間)
sumana
sumana 2016 年 5 月 7 日
コメント済み: Image Analyst 2016 年 5 月 8 日
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 Center および File ExchangeAnimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by