Skip to content

Commit 0f7d266

Browse files
Merge pull request #381 from gregjesl/impact_search
Added template method for mean surface event
2 parents 5f964fc + 42d4220 commit 0f7d266

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/md/events/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use crate::linalg::DefaultAllocator;
2626
use crate::time::{Duration, Unit};
2727
use crate::State;
2828
use anise::prelude::{Almanac, Frame};
29+
use anise::structure::planetocentric::ellipsoid::Ellipsoid;
2930
#[cfg(feature = "python")]
3031
use pyo3::prelude::*;
3132
use std::default::Default;
@@ -154,6 +155,12 @@ impl Event {
154155
Self::new(StateParameter::Apoapsis, 180.0)
155156
}
156157

158+
/// Match the central body's mean equatorial radius.
159+
/// This is useful for detecting when an object might impact the central body.
160+
pub fn mean_surface(body: &Ellipsoid) -> Self {
161+
Self::new(StateParameter::Rmag, body.mean_equatorial_radius_km())
162+
}
163+
157164
/// Match a specific event in another frame, using the default epoch precision and value.
158165
pub fn in_frame(parameter: StateParameter, desired_value: f64, target_frame: Frame) -> Self {
159166
warn!("Searching for an event in another frame is slow: you should instead convert the trajectory into that other frame");

0 commit comments

Comments
 (0)