File: orbital_elements.h

package info (click to toggle)
nautic 1.5-1.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,232 kB
  • ctags: 1,512
  • sloc: cpp: 14,070; ansic: 7,841; makefile: 32
file content (81 lines) | stat: -rw-r--r-- 2,719 bytes parent folder | download | duplicates (3)
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
75
76
77
78
79
80
81
/*
 * orbital_elements.h - Declarations for orbital element support
 * Copyright (C) 2010 Shiva Iyer <shiva.iyer AT g m a i l DOT c o m>
 *
 * 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 3 of the License, or
 * 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, see <http://www.gnu.org/licenses/>.
 */

#ifndef _ORBITAL_ELEMENTS_H_
#define _ORBITAL_ELEMENTS_H_

#include "kepler.h"
#include "julian_date.h"
#include "coordinate.h"

#define PARABOLIC_ORBIT			1.00

#define KEPLER_MAX_ITER			10
#define KEPLER_PRECISION		1e-14

/*
 * Used wherever the osculating orbital elements of a celestial body are
 * expected or returned.
 *
 * These values may be obtained from the circulars of the Minor Planet
 * Center, the Astronomical Almanac or other publications. See mpc_file.c
 * for some ways in which this structure is used.
 */
struct orbital_elements {
	struct julian_date epoch; /* Epoch of osculation. */

	double mean_anomaly; /* Mean anomaly in radians at epoch. */
	double daily_motion; /* Daily motion in radians/day. */

	double perihelion; /* Perihelion distance in AU. */
	double eccentricity; /* Eccentricity of the orbit. */

	/* The values for the orbit's orientation must be referred to J2000. */
	double arg_perihelion; /* Argument of the perihelion in radians. */
	double lon_asc_node; /* Longitude of the ascending node in radians. */
	double inclination; /* Inclination of the orbit in radians. */
};

/*
 * May be set to limit the number of iterations in the solution of Kepler's
 * equations. The default value is KEPLER_MAX_ITER.
 */
extern u_short kepler_equation_max_iters;

/*
 * May be set to specify the precision expected in the solution Kepler's
 * equations. The default value is KEPLER_PRECISION.
 */
extern double kepler_equation_precision;

#ifdef _DEBUG
/*
 * Set to the number of iterations required for the solution of Kepler's
 * equations in the most recent call to the relevant functions.
 */
extern u_short kepler_equation_iters;
#endif

int elements_to_ephemeris(struct julian_date *tt, struct orbital_elements *elt,
			struct rectangular_coordinates *eph);

int eccentric_anomaly(double mean_ano, double ecc, double *ecc_ano);

int hyperbolic_anomaly(double mean_ano, double ecc, double *hyp_ano);

#endif