Skip to main content

KeplerOrbitDemo

Struct KeplerOrbitDemo 

Source
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: Vec2

Position vector (m).

§velocity: Vec2

Velocity vector (m/s).

§mu: f64

Gravitational parameter μ = GM (m³/s²).

§time: f64

Current simulation time (s).

§initial_energy: f64

Initial specific orbital energy.

§initial_angular_momentum: f64

Initial angular momentum magnitude.

§initial_semi_major_axis: f64

Initial semi-major axis.

§max_energy_drift: f64

Maximum energy drift observed.

§max_angular_momentum_drift: f64

Maximum angular momentum drift observed.

§step_count: u64

Number of steps taken.

§integrator: IntegratorType

Integrator type.

§energy_tolerance: f64

Energy conservation tolerance.

§angular_momentum_tolerance: f64

Angular momentum tolerance.

§period_tolerance: f64

Period tolerance.

§orbit_history: Vec<Vec2>

Position history for orbit plotting.

§max_history: usize

Maximum history length.

§perturbation_enabled: bool

Enable third body perturbation.

§perturber_position: Vec2

Third body position (if enabled).

§perturber_mu: f64

Third body mass parameter.

§seed: u64

Seed for reproducibility.

Implementations§

Source§

impl KeplerOrbitDemo

Source

pub fn new(seed: u64) -> Self

Create a new Kepler orbit demo (Earth-like orbit).

Source

pub fn with_eccentricity(seed: u64, eccentricity: f64) -> Self

Create orbit with specific eccentricity.

Source

pub fn specific_energy(&self) -> f64

Calculate specific orbital energy: E = v²/2 - μ/r.

Source

pub fn angular_momentum(&self) -> f64

Calculate angular momentum magnitude: L = |r × v|.

Source

pub fn semi_major_axis(&self) -> f64

Calculate semi-major axis: a = -μ/(2E).

Source

pub fn orbital_period(&self) -> f64

Calculate orbital period: T = 2π√(a³/μ).

Source

pub fn eccentricity(&self) -> f64

Calculate eccentricity.

Source

pub fn energy_drift(&self) -> f64

Get relative energy drift.

Source

pub fn angular_momentum_drift(&self) -> f64

Get relative angular momentum drift.

Source

pub fn set_perturbation(&mut self, enabled: bool)

Enable or disable perturbation.

Source

pub fn set_integrator(&mut self, integrator: IntegratorType)

Set integrator type.

Source

pub fn run_orbits(&mut self, num_orbits: f64, steps_per_orbit: usize)

Run simulation for given number of orbits.

Source

pub fn true_anomaly(&self) -> f64

Get current true anomaly (angle in orbit).

Trait Implementations§

Source§

impl Clone for KeplerOrbitDemo

Source§

fn clone(&self) -> KeplerOrbitDemo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KeplerOrbitDemo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for KeplerOrbitDemo

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for KeplerOrbitDemo

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl EddDemo for KeplerOrbitDemo

Source§

fn name(&self) -> &'static str

Demo name for display.
Source§

fn emc_ref(&self) -> &'static str

EMC reference path.
Source§

fn step(&mut self, dt: f64)

Advance the simulation by one timestep.
Source§

fn verify_equation(&self) -> bool

Check if the governing equation is currently verified.
Source§

fn get_falsification_status(&self) -> FalsificationStatus

Get the current falsification status.
Source§

fn reset(&mut self)

Reset the demo to initial conditions.
Source§

impl Serialize for KeplerOrbitDemo

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,