comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Rotten behavior with rot command
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Rotten behavior with rot command [message #21187] Thu, 17 August 2000 00:00 Go to previous message
landsman is currently offline  landsman
Messages: 93
Registered: August 1991
Member
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 multiple of
90 degrees; otherwise use ROT and flag the missing data.

--Wayne Landsman landsman@mpb.gsfc.nasa.gov


Sent via Deja.com http://www.deja.com/
Before you buy.
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Scaling atoms & axes in object graphics
Next Topic: Rotten behavior with rot command

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 08:05:51 PDT 2025

Total time taken to generate the page: 1.35882 seconds