IDL User's Library routine ROT [message #430] |
Wed, 12 August 1992 15:25 |
fireman
Messages: 49 Registered: August 1991
|
Member |
|
|
Hello, IDL users -
I've been trying to figure out the IDL User's Library routine ROT, and
am now pretty confused. It seems to me that a 90-degree rotation should have
the same result for both ROT and the built-in function ROTATE, at least for
square matrices, and that interpolation shuld have no effect. This is not the
case. Even or odd array sizes make no difference. Am I missing something
obvious? Is there a better routine for doing array rotations in non-multiples
of 90 degrees?
a=indgen(4,4)
print,a
; 0 1 2 3
; 4 5 6 7
; 8 9 10 11
; 12 13 14 15
print,rotate(a,1)
; 12 8 4 0
; 13 9 5 1
; 14 10 6 2 <-- so far, so good...
; 15 11 7 3
print,rot(a,90,missing=-1)
; -1 3 7 11
; -1 2 6 10
; 1 5 9 13 <-- yuckadoo!
; 0 4 8 12
b=indgen(5,5)
print,b
; 0 1 2 3 4
; 5 6 7 8 9
; 10 11 12 13 14
; 15 16 17 18 19
; 20 21 22 23 24
print,rotate(b,1)
; 20 15 10 5 0
; 21 16 11 6 1
; 22 17 12 7 2
; 23 18 13 8 3
; 24 19 14 9 4
print,rot(b,90,missing=-1)
; -1 3 8 13 18
; -1 2 7 12 17
; -1 1 6 12 17
; 0 5 10 15 21
; -1 -1 -1 -1 20
Gwyn Fireman phone: (301) 794-1560
Computer Sciences Corporation span: IUEGTC::FIREMAN
IUE Observatory internet: fireman@iuegtc.span.nasa.gov
|
|
|