Beginner. 2d rotation gives unexpected results.

Nobody nobody at
Tue Jul 23 17:20:35 CEST 2013

On Tue, 23 Jul 2013 15:11:43 +0200, Peter Otten wrote:

> The conversion to int introduces a rounding error that accumulates over 
> time.

Most floating point calculations introduce a rounding error. If the
calculations are iterated, the error will accumulate.

In general, you want to avoid accumulating entire transformations. E.g. if
you want a spinning object, maintain the cumulative rotation angle and
rotate the original points each frame.

If you must accumulate transformations, you need to actively work to
maintain any desired invariants. E.g. if a transformation is supposed to
be orthonormal (all axes perpendicular and of unit length), you should
renormalise it periodically, otherwise the lengths and angles will change
over time.

More information about the Python-list mailing list