Last change
on this file since 8862 was 731, checked in by tbretz, 24 years ago |
*** empty log message ***
|
-
Property svn:executable
set to
*
|
File size:
1003 bytes
|
Line | |
---|
1 | #include "slalib.h"
|
---|
2 | #include "slamac.h"
|
---|
3 | void slaDcc2s ( double v[3], double *a, double *b )
|
---|
4 | /*
|
---|
5 | ** - - - - - - - - -
|
---|
6 | ** s l a D c c 2 s
|
---|
7 | ** - - - - - - - - -
|
---|
8 | **
|
---|
9 | ** Direction cosines to spherical coordinates.
|
---|
10 | **
|
---|
11 | ** (double precision)
|
---|
12 | **
|
---|
13 | ** Given:
|
---|
14 | ** v double[3] x,y,z vector
|
---|
15 | **
|
---|
16 | ** Returned:
|
---|
17 | ** *a,*b double spherical coordinates in radians
|
---|
18 | **
|
---|
19 | ** The spherical coordinates are longitude (+ve anticlockwise
|
---|
20 | ** looking from the +ve latitude pole) and latitude. The
|
---|
21 | ** Cartesian coordinates are right handed, with the x axis
|
---|
22 | ** at zero longitude and latitude, and the z axis at the
|
---|
23 | ** +ve latitude pole.
|
---|
24 | **
|
---|
25 | ** If v is null, zero a and b are returned.
|
---|
26 | ** At either pole, zero a is returned.
|
---|
27 | **
|
---|
28 | ** Last revision: 31 October 1993
|
---|
29 | **
|
---|
30 | ** Copyright P.T.Wallace. All rights reserved.
|
---|
31 | */
|
---|
32 | {
|
---|
33 | double x, y, z, r;
|
---|
34 |
|
---|
35 | x = v[0];
|
---|
36 | y = v[1];
|
---|
37 | z = v[2];
|
---|
38 | r = sqrt ( x * x + y * y );
|
---|
39 |
|
---|
40 | *a = ( r != 0.0 ) ? atan2 ( y, x ) : 0.0;
|
---|
41 | *b = ( z != 0.0 ) ? atan2 ( z, r ) : 0.0;
|
---|
42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.