Trait particular::Particle
source · [−]Expand description
Trait to describe a particle which consists of a position and a gravitational parameter mu.
Deriving:
Used in most cases, when your type has fields names position and mu
#[derive(Particle)]
pub struct Body {
position: Vec3,
mu: f32,
...
}Manual implementation:
Used when your type has more complex fields and cannot directly provide a position and a gravitational parameter.
impl Particle for Body {
fn position(&self) -> Vec3 {
self.position
}
fn mu(&self) -> f32 {
self.mass * G
}
}