Last change
on this file since 4450 was 731, checked in by tbretz, 24 years ago |
*** empty log message ***
|
-
Property svn:executable
set to
*
|
File size:
1.0 KB
|
Line | |
---|
1 | #include "slalib.h"
|
---|
2 | #include "slamac.h"
|
---|
3 | void slaCc2s ( float v[3], float *a, float *b )
|
---|
4 | /*
|
---|
5 | ** - - - - - - - -
|
---|
6 | ** s l a C c 2 s
|
---|
7 | ** - - - - - - - -
|
---|
8 | **
|
---|
9 | ** Direction cosines to spherical coordinates.
|
---|
10 | **
|
---|
11 | ** (single precision)
|
---|
12 | **
|
---|
13 | ** Given:
|
---|
14 | ** v float[3] x,y,z vector
|
---|
15 | **
|
---|
16 | ** Returned:
|
---|
17 | ** *a,*b float 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 = (double) v[0];
|
---|
36 | y = (double) v[1];
|
---|
37 | z = (double) v[2];
|
---|
38 | r = sqrt ( x * x + y * y );
|
---|
39 |
|
---|
40 | *a = ( r == 0.0 ) ? 0.0f : (float) atan2 ( y, x );
|
---|
41 | *b = ( z == 0.0 ) ? 0.0f : (float) atan2 ( z, r );
|
---|
42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.