Last change
on this file since 114 was
114,
checked in by smasson, 18 years ago
|
new compilation options (compile_opt idl2, strictarrsubs) in each routine
|
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
871 bytes
|
Rev | Line | |
---|
[2] | 1 | ;+ |
---|
| 2 | ; NAME: |
---|
| 3 | ; |
---|
| 4 | ; ROTATION |
---|
| 5 | ; |
---|
| 6 | ; PURPOSE: |
---|
| 7 | ; |
---|
| 8 | ; Rotate two vectors by a specified amount. |
---|
| 9 | ; |
---|
| 10 | ; CALLING SEQUENCE: |
---|
| 11 | ; |
---|
| 12 | ; ROTATION,X,Y,DEG,NX,NY |
---|
| 13 | ; |
---|
| 14 | ; INPUTS: |
---|
| 15 | ; |
---|
| 16 | ; X,Y :orignal data point pairs |
---|
| 17 | ; |
---|
| 18 | ; DEG :degrees to rotate. |
---|
| 19 | ; |
---|
| 20 | ; OUTPUTS: |
---|
| 21 | ; |
---|
| 22 | ; Nx, Ny = rotated point pairs. |
---|
| 23 | ; |
---|
| 24 | ; MODIFICATION HISTORY: |
---|
| 25 | ; |
---|
| 26 | ; Jeff Bennett, U of Colorado |
---|
| 27 | ;- |
---|
| 28 | |
---|
| 29 | PRO ROTATION,X,Y,DEG,NX,NY |
---|
[114] | 30 | ; |
---|
| 31 | compile_opt idl2, strictarrsubs |
---|
| 32 | ; |
---|
[2] | 33 | ang=deg*!dtor |
---|
| 34 | |
---|
| 35 | ;convert to polar coordinates for rotation |
---|
| 36 | r = sqrt(x*x + y*y) |
---|
| 37 | theta = r*0. |
---|
| 38 | ;get angle in for loop so that zero radii will be left as zero angle |
---|
| 39 | for i = 0,n_elements(r)-1 do $ |
---|
[114] | 40 | if r[i] ne 0 then theta[i] = atan(y[i],x[i]) ;range from -pi to +pi |
---|
[2] | 41 | ; |
---|
| 42 | ;add rotation angle |
---|
| 43 | theta = theta + ang |
---|
| 44 | ; |
---|
| 45 | ;convert back to rectangular coordinates, now rotated |
---|
| 46 | nx = r * cos(theta) |
---|
| 47 | ny = r * sin(theta) |
---|
| 48 | ; |
---|
| 49 | return |
---|
| 50 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.