File: prectes2.cpp

package info (click to toggle)
pluto-lunar 0.0~git20180825.e34c1d1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 1,584 kB
  • sloc: cpp: 18,100; makefile: 653; ansic: 368
file content (74 lines) | stat: -rw-r--r-- 2,425 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* prectes2.cpp: compares Earth precession done in ecliptic and equatorial
systems.  See 'precess.cpp' for details as to why both methods matter
and when they ought to be used.

Copyright (C) 2017, Project Pluto

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.    */

#include <math.h>
#include <string.h>
#include <stdio.h>
#include "watdefs.h"
#include "afuncs.h"
#include "date.h"
#include "lunar.h"         /* for obliquity( ) prototype */

#define PI 3.1415926535897932384626433832795028841971693993751058209749445923

int DLL_FUNC setup_equatorial_precession_from_j2000( double DLLPTR *matrix,
                           const double year);

#include <stdio.h>
#include <stdlib.h>

int main( const int argc, const char **argv)
{
   double t1, matrix[9];
   int i, pass;
   const double J2000 = 2451545.;

   t1 = get_time_from_string( 0., argv[1], FULL_CTIME_YMD, NULL);
   printf( "JD %f =", t1);
   t1 = (t1 - J2000) / 365.25 + 2000.;
   printf( " year %f\n", t1);
   printf( "Last digits represent about 0.64 mm on earth's surface\n");
   for( pass = 0; pass < 3; pass++)
      {
      if( !pass)
         {
         printf( "New,  ecliptic-based precession :\n");
         setup_precession( matrix, 2000., t1);
         }
      else if( pass == 1)
         {
         printf( "Original,  rougher precession :\n");
         setup_equatorial_precession_from_j2000( matrix, t1);
         }
      else
         {
         double mat2[9];

         printf( "Differences are (old - new) :\n");
         setup_equatorial_precession_from_j2000( matrix, t1);
         setup_precession( mat2, 2000., t1);
         for( i = 0; i < 9; i++)
            matrix[i] -= mat2[i];
         }
      for( i = 0; i < 9; i++)
         printf( "%14.10f%s", matrix[i], (i % 3 == 2) ? "\n" : " ");
      }
}