[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Rotate image around another point?



On 4/19/07, John Eriksson <john@xxxxxxxxxxxx> wrote:
Well, no.

I'm looking for a way to rotate the imagedata (like
pygame.transform.rotate(...)) but your example rotates the image
location. Right?

It is actually the same thing. Rotation around some arbitrary point can be decomposed into a rotation around some other point followed by a translation. Suppose you have a function R which rotates things around the origin. To write a function Rp which rotates around the point p (p and q are vectors), you do

Rp(q) = R(q-p)+p

Since R is a linear function you can do

Rp(q) = R(q) + p - R(p)

So rotating around p is the same as rotating around the origin and
then translating by p - R(p).

Ulf