I need an algorithm for (clockwise) rotation of a matrix represented by a one-dimensional array.
So far, I've found the following links but couldn't figure out anything bringing me closer to the solution I need:
http://basgun.wordpress.com/2008/04/11/rotate-array/
http://www.rawkam.com/?p=1008
Any suggestions or clues will be greatly appreciated!
Hristo
Edit: Here is the example
(1 2 3 (one rotation cycle clockwise would make) (7 4 1
4 5 6 ---------> 8 5 2
7 8 9) 9 6 3)
(7 4 1 (anther rotation cycle clockwise would make) (9 8 7
8 5 2 ---------> 6 5 4
9 6 3) 3 2 1)