source: trunk/MagicSoft/slalib/ds2c6.c@ 1078

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