two questions

Nathan Hurst njh at
Thu Jan 28 20:02:47 PST 1999

On Wed, 27 Jan 1999, Paul Lowe wrote:

> Anyone here know the fundamentals to sprite rotation. I don't have the
> math skills, but don't know where to start. I am currently in Algebra 2.

Do a web search on this!  It is well documented.  But basically, you use
the fact that sin(x+y) = sin(x)cos(y) + cos(x)sin(y) (and similarly for
cos) to form a rotation matrix:

 cos(a) sin(a)
-sin(a) cos(a)

which you then use to step through the source image while outputing the
pixels rasterscan fashion to the dest.  As the matrix takes the same time
no matter what its form, you can scale, shear, rotate, reflect the image.
Going from here it is only a small thought step to full blown n-d
texturemapping on an m-surface :-)


More information about the SDL mailing list