On 04/28/2015 02:37 PM, diliup gabadamudalige wrote:
I thank all those who responded to my question

Here is the code that I had written.

When updating is applied to a surface object the rotation works but when it
is applied through a class to an object it goes wrong in about 3 rotations.
As far as I can see the code is the same. What is wrong? If you can correct
some code and show me would help.


By top-posting, you're messing up the readability of your response. And by trying to use an attachment, you're messing up a large portion of the people reading this thread.

Post a simplified example, inline in your message, and *following* any quote you're using.

If your symptom is that the data diverges eventually from the intended trajectory, the problem is that you're accumulating errors. Each point you do you're rounding the calculation by storing it in finite precision. After enough roundoffs, the error becomes visible.

If you need to reliably move an object in a circle, you'll want to store the location in angular terms, center, radius, and angle.

Then each time around the loop, increment the angle by a non-rounded amount, and recalculate the x/y coordinates.


--
DaveA
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to