pub struct EclipseEngine<B> { /* private fields */ }Expand description
Searches for global/geocentric eclipses over a chosen EphemerisBackend.
Backed by the packaged data, results are valid only within the
1900-01-01..2100-01-01 window (see crate); out-of-window requests fail
closed with EclipseError::OutOfWindow.
Implementations§
Source§impl<B: EphemerisBackend> EclipseEngine<B>
impl<B: EphemerisBackend> EclipseEngine<B>
Sourcepub fn eclipses_in_range(
&self,
start: Instant,
end: Instant,
filter: EclipseFilter,
) -> Result<Vec<Eclipse>, EclipseError>
pub fn eclipses_in_range( &self, start: Instant, end: Instant, filter: EclipseFilter, ) -> Result<Vec<Eclipse>, EclipseError>
Returns every eclipse admitted by filter with greatest eclipse in
[start, end] (both bounds inclusive), in chronological order. Fails
closed if either bound is outside the supported window.
Selection is by the greatest-eclipse instant, not by the new/full moon that precedes or follows it by minutes, and that instant does not depend on the range searched. Adjacent ranges that meet at an instant therefore partition the eclipses between them, except that an eclipse whose greatest instant falls exactly on the shared bound appears in both.
Sourcepub fn next_eclipse(
&self,
after: Instant,
filter: EclipseFilter,
) -> Result<Option<Eclipse>, EclipseError>
pub fn next_eclipse( &self, after: Instant, filter: EclipseFilter, ) -> Result<Option<Eclipse>, EclipseError>
Returns the first eclipse admitted by filter whose greatest eclipse is
strictly after after, or None if none remains before the window end.
Fails closed if after is outside the supported window.
The cost grows with the distance to the eclipse found, not to the window end.
Sourcepub fn previous_eclipse(
&self,
before: Instant,
filter: EclipseFilter,
) -> Result<Option<Eclipse>, EclipseError>
pub fn previous_eclipse( &self, before: Instant, filter: EclipseFilter, ) -> Result<Option<Eclipse>, EclipseError>
Returns the last eclipse admitted by filter whose greatest eclipse is
strictly before before, or None if none exists after the window start.
Fails closed if before is outside the supported window.
The cost grows with the distance to the eclipse found, not to the window start.
Sourcepub fn local_circumstances(
&self,
eclipse: &Eclipse,
observer: &ObserverLocation,
atmosphere: Atmosphere,
) -> Result<LocalCircumstances, EclipseError>
pub fn local_circumstances( &self, eclipse: &Eclipse, observer: &ObserverLocation, atmosphere: Atmosphere, ) -> Result<LocalCircumstances, EclipseError>
Local (per-observer) circumstances for an already-found eclipse.
Returns full circumstances even when the eclipse is not visible from
observer (all contacts below the horizon); inspect any_phase_visible
(via the returned variant) to test visibility. Solar contact instants are
observer-dependent (topocentric); lunar contact instants are global with
per-observer visibility.
atmosphere is pleiades_apparent::Atmosphere from the
pleiades-apparent release this crate pins (0.7 and later); build it
from that same release.
Sourcepub fn next_local_eclipse(
&self,
after: Instant,
observer: &ObserverLocation,
filter: EclipseFilter,
atmosphere: Atmosphere,
) -> Result<Option<(Eclipse, LocalCircumstances)>, EclipseError>
pub fn next_local_eclipse( &self, after: Instant, observer: &ObserverLocation, filter: EclipseFilter, atmosphere: Atmosphere, ) -> Result<Option<(Eclipse, LocalCircumstances)>, EclipseError>
The next eclipse admitted by filter, strictly after after, that is
locally visible from observer (any phase above the horizon), paired with
its local circumstances. Walks the global next_eclipse sequence and
returns the first locally-visible one, so the result is a strict refinement
of the global engine.
Sourcepub fn previous_local_eclipse(
&self,
before: Instant,
observer: &ObserverLocation,
filter: EclipseFilter,
atmosphere: Atmosphere,
) -> Result<Option<(Eclipse, LocalCircumstances)>, EclipseError>
pub fn previous_local_eclipse( &self, before: Instant, observer: &ObserverLocation, filter: EclipseFilter, atmosphere: Atmosphere, ) -> Result<Option<(Eclipse, LocalCircumstances)>, EclipseError>
The previous eclipse admitted by filter, strictly before before, that
is locally visible from observer, paired with its local circumstances.