FOR I = 1 TO N       		loop through all the map rows
    Crow = N2 + CC[I] 		factor N2 to move the center point
    Srow = N2 - SS[I] 		note the minus sign
    FOR J = 1 TO N  		loop through all the map columns
        Xrot = Crow + SS[J]
        Yrot = Srow + CC[J]
        output_map[Xrot][Yrot] = input_map[I][J]

Figure 4: Pseudocode for the basic loop structure of the improved rotation algorithm.

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