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 CenterFile Exchange에서 Animation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by