pub struct KeplerOrbitDemo {Show 20 fields
pub position: Vec2,
pub velocity: Vec2,
pub mu: f64,
pub time: f64,
pub initial_energy: f64,
pub initial_angular_momentum: f64,
pub initial_semi_major_axis: f64,
pub max_energy_drift: f64,
pub max_angular_momentum_drift: f64,
pub step_count: u64,
pub integrator: IntegratorType,
pub energy_tolerance: f64,
pub angular_momentum_tolerance: f64,
pub period_tolerance: f64,
pub orbit_history: Vec<Vec2>,
pub max_history: usize,
pub perturbation_enabled: bool,
pub perturber_position: Vec2,
pub perturber_mu: f64,
pub seed: u64,
/* private fields */
}Expand description
Kepler Orbit demo state.
Fields§
§position: Vec2Position vector (m).
velocity: Vec2Velocity vector (m/s).
mu: f64Gravitational parameter μ = GM (m³/s²).
time: f64Current simulation time (s).
initial_energy: f64Initial specific orbital energy.
initial_angular_momentum: f64Initial angular momentum magnitude.
initial_semi_major_axis: f64Initial semi-major axis.
max_energy_drift: f64Maximum energy drift observed.
max_angular_momentum_drift: f64Maximum angular momentum drift observed.
step_count: u64Number of steps taken.
integrator: IntegratorTypeIntegrator type.
energy_tolerance: f64Energy conservation tolerance.
angular_momentum_tolerance: f64Angular momentum tolerance.
period_tolerance: f64Period tolerance.
orbit_history: Vec<Vec2>Position history for orbit plotting.
max_history: usizeMaximum history length.
perturbation_enabled: boolEnable third body perturbation.
perturber_position: Vec2Third body position (if enabled).
perturber_mu: f64Third body mass parameter.
seed: u64Seed for reproducibility.
Implementations§
Source§impl KeplerOrbitDemo
impl KeplerOrbitDemo
Sourcepub fn with_eccentricity(seed: u64, eccentricity: f64) -> Self
pub fn with_eccentricity(seed: u64, eccentricity: f64) -> Self
Create orbit with specific eccentricity.
Sourcepub fn specific_energy(&self) -> f64
pub fn specific_energy(&self) -> f64
Calculate specific orbital energy: E = v²/2 - μ/r.
Sourcepub fn angular_momentum(&self) -> f64
pub fn angular_momentum(&self) -> f64
Calculate angular momentum magnitude: L = |r × v|.
Sourcepub fn semi_major_axis(&self) -> f64
pub fn semi_major_axis(&self) -> f64
Calculate semi-major axis: a = -μ/(2E).
Sourcepub fn orbital_period(&self) -> f64
pub fn orbital_period(&self) -> f64
Calculate orbital period: T = 2π√(a³/μ).
Sourcepub fn eccentricity(&self) -> f64
pub fn eccentricity(&self) -> f64
Calculate eccentricity.
Sourcepub fn energy_drift(&self) -> f64
pub fn energy_drift(&self) -> f64
Get relative energy drift.
Sourcepub fn angular_momentum_drift(&self) -> f64
pub fn angular_momentum_drift(&self) -> f64
Get relative angular momentum drift.
Sourcepub fn set_perturbation(&mut self, enabled: bool)
pub fn set_perturbation(&mut self, enabled: bool)
Enable or disable perturbation.
Sourcepub fn set_integrator(&mut self, integrator: IntegratorType)
pub fn set_integrator(&mut self, integrator: IntegratorType)
Set integrator type.
Sourcepub fn run_orbits(&mut self, num_orbits: f64, steps_per_orbit: usize)
pub fn run_orbits(&mut self, num_orbits: f64, steps_per_orbit: usize)
Run simulation for given number of orbits.
Sourcepub fn true_anomaly(&self) -> f64
pub fn true_anomaly(&self) -> f64
Get current true anomaly (angle in orbit).
Trait Implementations§
Source§impl Clone for KeplerOrbitDemo
impl Clone for KeplerOrbitDemo
Source§fn clone(&self) -> KeplerOrbitDemo
fn clone(&self) -> KeplerOrbitDemo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more