pub struct Trajectory<T: TimeScale, O: Origin, R: ReferenceFrame> { /* private fields */ }Expand description
A time-ordered sequence of Cartesian orbital states with Hermite interpolation.
Implementations§
Source§impl<T, O, R> Trajectory<T, O, R>
impl<T, O, R> Trajectory<T, O, R>
Sourcepub fn new(states: impl IntoIterator<Item = CartesianOrbit<T, O, R>>) -> Self
pub fn new(states: impl IntoIterator<Item = CartesianOrbit<T, O, R>>) -> Self
Constructs a trajectory from an iterator of Cartesian orbital states.
Sourcepub fn from_parts(
epoch: Time<T>,
origin: O,
frame: R,
data: CartesianTrajectory,
) -> Self
pub fn from_parts( epoch: Time<T>, origin: O, frame: R, data: CartesianTrajectory, ) -> Self
Constructs a trajectory from its constituent parts.
Sourcepub fn into_parts(self) -> (Time<T>, O, R, CartesianTrajectory)
pub fn into_parts(self) -> (Time<T>, O, R, CartesianTrajectory)
Decomposes this trajectory into its constituent parts.
Sourcepub fn try_new(
states: impl IntoIterator<Item = CartesianOrbit<T, O, R>>,
) -> Result<Self, TrajectorError>
pub fn try_new( states: impl IntoIterator<Item = CartesianOrbit<T, O, R>>, ) -> Result<Self, TrajectorError>
Constructs a trajectory, returning an error if fewer than 2 states are provided.
Sourcepub fn at(&self, time: Time<T>) -> CartesianOrbit<T, O, R>
pub fn at(&self, time: Time<T>) -> CartesianOrbit<T, O, R>
Interpolates the trajectory at the given absolute time.
Sourcepub fn into_frame<R1, P>(
self,
frame: R1,
provider: &P,
) -> Result<Trajectory<T, O, R1>, Box<dyn Error>>
pub fn into_frame<R1, P>( self, frame: R1, provider: &P, ) -> Result<Trajectory<T, O, R1>, Box<dyn Error>>
Transforms the entire trajectory into a different reference frame.
Sourcepub fn reference_frame(&self) -> R
pub fn reference_frame(&self) -> R
Returns the reference frame.
Sourcepub fn start_time(&self) -> Time<T>
pub fn start_time(&self) -> Time<T>
Returns the start time of the trajectory (same as the epoch).
Sourcepub fn times(&self) -> Vec<Time<T>>
pub fn times(&self) -> Vec<Time<T>>
Returns the absolute times of all data points in the trajectory.
Sourcepub fn states(&self) -> Vec<CartesianOrbit<T, O, R>> ⓘ
pub fn states(&self) -> Vec<CartesianOrbit<T, O, R>> ⓘ
Returns all orbital states at the original data points.
Sourcepub fn to_vec(&self) -> Vec<Vec<f64>>
pub fn to_vec(&self) -> Vec<Vec<f64>>
Returns the trajectory as a vector of [t, x, y, z, vx, vy, vz] rows.
Sourcepub fn interpolate(&self, dt: TimeDelta) -> CartesianOrbit<T, O, R>
pub fn interpolate(&self, dt: TimeDelta) -> CartesianOrbit<T, O, R>
Interpolates the trajectory at the given time delta from the epoch.
Sourcepub fn interpolate_at(&self, time: Time<T>) -> CartesianOrbit<T, O, R>
pub fn interpolate_at(&self, time: Time<T>) -> CartesianOrbit<T, O, R>
Interpolates the trajectory at the given absolute time.
Sourcepub fn position(&self, t: f64) -> DVec3
pub fn position(&self, t: f64) -> DVec3
Returns the interpolated position at time t seconds from the epoch.
Sourcepub fn velocity(&self, t: f64) -> DVec3
pub fn velocity(&self, t: f64) -> DVec3
Returns the interpolated velocity at time t seconds from the epoch.
Sourcepub fn find_events<F>(
&self,
func: F,
step: TimeDelta,
) -> Result<Vec<Event<T>>, DetectError>
pub fn find_events<F>( &self, func: F, step: TimeDelta, ) -> Result<Vec<Event<T>>, DetectError>
Find zero-crossing events of func evaluated along this trajectory.
The closure receives the interpolated CartesianOrbit at each sample
time and must return a scalar whose sign changes define events.
Sourcepub fn try_find_events<F, E>(
&self,
func: F,
step: TimeDelta,
) -> Result<Vec<Event<T>>, DetectError>
pub fn try_find_events<F, E>( &self, func: F, step: TimeDelta, ) -> Result<Vec<Event<T>>, DetectError>
Find zero-crossing events of a fallible func evaluated along this
trajectory.
Sourcepub fn find_windows<F>(
&self,
func: F,
step: TimeDelta,
) -> Result<Vec<TimeInterval<T>>, DetectError>
pub fn find_windows<F>( &self, func: F, step: TimeDelta, ) -> Result<Vec<TimeInterval<T>>, DetectError>
Find time intervals where func is positive, evaluated along this
trajectory.
Sourcepub fn try_find_windows<F, E>(
&self,
func: F,
step: TimeDelta,
) -> Result<Vec<TimeInterval<T>>, DetectError>
pub fn try_find_windows<F, E>( &self, func: F, step: TimeDelta, ) -> Result<Vec<TimeInterval<T>>, DetectError>
Find time intervals where a fallible func is positive, evaluated
along this trajectory.
Source§impl<T, O, R> Trajectory<T, O, R>
impl<T, O, R> Trajectory<T, O, R>
Sourcepub fn into_dyn(self) -> DynTrajectory
pub fn into_dyn(self) -> DynTrajectory
Converts this trajectory into a dynamically-typed trajectory.
Source§impl<T, O> Trajectory<T, O, Icrf>
impl<T, O> Trajectory<T, O, Icrf>
Sourcepub fn to_origin<O1: Origin + Copy, E: Ephemeris>(
&self,
target: O1,
ephemeris: &E,
) -> Result<Trajectory<T, O1, Icrf>, TrajectoryTransformationError>
pub fn to_origin<O1: Origin + Copy, E: Ephemeris>( &self, target: O1, ephemeris: &E, ) -> Result<Trajectory<T, O1, Icrf>, TrajectoryTransformationError>
Transforms the entire trajectory to a different central body origin using an ephemeris.
Source§impl<O, R> Trajectory<Tai, O, R>
impl<O, R> Trajectory<Tai, O, R>
Sourcepub fn from_csv(csv: &str, origin: O, frame: R) -> Result<Self, TrajectoryError>
pub fn from_csv(csv: &str, origin: O, frame: R) -> Result<Self, TrajectoryError>
Parses a trajectory from CSV data with columns [time, x, y, z, vx, vy, vz] in km and km/s.
Source§impl Trajectory<DynTimeScale, DynOrigin, DynFrame>
impl Trajectory<DynTimeScale, DynOrigin, DynFrame>
Sourcepub fn from_csv_dyn(
csv: &str,
origin: DynOrigin,
frame: DynFrame,
) -> Result<DynTrajectory, TrajectoryError>
pub fn from_csv_dyn( csv: &str, origin: DynOrigin, frame: DynFrame, ) -> Result<DynTrajectory, TrajectoryError>
Parses a dynamically-typed trajectory from CSV data.
Trait Implementations§
Source§impl<T: Clone + TimeScale, O: Clone + Origin, R: Clone + ReferenceFrame> Clone for Trajectory<T, O, R>
impl<T: Clone + TimeScale, O: Clone + Origin, R: Clone + ReferenceFrame> Clone for Trajectory<T, O, R>
Source§fn clone(&self) -> Trajectory<T, O, R>
fn clone(&self) -> Trajectory<T, O, R>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Debug + TimeScale, O: Debug + Origin, R: Debug + ReferenceFrame> Debug for Trajectory<T, O, R>
impl<T: Debug + TimeScale, O: Debug + Origin, R: Debug + ReferenceFrame> Debug for Trajectory<T, O, R>
Source§impl<T, O, R> FromIterator<Orbit<Cartesian, T, O, R>> for Trajectory<T, O, R>
impl<T, O, R> FromIterator<Orbit<Cartesian, T, O, R>> for Trajectory<T, O, R>
Source§fn from_iter<U: IntoIterator<Item = CartesianOrbit<T, O, R>>>(iter: U) -> Self
fn from_iter<U: IntoIterator<Item = CartesianOrbit<T, O, R>>>(iter: U) -> Self
Source§impl<T, O, R> Propagator<T, O> for Trajectory<T, O, R>
impl<T, O, R> Propagator<T, O> for Trajectory<T, O, R>
Source§type Error = TrajectorError
type Error = TrajectorError
Source§fn state_at(
&self,
time: Time<T>,
) -> Result<CartesianOrbit<T, O, R>, TrajectorError>
fn state_at( &self, time: Time<T>, ) -> Result<CartesianOrbit<T, O, R>, TrajectorError>
Source§fn propagate(
&self,
interval: TimeInterval<T>,
) -> Result<Trajectory<T, O, R>, Self::Error>
fn propagate( &self, interval: TimeInterval<T>, ) -> Result<Trajectory<T, O, R>, Self::Error>
Source§fn propagate_to(
&self,
times: impl IntoIterator<Item = Time<T>>,
) -> Result<Trajectory<T, O, Self::Frame>, Self::Error>
fn propagate_to( &self, times: impl IntoIterator<Item = Time<T>>, ) -> Result<Trajectory<T, O, Self::Frame>, Self::Error>
Auto Trait Implementations§
impl<T, O, R> Freeze for Trajectory<T, O, R>
impl<T, O, R> RefUnwindSafe for Trajectory<T, O, R>
impl<T, O, R> Send for Trajectory<T, O, R>
impl<T, O, R> Sync for Trajectory<T, O, R>
impl<T, O, R> Unpin for Trajectory<T, O, R>
impl<T, O, R> UnsafeUnpin for Trajectory<T, O, R>
impl<T, O, R> UnwindSafe for Trajectory<T, O, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.