source: trunk/MagicSoft/slalib/preces.c@ 6023

Last change on this file since 6023 was 731, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#include "slalib.h"
2#include "slamac.h"
3#include <ctype.h>
4void slaPreces ( char sys[3], double ep0, double ep1,
5 double *ra, double *dc )
6/*
7** - - - - - - - - - -
8** s l a P r e c e s
9** - - - - - - - - - -
10**
11** Precession - either FK4 (Bessel-Newcomb, pre-IAU1976) or
12** FK5 (Fricke, post-IAU1976) as required.
13**
14** Given:
15** sys char[] precession to be applied: "FK4" or "FK5"
16** ep0,ep1 double starting and ending epoch
17** ra,dc double RA,Dec, mean equator & equinox of epoch ep0
18**
19** Returned:
20** *ra,*dc double RA,Dec, mean equator & equinox of epoch ep1
21**
22** Called: slaDranrm, slaPrebn, slaPrec, slaDcs2c,
23** slaDmxv, slaDcc2s
24**
25** Notes:
26**
27** 1) The epochs are Besselian if sys='FK4' and Julian if 'FK5'.
28** For example, to precess coordinates in the old system from
29** equinox 1900.0 to 1950.0 the call would be:
30** slaPreces ( "FK4", 1900.0, 1950.0, &ra, &dc )
31**
32** 2) This routine will not correctly convert between the old and
33** the new systems - for example conversion from B1950 to J2000.
34** For these purposes see slaFk425, slaFk524, slaFk45z and
35** slaFk54z.
36**
37** 3) If an invalid sys is supplied, values of -99.0,-99.0 will
38** be returned for both ra and dc.
39**
40** Last revision: 22 December 1993
41**
42** Copyright P.T.Wallace. All rights reserved.
43*/
44{
45 double pm[3][3], v1[3], v2[3];
46
47/* Validate sys */
48 if ( ( toupper ( sys[0] ) != 'F' )
49 || ( toupper ( sys[1] ) != 'K' )
50 || ( sys[2] != '4' && sys[2] != '5' ) ) {
51 *ra = -99.0; /* Error */
52 *dc = -99.0;
53 } else {
54
55 /* Generate appropriate precession matrix */
56 if ( sys[2] == '4' )
57 slaPrebn ( ep0, ep1, pm );
58 else
59 slaPrec ( ep0, ep1, pm );
60
61 /* Convert RA,Dec to x,y,z */
62 slaDcs2c ( *ra, *dc, v1 );
63
64 /* Precess */
65 slaDmxv ( pm, v1, v2 );
66
67 /* Back to RA,Dec */
68 slaDcc2s ( v2, ra, dc );
69 *ra = slaDranrm ( *ra );
70 }
71}
Note: See TracBrowser for help on using the repository browser.