Skip to main content

Trajectory

Struct Trajectory 

Source
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>
where T: TimeScale + Copy, O: Origin + Copy, R: ReferenceFrame + Copy,

Source

pub fn new(states: impl IntoIterator<Item = CartesianOrbit<T, O, R>>) -> Self

Constructs a trajectory from an iterator of Cartesian orbital states.

Source

pub fn from_parts( epoch: Time<T>, origin: O, frame: R, data: CartesianTrajectory, ) -> Self

Constructs a trajectory from its constituent parts.

Source

pub fn into_parts(self) -> (Time<T>, O, R, CartesianTrajectory)

Decomposes this trajectory into its constituent parts.

Source

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.

Source

pub fn at(&self, time: Time<T>) -> CartesianOrbit<T, O, R>

Interpolates the trajectory at the given absolute time.

Source

pub fn into_frame<R1, P>( self, frame: R1, provider: &P, ) -> Result<Trajectory<T, O, R1>, Box<dyn Error>>
where R1: ReferenceFrame + Copy, P: TryRotation<R, R1, T>,

Transforms the entire trajectory into a different reference frame.

Source

pub fn epoch(&self) -> Time<T>

Returns the reference epoch of the trajectory.

Source

pub fn origin(&self) -> O

Returns the central body origin.

Source

pub fn reference_frame(&self) -> R

Returns the reference frame.

Source

pub fn start_time(&self) -> Time<T>

Returns the start time of the trajectory (same as the epoch).

Source

pub fn end_time(&self) -> Time<T>

Returns the end time of the trajectory.

Source

pub fn times(&self) -> Vec<Time<T>>

Returns the absolute times of all data points in the trajectory.

Source

pub fn states(&self) -> Vec<CartesianOrbit<T, O, R>>

Returns all orbital states at the original data points.

Source

pub fn to_vec(&self) -> Vec<Vec<f64>>

Returns the trajectory as a vector of [t, x, y, z, vx, vy, vz] rows.

Source

pub fn interpolate(&self, dt: TimeDelta) -> CartesianOrbit<T, O, R>

Interpolates the trajectory at the given time delta from the epoch.

Source

pub fn interpolate_at(&self, time: Time<T>) -> CartesianOrbit<T, O, R>

Interpolates the trajectory at the given absolute time.

Source

pub fn position(&self, t: f64) -> DVec3

Returns the interpolated position at time t seconds from the epoch.

Source

pub fn velocity(&self, t: f64) -> DVec3

Returns the interpolated velocity at time t seconds from the epoch.

Source

pub fn find_events<F>( &self, func: F, step: TimeDelta, ) -> Result<Vec<Event<T>>, DetectError>
where F: Fn(CartesianOrbit<T, O, R>) -> f64,

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.

Source

pub fn try_find_events<F, E>( &self, func: F, step: TimeDelta, ) -> Result<Vec<Event<T>>, DetectError>
where F: Fn(CartesianOrbit<T, O, R>) -> Result<f64, E>, E: Error + Send + Sync + 'static,

Find zero-crossing events of a fallible func evaluated along this trajectory.

Source

pub fn find_windows<F>( &self, func: F, step: TimeDelta, ) -> Result<Vec<TimeInterval<T>>, DetectError>
where F: Fn(CartesianOrbit<T, O, R>) -> f64,

Find time intervals where func is positive, evaluated along this trajectory.

Source

pub fn try_find_windows<F, E>( &self, func: F, step: TimeDelta, ) -> Result<Vec<TimeInterval<T>>, DetectError>
where F: Fn(CartesianOrbit<T, O, R>) -> Result<f64, E>, E: Error + Send + Sync + 'static,

Find time intervals where a fallible func is positive, evaluated along this trajectory.

Source§

impl<T, O, R> Trajectory<T, O, R>

Source

pub fn into_dyn(self) -> DynTrajectory

Converts this trajectory into a dynamically-typed trajectory.

Source§

impl<T, O> Trajectory<T, O, Icrf>

Source

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>
where O: Origin + Copy, R: ReferenceFrame + Copy,

Source

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>

Source

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>

Source§

fn clone(&self) -> Trajectory<T, O, R>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + TimeScale, O: Debug + Origin, R: Debug + ReferenceFrame> Debug for Trajectory<T, O, R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T, O, R> FromIterator<Orbit<Cartesian, T, O, R>> for Trajectory<T, O, R>
where T: TimeScale + Copy, O: Origin + Copy, R: ReferenceFrame + Copy,

Source§

fn from_iter<U: IntoIterator<Item = CartesianOrbit<T, O, R>>>(iter: U) -> Self

Creates a value from an iterator. Read more
Source§

impl<T, O, R> Propagator<T, O> for Trajectory<T, O, R>

Source§

type Frame = R

The propagator’s native reference frame.
Source§

type Error = TrajectorError

The error type returned by propagation methods.
Source§

fn state_at( &self, time: Time<T>, ) -> Result<CartesianOrbit<T, O, R>, TrajectorError>

Evaluate the state at a single time.
Source§

fn propagate( &self, interval: TimeInterval<T>, ) -> Result<Trajectory<T, O, R>, Self::Error>

Propagate over the given interval in the native frame. The propagator chooses the time steps.
Source§

fn propagate_to( &self, times: impl IntoIterator<Item = Time<T>>, ) -> Result<Trajectory<T, O, Self::Frame>, Self::Error>
where Self::Error: From<TrajectorError>,

Propagate to an iterable of caller-chosen times.

Auto Trait Implementations§

§

impl<T, O, R> Freeze for Trajectory<T, O, R>
where O: Freeze, R: Freeze, T: Freeze,

§

impl<T, O, R> RefUnwindSafe for Trajectory<T, O, R>

§

impl<T, O, R> Send for Trajectory<T, O, R>
where O: Send, R: Send, T: Send,

§

impl<T, O, R> Sync for Trajectory<T, O, R>
where O: Sync, R: Sync, T: Sync,

§

impl<T, O, R> Unpin for Trajectory<T, O, R>
where O: Unpin, R: Unpin, T: Unpin,

§

impl<T, O, R> UnsafeUnpin for Trajectory<T, O, R>

§

impl<T, O, R> UnwindSafe for Trajectory<T, O, R>
where O: UnwindSafe, R: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.