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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
//! Physical and astronomical constants
//!
//! This module provides comprehensive physical and astronomical constants for astrodynamics calculations.
//! Unless otherwise specified, gravitational parameters are from JPL DE440/441 ephemeris.
//! Radii and shape parameters are from IAU Working Group on Cartographic Coordinates and Rotational Elements.
//!
//! # References
//! - JPL DE440/441: <https://ssd.jpl.nasa.gov/astro_par.html>
//! - IAU 2015 Resolution B3: <https://arxiv.org/abs/1510.07674>
//! - IAU Working Group on Cartographic Coordinates
// =============================================================================
// FUNDAMENTAL PHYSICAL CONSTANTS
// =============================================================================
/// Gravitational constant (m³ kg⁻¹ s⁻²)
///
/// CODATA 2018 recommended value.
/// Reference: <https://physics.nist.gov/cgi-bin/cuu/Value?bg>
pub const G: f64 = 6.674_30e-11;
/// Speed of light in vacuum (m/s)
///
/// Exact value by definition in SI units.
pub const C: f64 = 299_792_458.0;
/// Astronomical unit (m)
///
/// IAU 2012 Resolution B2: exact value by definition.
/// Reference: <https://www.iau.org/static/resolutions/IAU2012_English.pdf>
pub const AU: f64 = 149_597_870_700.0;
// =============================================================================
// SOLAR CONSTANTS
// =============================================================================
/// Sun's standard gravitational parameter (m³/s²)
///
/// Heliocentric gravitational constant from JPL DE440.
/// Value: 1.32712440041279419 × 10²⁰ m³/s²
pub const GM_SUN: f64 = 1.327_124_400_412_794_2e20;
/// Sun's nominal equatorial radius (m)
///
/// IAU 2015 Resolution B3 nominal value.
pub const R_SUN: f64 = 6.957e8;
/// Sun's mean radius (m)
///
/// Equivalent to equatorial radius for the Sun (assumed spherical).
pub const R_MEAN_SUN: f64 = 6.957e8;
/// Sun's J2 gravitational coefficient (dimensionless)
///
/// Solar oblateness coefficient.
pub const J2_SUN: f64 = 2.0e-7;
/// Total Solar Irradiance (TSI) at 1 AU (W/m²)
///
/// Also known as the solar constant. This is the total electromagnetic radiation
/// per unit area received from the Sun at a distance of 1 AU (at the top of Earth's
/// atmosphere), measured perpendicular to the incoming sunlight.
///
/// Value from NASA SORCE mission and widely adopted in astrodynamics.
/// Reference: Kopp, G., & Lean, J. L. (2011). A new, lower value of total solar
/// irradiance: Evidence and climate significance. Geophysical Research Letters, 38(1).
/// DOI: 10.1029/2010GL045777
pub const SOLAR_IRRADIANCE: f64 = 1361.0;
/// Solar radiation pressure at 1 AU for a perfectly absorbing surface (N/m²)
///
/// Calculated as P = E/c, where E is the solar irradiance and c is the speed of light.
/// For reflective surfaces, multiply by the reflectivity coefficient CR:
/// - CR = 1.0 for perfectly absorbing (black body)
/// - CR = 2.0 for perfectly reflecting (specular reflection)
/// - CR ≈ 1.2-1.5 for typical spacecraft surfaces
///
/// Value: 1361 W/m² / 299,792,458 m/s ≈ 4.5398 × 10⁻⁶ N/m²
pub const SOLAR_RADIATION_PRESSURE: f64 = 4.539_807_335_646_84e-6;
// =============================================================================
// MERCURY
// =============================================================================
/// Mercury's standard gravitational parameter (m³/s²)
///
/// From JPL DE440: 22,031.87 km³/s²
pub const GM_MERCURY: f64 = 2.203_187e13;
/// Mercury's equatorial radius (m)
pub const R_MERCURY: f64 = 2_440_530.0;
/// Mercury's polar radius (m)
pub const R_POLAR_MERCURY: f64 = 2_438_260.0;
/// Mercury's mean radius (m)
pub const R_MEAN_MERCURY: f64 = 2_439_400.0;
// =============================================================================
// VENUS
// =============================================================================
/// Venus's standard gravitational parameter (m³/s²)
///
/// From JPL DE440: 324,858.59 km³/s²
pub const GM_VENUS: f64 = 3.248_585_9e14;
/// Venus's equatorial radius (m)
pub const R_VENUS: f64 = 6_051_800.0;
/// Venus's polar radius (m)
pub const R_POLAR_VENUS: f64 = 6_051_800.0;
/// Venus's mean radius (m)
pub const R_MEAN_VENUS: f64 = 6_051_800.0;
/// Venus's J2 gravitational coefficient (dimensionless)
pub const J2_VENUS: f64 = 4.458e-6;
/// Venus's J3 gravitational coefficient (dimensionless)
pub const J3_VENUS: f64 = -2.1e-6;
// =============================================================================
// EARTH
// =============================================================================
/// Earth's standard gravitational parameter (m³/s²)
///
/// From JPL DE440: 398,600.44 km³/s²
/// IAU 2015 Resolution B3 nominal terrestrial mass parameter.
pub const GM_EARTH: f64 = 3.986_004_4e14;
/// Earth's equatorial radius (m)
///
/// WGS84 value, also IAU 2015 Resolution B3 nominal value.
pub const R_EARTH: f64 = 6_378_137.0;
/// Earth's polar radius (m)
///
/// WGS84 value, also IAU 2015 Resolution B3 nominal value.
pub const R_POLAR_EARTH: f64 = 6_356_752.314_245;
/// Earth's mean radius (m)
///
/// Volumetric mean radius.
pub const R_MEAN_EARTH: f64 = 6_371_008.4;
/// Earth's J2 gravitational coefficient (dimensionless)
///
/// Primary oblateness term, critical for orbital perturbations.
/// WGS84 value: 1.082626683×10⁻³
pub const J2_EARTH: f64 = 1.082_626_683e-3;
/// Earth's J3 gravitational coefficient (dimensionless)
///
/// Pear-shaped distortion term.
pub const J3_EARTH: f64 = -2.532_435_346e-6;
/// Earth's J4 gravitational coefficient (dimensionless)
///
/// Higher-order oblateness term. Represents the fourth zonal harmonic
/// in Earth's gravity field expansion. This coefficient is about 650× smaller
/// than J2 but becomes important for high-precision orbit propagation.
///
/// Value from satellite observations. Note: WGS84 reference ellipsoid gives
/// a different value (-2.37×10⁻⁶), but this observed value better represents
/// the actual gravitational field for orbit propagation.
pub const J4_EARTH: f64 = -1.649e-6;
/// Earth's J5 gravitational coefficient (dimensionless)
///
/// Odd zonal harmonic representing asymmetry about the equator.
/// This coefficient is non-zero for the actual Earth due to mass distribution
/// irregularities, though it is zero for the idealized WGS84 reference ellipsoid.
///
/// Value from satellite observations.
pub const J5_EARTH: f64 = -0.21e-6;
/// Earth's J6 gravitational coefficient (dimensionless)
///
/// Higher-order even zonal harmonic. This coefficient is about 1,800× smaller
/// than J2 and is used in high-precision orbit propagation over extended periods.
///
/// Value from satellite observations. Note: WGS84 reference ellipsoid gives
/// a different value (6.08×10⁻⁹).
pub const J6_EARTH: f64 = 0.646e-6;
/// Earth's atmospheric scale height at sea level (m)
///
/// Reference height for exponential atmosphere model.
pub const H0_EARTH: f64 = 8_500.0;
/// Earth's atmospheric density at sea level (kg/m³)
///
/// Reference density for exponential atmosphere model.
pub const RHO0_EARTH: f64 = 1.225;
// =============================================================================
// MOON
// =============================================================================
/// Moon's standard gravitational parameter (m³/s²)
///
/// From JPL DE440: 4,902.80 km³/s²
pub const GM_MOON: f64 = 4.902_80e12;
/// Moon's equatorial radius (m)
pub const R_MOON: f64 = 1_738_100.0;
/// Moon's polar radius (m)
pub const R_POLAR_MOON: f64 = 1_736_000.0;
/// Moon's mean radius (m)
pub const R_MEAN_MOON: f64 = 1_737_400.0;
// =============================================================================
// GALILEAN MOONS (JUPITER'S MAJOR SATELLITES)
// =============================================================================
/// Io's standard gravitational parameter (m³/s²)
///
/// From JPL DE440: 5,959.91547 km³/s²
/// Reference: gm_de440.tpc NAIF kernel
pub const GM_IO: f64 = 5.959_915_466_180_539e12;
/// Io's mean radius (m)
///
/// From JPL Planetary Satellite Physical Parameters.
/// Reference: JUP365 ephemeris
pub const R_IO: f64 = 1_821_490.0;
/// Europa's standard gravitational parameter (m³/s²)
///
/// From JPL DE440: 3,202.71210 km³/s²
/// Reference: gm_de440.tpc NAIF kernel
pub const GM_EUROPA: f64 = 3.202_712_099_607_295e12;
/// Europa's mean radius (m)
///
/// From JPL Planetary Satellite Physical Parameters.
/// Reference: JUP365 ephemeris
pub const R_EUROPA: f64 = 1_560_800.0;
/// Ganymede's standard gravitational parameter (m³/s²)
///
/// From JPL DE440: 9,887.83275 km³/s²
/// Ganymede is the largest moon in the Solar System.
/// Reference: gm_de440.tpc NAIF kernel
pub const GM_GANYMEDE: f64 = 9.887_832_752_719_638e12;
/// Ganymede's mean radius (m)
///
/// From JPL Planetary Satellite Physical Parameters.
/// Ganymede is the largest moon in the Solar System (larger than Mercury).
/// Reference: JUP365 ephemeris
pub const R_GANYMEDE: f64 = 2_631_200.0;
/// Callisto's standard gravitational parameter (m³/s²)
///
/// From JPL DE440: 7,179.28340 km³/s²
/// Reference: gm_de440.tpc NAIF kernel
pub const GM_CALLISTO: f64 = 7.179_283_402_579_837e12;
/// Callisto's mean radius (m)
///
/// From JPL Planetary Satellite Physical Parameters.
/// Reference: JUP365 ephemeris
pub const R_CALLISTO: f64 = 2_410_300.0;
// =============================================================================
// SATURNIAN MOONS
// =============================================================================
/// Titan's standard gravitational parameter (m³/s²)
///
/// From JPL DE440: 8,978.13710 km³/s²
/// Titan is Saturn's largest moon and the only moon with a substantial atmosphere.
/// Reference: gm_de440.tpc NAIF kernel
pub const GM_TITAN: f64 = 8.978_137_095_521_046e12;
/// Titan's mean radius (m)
///
/// From JPL Planetary Satellite Physical Parameters.
/// Titan is the second-largest moon in the Solar System.
/// Reference: SAT441 ephemeris
pub const R_TITAN: f64 = 2_574_760.0;
// =============================================================================
// NEPTUNIAN MOONS
// =============================================================================
/// Triton's standard gravitational parameter (m³/s²)
///
/// From JPL DE440: 1,428.49546 km³/s²
/// Triton is Neptune's largest moon and orbits retrograde.
/// Reference: gm_de440.tpc NAIF kernel
pub const GM_TRITON: f64 = 1.428_495_462_910_464e12;
/// Triton's mean radius (m)
///
/// From JPL Planetary Satellite Physical Parameters.
/// Reference: NEP097 ephemeris
pub const R_TRITON: f64 = 1_352_600.0;
// =============================================================================
// MARS
// =============================================================================
/// Mars's standard gravitational parameter (m³/s²)
///
/// Mars system from JPL DE440: 42,828.38 km³/s²
pub const GM_MARS: f64 = 4.282_838e13;
/// Mars's equatorial radius (m)
pub const R_MARS: f64 = 3_396_200.0;
/// Mars's polar radius (m)
pub const R_POLAR_MARS: f64 = 3_376_200.0;
/// Mars's mean radius (m)
pub const R_MEAN_MARS: f64 = 3_389_500.0;
/// Mars's J2 gravitational coefficient (dimensionless)
pub const J2_MARS: f64 = 1.960_45e-3;
/// Mars's J3 gravitational coefficient (dimensionless)
pub const J3_MARS: f64 = 3.14e-5;
// =============================================================================
// JUPITER
// =============================================================================
/// Jupiter system's standard gravitational parameter (m³/s²)
///
/// Jupiter system from JPL DE440: 126,712,764.10 km³/s²
/// IAU 2015 Resolution B3 nominal jovian mass parameter.
pub const GM_JUPITER: f64 = 1.267_127_641e17;
/// Jupiter's equatorial radius (m)
///
/// IAU 2015 Resolution B3 nominal jovian equatorial radius.
pub const R_JUPITER: f64 = 7.149_2e7;
/// Jupiter's polar radius (m)
///
/// IAU 2015 Resolution B3 nominal jovian polar radius.
pub const R_POLAR_JUPITER: f64 = 6.685_4e7;
/// Jupiter's mean radius (m)
pub const R_MEAN_JUPITER: f64 = 6.991_1e7;
// =============================================================================
// SATURN
// =============================================================================
/// Saturn system's standard gravitational parameter (m³/s²)
///
/// Saturn system from JPL DE440: 37,940,584.84 km³/s²
pub const GM_SATURN: f64 = 3.794_058_484e16;
/// Saturn's equatorial radius (m)
pub const R_SATURN: f64 = 6.026_8e7;
/// Saturn's polar radius (m)
pub const R_POLAR_SATURN: f64 = 5.431_4e7;
/// Saturn's mean radius (m)
pub const R_MEAN_SATURN: f64 = 5.823_2e7;
// =============================================================================
// URANUS
// =============================================================================
/// Uranus system's standard gravitational parameter (m³/s²)
///
/// Uranus system from JPL DE440: 5,794,556.40 km³/s²
pub const GM_URANUS: f64 = 5.794_556_4e15;
/// Uranus's equatorial radius (m)
pub const R_URANUS: f64 = 2.559_2e7;
/// Uranus's polar radius (m)
pub const R_POLAR_URANUS: f64 = 2.497_3e7;
/// Uranus's mean radius (m)
pub const R_MEAN_URANUS: f64 = 2.536_2e7;
// =============================================================================
// NEPTUNE
// =============================================================================
/// Neptune system's standard gravitational parameter (m³/s²)
///
/// Neptune system from JPL DE440: 6,836,527.10 km³/s²
pub const GM_NEPTUNE: f64 = 6.836_527_1e15;
/// Neptune's equatorial radius (m)
pub const R_NEPTUNE: f64 = 2.476_4e7;
/// Neptune's polar radius (m)
pub const R_POLAR_NEPTUNE: f64 = 2.431_5e7;
/// Neptune's mean radius (m)
pub const R_MEAN_NEPTUNE: f64 = 2.462_2e7;
// =============================================================================
// PLUTO
// =============================================================================
/// Pluto system's standard gravitational parameter (m³/s²)
///
/// Pluto system from JPL DE440: 975.50 km³/s²
pub const GM_PLUTO: f64 = 9.755e11;
/// Pluto's equatorial radius (m)
pub const R_PLUTO: f64 = 1_188_300.0;
/// Pluto's polar radius (m)
pub const R_POLAR_PLUTO: f64 = 1_188_300.0;
/// Pluto's mean radius (m)
pub const R_MEAN_PLUTO: f64 = 1_188_300.0;
// =============================================================================
// PLANETARY ORBITAL PARAMETERS
// =============================================================================
/// Mercury's semi-major axis (m)
///
/// From JPL planetary ephemerides, valid 1800 AD - 2050 AD.
/// Value: 0.38709927 AU
pub const A_MERCURY: f64 = 5.790_922_654_152_439e10;
/// Venus's semi-major axis (m)
///
/// From JPL planetary ephemerides, valid 1800 AD - 2050 AD.
/// Value: 0.72333566 AU
pub const A_VENUS: f64 = 1.082_094_745_373_792e11;
/// Earth's semi-major axis (m)
///
/// From JPL planetary ephemerides, valid 1800 AD - 2050 AD.
/// Value: 1.00000261 AU (Earth-Moon barycenter)
pub const A_EARTH: f64 = 1.495_982_611_504_425e11;
/// Mars's semi-major axis (m)
///
/// From JPL planetary ephemerides, valid 1800 AD - 2050 AD.
/// Value: 1.52371034 AU
pub const A_MARS: f64 = 2.279_438_224_275_731e11;
/// Jupiter's semi-major axis (m)
///
/// From JPL planetary ephemerides, valid 1800 AD - 2050 AD.
/// Value: 5.20288700 AU
pub const A_JUPITER: f64 = 7.783_408_166_927_108e11;
/// Saturn's semi-major axis (m)
///
/// From JPL planetary ephemerides, valid 1800 AD - 2050 AD.
/// Value: 9.53667594 AU
pub const A_SATURN: f64 = 1.426_666_414_179_921e12;
/// Uranus's semi-major axis (m)
///
/// From JPL planetary ephemerides, valid 1800 AD - 2050 AD.
/// Value: 19.18916464 AU
pub const A_URANUS: f64 = 2.870_658_170_655_732e12;
/// Neptune's semi-major axis (m)
///
/// From JPL planetary ephemerides, valid 1800 AD - 2050 AD.
/// Value: 30.06992276 AU
pub const A_NEPTUNE: f64 = 4.498_396_417_009_467e12;
// =============================================================================
// SPHERE OF INFLUENCE RADII
// =============================================================================
/// Mercury's sphere of influence radius (m)
///
/// Calculated using: r_SOI = a × (GM_planet / GM_sun)^(2/5)
/// where a is the semi-major axis of Mercury's orbit.
///
/// This is the approximate radius within which Mercury's gravity dominates
/// over the Sun's gravity for orbital mechanics calculations.
/// Used in patched conic approximations for interplanetary trajectories.
pub const R_SOI_MERCURY: f64 = 1.124_096_653_358_193e8;
/// Venus's sphere of influence radius (m)
///
/// Calculated using: r_SOI = a × (GM_planet / GM_sun)^(2/5)
pub const R_SOI_VENUS: f64 = 6.162_804_293_403_314e8;
/// Earth's sphere of influence radius (m)
///
/// Calculated using: r_SOI = a × (GM_planet / GM_sun)^(2/5)
///
/// For reference, the Moon's orbital radius is ~384,400 km,
/// well within Earth's sphere of influence (~924,600 km).
pub const R_SOI_EARTH: f64 = 9.246_492_066_976_895e8;
/// Mars's sphere of influence radius (m)
///
/// Calculated using: r_SOI = a × (GM_planet / GM_sun)^(2/5)
pub const R_SOI_MARS: f64 = 5.772_392_211_457_512e8;
/// Jupiter's sphere of influence radius (m)
///
/// Calculated using: r_SOI = a × (GM_planet / GM_sun)^(2/5)
///
/// Jupiter has a large sphere of influence (~48.2 million km) due to
/// its large mass and distance from the Sun.
pub const R_SOI_JUPITER: f64 = 4.820_957_444_909_551e10;
/// Saturn's sphere of influence radius (m)
///
/// Calculated using: r_SOI = a × (GM_planet / GM_sun)^(2/5)
///
/// Saturn has the largest sphere of influence of any planet (~54.6 million km)
/// due to its great distance from the Sun, despite having less mass than Jupiter.
pub const R_SOI_SATURN: f64 = 5.455_058_247_395_433e10;
/// Uranus's sphere of influence radius (m)
///
/// Calculated using: r_SOI = a × (GM_planet / GM_sun)^(2/5)
pub const R_SOI_URANUS: f64 = 5.176_365_156_171_003e10;
/// Neptune's sphere of influence radius (m)
///
/// Calculated using: r_SOI = a × (GM_planet / GM_sun)^(2/5)
pub const R_SOI_NEPTUNE: f64 = 8.666_171_649_697_98e10;
// =============================================================================
// CONVERSION FACTORS
// =============================================================================
/// Kilometers to meters conversion factor
pub const KM_TO_M: f64 = 1_000.0;
/// Meters to kilometers conversion factor
pub const M_TO_KM: f64 = 1.0 / 1_000.0;
/// Degrees to radians conversion factor
pub const DEG_TO_RAD: f64 = PI / 180.0;
/// Radians to degrees conversion factor
pub const RAD_TO_DEG: f64 = 180.0 / PI;
/// Days to seconds conversion factor
pub const DAY_TO_SEC: f64 = 86_400.0;
/// Seconds to days conversion factor
pub const SEC_TO_DAY: f64 = 1.0 / 86_400.0;
// =============================================================================
// TIME REFERENCE EPOCHS
// =============================================================================
/// J2000 epoch in Julian Date (Terrestrial Time)
///
/// January 1, 2000, 12:00:00 TT
/// Reference epoch for astronomical calculations.
pub const J2000_TT: f64 = 2_451_545.0;
/// J2000 epoch in Modified Julian Date
///
/// MJD = JD - 2400000.5
pub const J2000_MJD: f64 = 51_544.5;
// =============================================================================
// HELPER FUNCTIONS
// =============================================================================
/// Convert kilometers to meters
/// Convert meters to kilometers
/// Convert degrees to radians
/// Convert radians to degrees
/// Convert days to seconds
/// Convert seconds to days
// =============================================================================
// Tests
// =============================================================================