source: trunk/MagicSoft/slalib/cs2c6.c@ 9492

Last change on this file since 9492 was 731, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#include "slalib.h"
2#include "slamac.h"
3void slaCs2c6 ( float a, float b, float r, float ad,
4 float bd, float rd, float v[6] )
5/*
6** - - - - - - - - -
7** s l a C s 2 c 6
8** - - - - - - - - -
9**
10** Conversion of position & velocity in spherical coordinates
11** to Cartesian coordinates.
12**
13** (single precision)
14**
15** Given:
16** a float longitude (radians)
17** b float latitude (radians)
18** r float radial coordinate
19** ad float longitude derivative (radians per unit time)
20** bd float latitude derivative (radians per unit time)
21** rd float radial derivative
22**
23** Returned:
24** v float(6) Cartesian position & velocity vector
25**
26** Last revision: 31 October 1993
27**
28** Copyright P.T.Wallace. All rights reserved.
29*/
30{
31 double da, db;
32 float sa, ca, sb, cb, rcb, x, y, rbd, w;
33
34/* Useful functions */
35 da = (double) a;
36 db = (double) b;
37 sa = (float) sin ( da );
38 ca = (float) cos ( da );
39 sb = (float) sin ( db );
40 cb = (float) cos ( db );
41 rcb = r * cb;
42 x = rcb * ca;
43 y = rcb * sa;
44 rbd = r * bd;
45 w = rbd * sb - cb * rd;
46
47/* Position */
48 v[0] = x;
49 v[1] = y;
50 v[2] = r * sb;
51
52/* Velocity */
53 v[3] = - y * ad - w * ca;
54 v[4] = x * ad - w * sa;
55 v[5] = rbd * cb + sb * rd;
56}
Note: See TracBrowser for help on using the repository browser.