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

Re: [pygame] Rotate image around another point?



But that is not what I'm trying to do.I want to rotate the actual
imagedata (like rotating an image using PohotSshop or GIMP). Not just
the location where the image is drawn. 

The pygame.transform.rotate(...) function does that but always rotates
the imagedata about it's center.

/John

tor 2007-04-19 klockan 11:02 +0200 skrev Ulf EkstrÃm:
> 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