comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: Rotten behavior with rot command

Re: Rotten behavior with rot command
type: item
description: In article <HJXm5.519$Df2.85677@news.shore.net>, "Michael Baca" <mbaca@bos.fti-net.com> wrote: > 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. First, as a side note, what IDL version/platform are you using? On sunos unix 5.3 I get a nicer answer for this particular case: print,rot(a,180,/interp) 8.00000 7.00000 6.00000 5.00000 4.00000 3.00000 2.00000 1.00000 1.90719e-07 The better answer is that during a rotation, the corner pixels become "missing data", i.e. except when the rotation is exactly a mulitple of 90 degrees, there are pixels in the output array for which there are no corresponding values to interpolate in the input array. One way to see which pixel values you should trust is to use the MISSING keyword, i.e. print,rot(a,180.0,missing = !VALUES.F_NAN) which, for the particular roundoff error on my machine gives 7.00000 6.00000 NaN 5.00000 4.00000 3.00000 2.00000 1.00000 0.00000 My quick testing seems to show that whenver I get "nonsense" output values, they are flagged as missing data when I supply the MISSING keyword. > 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. I believe that if you flag the missing data, then the above method will work. Use ROTATE when you know you are rotating exactly a multip…
creator: landsman
date: 2000-08-17T07:00:00-00:00

Re: Rotten behavior with rot command
type: item
description: I did not find anything wierd when I tried it: IDL> print, findgen(3,3) 0.00000 1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000 8.00000 IDL> print, rot(findgen(3,3), 180, /interp) 8.00000 7.00000 6.00000 5.00000 4.00000 3.00000 2.00000 1.00000 1.90719e-07 IDL> print, rot(findgen(3,3), 90, /interp) 2.00000 5.00000 8.00000 1.00000 4.00000 7.00000 0.00000 3.00000 6.00000 I couldn't quite understand how ROT works with other settings but these two appeared reasonable. I'd check if there is some rounding happening somewhere in your code. Cheers, Pavel
creator: promashkin
date: 2000-08-17T07:00:00-00:00