Possible Duplicate:
Rotate Image .pbm Haskell
i need help about a rotation matrix in haskell
i have 2 data type:
data RGBdata= RGB Int Int Int
data PBMfile= PBM Int Int [[RGBdata]]
and my function receive:
spin :: PBMfile -> PBMfile
spin (PBM x y l) = (PBM x y ((transpose . reverse) l))
where 'x' and 'y' is the number of colums and rows respectively (maybe can help to do the function).
for example:
(PBM 2 2 [[(RGB 0 255 255),(RGB 255 0 0)],[(RGB 255 255 255),(RGB 255 0 0)]])
I try rotate 90° to the left using combinations with reverse and transpose, but the image result is wrong.
i try
spin :: PBMfile -> PBMfile
spin (PBM x y l) = (PBM x y ((reverse . transpose) l))
and
spin :: PBMfile -> PBMfile
spin (PBM x y l) = (PBM x y ((transpose . reverse) l))
and
spin :: PBMfile -> PBMfile
spin (PBM x y l) = (PBM x y (((map reverse) . transpose) l))
to rotate the matrix but does not work.
the result is something like