Skip to main content

Ephemeris

Struct Ephemeris 

Source
pub struct Ephemeris { /* private fields */ }
Expand description

Owned ASSIST ephemeris data. Freed on drop.

Read-only after creation — safe to share across threads.

Implementations§

Source§

impl Ephemeris

Source

pub fn from_paths(planets: &Path, asteroids: &Path) -> Result<Self>

Load ephemeris from SPK files.

Source

pub fn as_ptr(&self) -> *const assist_ephem

Raw pointer to the underlying assist_ephem. Useful for direct FFI calls.

Returns a *const pointer because Ephemeris implements Sync on the premise that the underlying data is read-only after construction. Call .cast_mut() at the call site if the target FFI signature requires *mut; that cast is the caller’s assertion of unique access.

Source

pub fn jd_ref(&self) -> f64

Reference Julian date for the ephemeris (typically 2451545.0 = J2000.0 TDB).

Source

pub fn set_jd_ref(&mut self, jd: f64)

Override the reference Julian date.

Requires &mut self, which prevents concurrent mutation when the Ephemeris is shared across threads via Arc. Must be called before any AssistSim is attached.

Source

pub fn c_au_per_day(&self) -> f64

Speed of light in AU/day.

Source

pub fn mjd_to_assist_time(&self, mjd_tdb: f64) -> f64

Convert MJD TDB to ASSIST simulation time (days from jd_ref).

ASSIST stores times as days offset from the ephemeris reference JD, where JD = MJD + 2_400_000.5.

Source

pub fn earth_radius_au(&self) -> f64

Earth equatorial radius in AU.

Source

pub fn emrat(&self) -> f64

Earth/Moon mass ratio.

Source

pub fn get_body_state(&self, body_id: i32, t: f64) -> Result<reb_particle>

Get a solar system body’s state at time t (days from jd_ref).

Source

pub fn get_body_state_array(&self, body_id: i32, t: f64) -> Result<[f64; 6]>

Get a solar system body’s 6-element state [x, y, z, vx, vy, vz] at time t (days from jd_ref). Convenience over Self::get_body_state when the caller only needs the kinematic state, not the full reb_particle (mass, hash, etc.).

Trait Implementations§

Source§

impl Drop for Ephemeris

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for Ephemeris

Source§

impl Sync for Ephemeris

Auto Trait Implementations§

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> 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, 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.