[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Rotten behavior with rot command



I have been experiencing a problem using the rot command. After reading
through some code to find an error with a rotated array, I checked the data
created by the rot command. If I create a simple array, and then rotate it,
this is what I find:

a=findgen(3,3)
print, a
0.000000      1.00000      2.00000
3.00000      4.00000      5.00000
6.00000      7.00000      8.00000

print, rot(a,180,/interp)
8.00000      7.00000      6.00000
5.00000      4.00000      3.00000
1.00000     0.000000     0.000000

This is obviously not the answer I wanted, let alone the correct answer.
In all cases, the arrays I am rotating are odd-by-odd squares, so at 180
degrees, I should see an array that has been flipped horizontally and
vertically. Defining the point of rotation does not appear to help. I have
tried the above example on multiple arrays with different sizes and always
see this occur.

Has anyone else experienced this problem and had any success working around
it? Right now, the only way I can work around this problem is to find when a
rotation is done in a 90 degree interval and then use the rotate command
instead. But, this will not help when I need to rotate something, say, 170
degrees. Then the same error than causes the problem at 180 degrees still
lingers. This problem also appears at other 90 degree intervals:

print, rot(a, 90, /interp)
1.00000      5.00000      8.00000
0.000000      4.00000      7.00000
0.000000      3.00000      6.00000

Thanks for any thoughts.

Mike Baca

Michael Baca
Frontier Technology, Inc.
mbaca@bos.fti-net.com