-
Notifications
You must be signed in to change notification settings - Fork 41
/
basics.cpp
67 lines (55 loc) · 2.03 KB
/
basics.cpp
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
/* Copyright (C) 2018, Project Pluto. See LICENSE. */
#include <math.h>
#include "norad.h"
#include "norad_in.h"
/*------------------------------------------------------------------*/
/* FMOD2P */
double FMod2p( const double x)
{
double rval = fmod( x, twopi);
if( rval < 0.)
rval += twopi;
return( rval);
} /* fmod2p */
#define EPHEM_TYPE_DEFAULT '0'
#define EPHEM_TYPE_SGP '1'
#define EPHEM_TYPE_SGP4 '2'
#define EPHEM_TYPE_SDP4 '3'
#define EPHEM_TYPE_SGP8 '4'
#define EPHEM_TYPE_SDP8 '5'
#define EPHEM_TYPE_HIGH 'H'
/*------------------------------------------------------------------*/
void sxpall_common_init( const tle_t *tle, deep_arg_t *deep_arg);
/* common.c */
/* Selects the type of ephemeris to be used (SGP*-SDP*) */
int DLL_FUNC select_ephemeris( const tle_t *tle)
{
int rval;
if( tle->ephemeris_type == EPHEM_TYPE_HIGH)
rval = 1; /* force high-orbit state vector model */
else if( tle->xno <= 0. || tle->eo > 1. || tle->eo < 0.)
rval = -1; /* error in input data */
else if( tle->ephemeris_type == EPHEM_TYPE_SGP4
|| tle->ephemeris_type == EPHEM_TYPE_SGP8)
rval = 0; /* specifically marked non-deep */
else if( tle->ephemeris_type == EPHEM_TYPE_SDP4
|| tle->ephemeris_type == EPHEM_TYPE_SDP8)
rval = 1; /* specifically marked deep */
else
{
deep_arg_t deep_arg;
sxpall_common_init( tle, &deep_arg);
/* Select a deep-space/near-earth ephemeris */
/* If the orbital period is greater than 225 minutes... */
if (twopi / deep_arg.xnodp >= 225.)
rval = 1; /* yes, it should be a deep-space (SDPx) ephemeris */
else
rval = 0; /* no, you can go with an SGPx ephemeris */
}
return( rval);
} /* End of select_ephemeris() */
/*------------------------------------------------------------------*/
long DLL_FUNC sxpx_library_version( void)
{
return( 0x100);
}