pub struct NBodyState {
pub bodies: Vec<OrbitBody>,
pub time: OrbitTime,
/* private fields */
}Expand description
N-body gravitational system state.
Fields§
§bodies: Vec<OrbitBody>§time: OrbitTimeImplementations§
Source§impl NBodyState
impl NBodyState
Sourcepub fn new(bodies: Vec<OrbitBody>, softening: f64) -> Self
pub fn new(bodies: Vec<OrbitBody>, softening: f64) -> Self
Create a new N-body state with optional softening parameter.
Sourcepub fn num_bodies(&self) -> usize
pub fn num_bodies(&self) -> usize
Number of bodies in the system.
Sourcepub fn kinetic_energy(&self) -> f64
pub fn kinetic_energy(&self) -> f64
Calculate total kinetic energy.
Sourcepub fn potential_energy(&self) -> f64
pub fn potential_energy(&self) -> f64
Calculate total potential energy.
Sourcepub fn total_energy(&self) -> f64
pub fn total_energy(&self) -> f64
Calculate total mechanical energy.
Sourcepub fn angular_momentum(&self) -> (f64, f64, f64)
pub fn angular_momentum(&self) -> (f64, f64, f64)
Calculate total angular momentum vector (Lx, Ly, Lz).
Sourcepub fn angular_momentum_magnitude(&self) -> f64
pub fn angular_momentum_magnitude(&self) -> f64
Calculate angular momentum magnitude.
Sourcepub fn min_separation(&self) -> f64
pub fn min_separation(&self) -> f64
Get minimum pairwise separation between bodies.
Trait Implementations§
Source§impl Clone for NBodyState
impl Clone for NBodyState
Source§fn clone(&self) -> NBodyState
fn clone(&self) -> NBodyState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NBodyState
impl RefUnwindSafe for NBodyState
impl Send for NBodyState
impl Sync for NBodyState
impl Unpin for NBodyState
impl UnsafeUnpin for NBodyState
impl UnwindSafe for NBodyState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more