pub use self::satrec::SatRec;
use crate::Instant;
#[derive(PartialEq, PartialOrd, Clone, Debug, Eq, Copy)]
pub enum GravConst {
WGS72,
WGS72OLD,
WGS84,
}
#[derive(PartialEq, PartialOrd, Clone, Debug, Eq, Copy)]
pub enum OpsMode {
AFSPC,
IMPROVED,
}
mod dpper;
mod dscom;
mod dsinit;
mod dspace;
mod error;
mod getgravconst;
mod initl;
pub mod satrec;
mod sgp4_impl;
mod sgp4_lowlevel;
mod sgp4init;
pub use error::{Error, Result, SGP4Error};
pub use sgp4_impl::sgp4;
pub use sgp4_impl::sgp4_full;
pub use sgp4_impl::SGP4State;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SGP4InitArgs {
pub jdsatepoch: f64,
pub bstar: f64,
pub ndot: f64,
pub nddot: f64,
pub ecco: f64,
pub argpo: f64,
pub inclo: f64,
pub mo: f64,
pub no: f64,
pub nodeo: f64,
}
impl SGP4InitArgs {
#[allow(clippy::too_many_arguments)]
pub fn from_mean_elements(
jdsatepoch: f64,
bstar: f64,
mean_motion: f64,
mean_motion_dot: f64,
mean_motion_ddot: f64,
eccen: f64,
inclination_deg: f64,
raan_deg: f64,
arg_of_perigee_deg: f64,
mean_anomaly_deg: f64,
) -> Self {
use std::f64::consts::PI;
const TWOPI: f64 = PI * 2.0;
Self {
jdsatepoch,
bstar,
no: mean_motion / (1440.0 / TWOPI),
ndot: mean_motion_dot / (1440.0 * 1440.0 / TWOPI),
nddot: mean_motion_ddot / (1440.0 * 1440.0 * 1440.0 / TWOPI),
ecco: eccen,
inclo: inclination_deg.to_radians(),
nodeo: raan_deg.to_radians(),
argpo: arg_of_perigee_deg.to_radians(),
mo: mean_anomaly_deg.to_radians(),
}
}
}
pub trait SGP4Source {
fn epoch(&self) -> Instant;
fn satrec_mut(&mut self) -> &mut Option<SatRec>;
fn sgp4_init_args(&self) -> Result<SGP4InitArgs>;
}