Rotating a circle drawn using rectangle()

2 Ansichten (letzte 30 Tage)
sumana
sumana am 7 Mai 2016
Kommentiert: Image Analyst am 8 Mai 2016
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 !

Akzeptierte Antwort

Image Analyst
Image Analyst am 7 Mai 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 Kommentare
sumana
sumana am 8 Mai 2016
Bearbeitet: sumana am 8 Mai 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 am 8 Mai 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().

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Animation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by