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

Home » Public Forums » archive » Re: ROT is ROTTEN (a solution)
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: ROT is ROTTEN (a solution) [message #28163 is a reply to message #28075] Wed, 21 November 2001 10:41 Go to previous messageGo to previous message
Wayne Landsman is currently offline  Wayne Landsman
Messages: 117
Registered: January 1997
Senior Member
Martin Downing wrote:

> line 128 of rot.pro:
>
> from:
>
> theta = -angle/!radeg ;angle in degrees CLOCKWISE.
>
> to:
>
> theta = (-angle MOD 360) *acos(0.0d)/90 ;angle in degrees CLOCKWISE. (mod
> MRD 21/11/2001 to correct for precision error)
>

That's neat how the double precision improves things. But I 'd still
emphasize that if you are rotating by a multiple of 90 degrees then you should
be using ROTATE() and not ROT() for two reasons:

(1) ROTATE() is much faster (almost a factor of 4 on my Solaris machine)
(2) Using ROTATE() will ensure that you have the exactly correct numbers in the
output array (since it simply moves elements within the array and performs no
arithmetic operations). The improved ROT() is much better but it is not
perfect. For example

{ sparc sunos unix 5.3 Nov 11 1999}
IDL>a = dist(2048)
IDL>print,total(a)
3.28828e+09
IDL>print,total(rot(a,90)) ;use improved ROT with double precision !RADEG
3.28830e+09
IDL>print,total(rotate(a,1))
3.28828e+09

So possibly one could add to the beginning of ROT() something like:

theta = angle mod 90
if theta EQ 0 then return, rotate(a, theta/90)

although one needs to also worry if the user has also set the magnification or
pivot keywords


--Wayne Landsman landsman@mpb.gsfc.nasa.gov
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Time on My Hands
Next Topic: Event Handling

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

Current Time: Wed Oct 08 11:00:12 PDT 2025

Total time taken to generate the page: 0.00254 seconds