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 typeThe 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; // OKFields§
§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
impl IntegOrigin
Sourcepub fn zero() -> IntegOrigin
pub fn zero() -> IntegOrigin
The zero offset — used when the integration frame coincides with the root inertial frame.
Sourcepub 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>
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.
Sourcepub 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>
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.
Sourcepub 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>
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
impl Clone for IntegOrigin
Source§fn clone(&self) -> IntegOrigin
fn clone(&self) -> IntegOrigin
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more