Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added template method for mean surface event #381

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/md/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use crate::linalg::DefaultAllocator;
use crate::time::{Duration, Unit};
use crate::State;
use anise::prelude::{Almanac, Frame};
use anise::structure::planetocentric::ellipsoid::Ellipsoid;
#[cfg(feature = "python")]
use pyo3::prelude::*;
use std::default::Default;
Expand Down Expand Up @@ -154,6 +155,12 @@ impl Event {
Self::new(StateParameter::Apoapsis, 180.0)
}

/// Match the central body's mean equatorial radius.
/// This is useful for detecting when an object might impact the central body.
pub fn mean_surface(body: &Ellipsoid) -> Self {
Self::new(StateParameter::Rmag, body.mean_equatorial_radius_km())
}

/// Match a specific event in another frame, using the default epoch precision and value.
pub fn in_frame(parameter: StateParameter, desired_value: f64, target_frame: Frame) -> Self {
warn!("Searching for an event in another frame is slow: you should instead convert the trajectory into that other frame");
Expand Down
Loading