Skip to main content

IntegOrigin

Struct IntegOrigin 

Source
pub struct IntegOrigin {
    pub position: Qty3<dyn Dimension<Th = Z0, I = Z0, Kind = dyn Kind, M = Z0, L = PInt<UInt<UTerm, B1>>, J = Z0, N = Z0, T = Z0>, RootInertial>,
    pub velocity: Qty3<dyn Dimension<Th = Z0, I = Z0, Kind = dyn Kind, M = Z0, L = PInt<UInt<UTerm, B1>>, J = Z0, N = Z0, T = NInt<UInt<UTerm, B1>>>, RootInertial>,
}
Expand description

The integration-frame origin: position and velocity of the integration-frame origin expressed in root-inertial coordinates.

Construct from the runner’s frame-tree state. IntegOrigin::zero() is used when the body integrates in the root frame, so the shift is a no-op.

§RF.10 structural guard

Position<IntegrationFrame> and Position<RootInertial> are kind-distinct frames: the only Sub/Add impls require CompatibleFrames<F, F>, so subtracting one from the other is a compile error. The reviewer-flagged bug shape from PR #258 — mixing integration-frame body state with root-inertial source positions — cannot recur silently.

Position<IntegrationFrame> - Position<RootInertial> does not compile:

use astrodyn_quantities::prelude::*;
let body: Position<IntegrationFrame> = Position::zero();
let sun: Position<RootInertial> = Position::zero();
// Frames mismatch — `CompatibleFrames<IntegrationFrame, RootInertial>` unimplemented:
let _bug = body - sun;

Adding them does not compile either:

use astrodyn_quantities::prelude::*;
let body: Position<IntegrationFrame> = Position::zero();
let sun: Position<RootInertial> = Position::zero();
let _bug = body + sun;

Cross-assignment refuses:

use astrodyn_quantities::prelude::*;
let body: Position<IntegrationFrame> = Position::zero();
let _bug: Position<RootInertial> = body;   // not the same type

The only way through is the typed shift — shift_position for step-constant or shift_position_at_stage for stage-time-interpolated:

use astrodyn_quantities::prelude::*;
let o = IntegOrigin::zero();
let body: Position<IntegrationFrame> = Position::zero();
let body_root: Position<RootInertial> = o.shift_position(body);
let sun: Position<RootInertial> = Position::zero();
let sun_to_vehicle: Position<RootInertial> = body_root - sun;   // OK

Fields§

§position: Qty3<dyn Dimension<Th = Z0, I = Z0, Kind = dyn Kind, M = Z0, L = PInt<UInt<UTerm, B1>>, J = Z0, N = Z0, T = Z0>, RootInertial>

Position of the integration-frame origin in root-inertial coordinates.

§velocity: Qty3<dyn Dimension<Th = Z0, I = Z0, Kind = dyn Kind, M = Z0, L = PInt<UInt<UTerm, B1>>, J = Z0, N = Z0, T = NInt<UInt<UTerm, B1>>>, RootInertial>

Velocity of the integration-frame origin in root-inertial coordinates.

Implementations§

Source§

impl IntegOrigin

Source

pub fn zero() -> IntegOrigin

The zero offset — used when the integration frame coincides with the root inertial frame.

Source

pub fn shift_position( &self, p: Qty3<dyn Dimension<Th = Z0, I = Z0, Kind = dyn Kind, M = Z0, L = PInt<UInt<UTerm, B1>>, J = Z0, N = Z0, T = Z0>, IntegrationFrame>, ) -> Qty3<dyn Dimension<Th = Z0, I = Z0, Kind = dyn Kind, M = Z0, L = PInt<UInt<UTerm, B1>>, J = Z0, N = Z0, T = Z0>, RootInertial>

Shift a position from the integration frame to root inertial by adding the origin’s root-inertial position.

Source

pub fn shift_velocity( &self, v: Qty3<dyn Dimension<Th = Z0, I = Z0, Kind = dyn Kind, M = Z0, L = PInt<UInt<UTerm, B1>>, J = Z0, N = Z0, T = NInt<UInt<UTerm, B1>>>, IntegrationFrame>, ) -> Qty3<dyn Dimension<Th = Z0, I = Z0, Kind = dyn Kind, M = Z0, L = PInt<UInt<UTerm, B1>>, J = Z0, N = Z0, T = NInt<UInt<UTerm, B1>>>, RootInertial>

Shift a velocity from the integration frame to root inertial by adding the origin’s root-inertial velocity.

Source

pub fn shift_position_at_stage( &self, p: Qty3<dyn Dimension<Th = Z0, I = Z0, Kind = dyn Kind, M = Z0, L = PInt<UInt<UTerm, B1>>, J = Z0, N = Z0, T = Z0>, IntegrationFrame>, stage_dt: f64, ) -> Qty3<dyn Dimension<Th = Z0, I = Z0, Kind = dyn Kind, M = Z0, L = PInt<UInt<UTerm, B1>>, J = Z0, N = Z0, T = Z0>, RootInertial>

Stage-time-interpolated shift to root inertial.

Used inside RK4 derivative closures where the intermediate position is sampled at time_frac * dt into the step. The integration-frame origin itself moves under its own velocity, so the stage-time shift is origin.position + origin.velocity * stage_dt (linear interpolation; matches the arithmetic used by the runner’s gravity stage closure, RF.10). For integration-frames at rest in root, this collapses to the step-constant shift_position.

Trait Implementations§

Source§

impl Clone for IntegOrigin

Source§

fn clone(&self) -> IntegOrigin

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for IntegOrigin

Source§

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

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

impl Default for IntegOrigin

Source§

fn default() -> IntegOrigin

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

impl Copy for IntegOrigin

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> 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.