Skip to content

Commit

Permalink
Merge pull request #381 from gregjesl/impact_search
Browse files Browse the repository at this point in the history
Added template method for mean surface event
  • Loading branch information
ChristopherRabotin authored Dec 5, 2024
2 parents 5f964fc + 42d4220 commit 0f7d266
Showing 1 changed file with 7 additions and 0 deletions.
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

0 comments on commit 0f7d266

Please sign in to comment.