(a)
N2 = (N/2) + 1 			center point of a map edge
NN = 0.5 - N2  			adjust to center of a given pixel
FOR I = 1 TO N
    t = I + NN     		center-point pixel coordinate
    CC[I] = t * C 		precompute Cosine table
    SS[I] = t * S			precompute Sine table

(b)
Xrot = CC[X] + SS[Y]
Yrot = CC[Y] - SS[X]

Figure 3: (a) Precomputation code; (b) rotation equations.

Back to Article
Copyright © 1999, Dr. Dobb's Journal