nyx_space/md/trajectory/
mod.rs

1/*
2    Nyx, blazing fast astrodynamics
3    Copyright (C) 2018-onwards Christopher Rabotin <christopher.rabotin@gmail.com>
4
5    This program is free software: you can redistribute it and/or modify
6    it under the terms of the GNU Affero General Public License as published
7    by the Free Software Foundation, either version 3 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU Affero General Public License for more details.
14
15    You should have received a copy of the GNU Affero General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.
17*/
18
19use anise::math::interpolation::InterpolationError;
20use snafu::prelude::*;
21
22mod interpolatable;
23mod sc_traj;
24mod traj;
25mod traj_it;
26
27pub use interpolatable::Interpolatable;
28pub(crate) use interpolatable::INTERPOLATION_SAMPLES;
29pub use traj::Traj;
30
31pub use crate::io::ExportCfg;
32
33use super::StateParameter;
34use crate::time::{Duration, Epoch};
35
36#[derive(Clone, PartialEq, Debug, Snafu)]
37pub enum TrajError {
38    #[snafu(display("Event {event} not found between {start} and {end}"))]
39    EventNotFound {
40        start: Epoch,
41        end: Epoch,
42        event: String,
43    },
44    #[snafu(display("No interpolation data at {epoch}"))]
45    NoInterpolationData { epoch: Epoch },
46    #[snafu(display("Failed to create trajectory: {msg}"))]
47    CreationError { msg: String },
48    #[snafu(display("Probable bug: Requested epoch {req_epoch}, corresponding to an offset of {req_dur} in a spline of duration {spline_dur}"))]
49    OutOfSpline {
50        req_epoch: Epoch,
51        req_dur: Duration,
52        spline_dur: Duration,
53    },
54    #[snafu(display("Interpolation failed: {source}"))]
55    Interpolation { source: InterpolationError },
56}