gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Background Rotation

#5960 - sgeos - Tue May 13, 2003 11:40 pm

As I've been doing trig posts recently, I decided I'd try to tackle background rotation. For the most part, it seems pretty straight forward, but what I worked out for magnification differs from Martin Korth's gbatek.
Code:
  :\
  :A\         
d :  \i      h _,-':
  :_  \/\R _,-'   _: c
  :R| B\,-'A     |R:
  ^^^^^^^^^^^^^^^^^^
    b          a

If I understand correctly, a, b, c, and d should correspond to PA, PB, PC, and PD when the BG is rotated A degrees. If we want h to have certain length, we solve for a like so:

cos A = a / h
h * cos A = a

If h is just as long as it was before rotation, then there is not any magnification. Should not setting the length of h specify the magnification? With minor modifications to avoid confusion with the above diagram, in the gbatek this is listed as:

PA = cos (A) / xMag

I really must have missed something. Why does dividing cos(A) by the magnification work?

-Brendan