pub struct Position {
pub x: Real,
pub y: Real,
pub z: Real,
}Expand description
A 3-dimensional position vector expressed in Cartesian coordinates (x, y, z) with units of meters (SI).
This type is designed for high-precision relativistic calculations in space navigation, deep-space tracking, and interplanetary timing. Positions are typically expressed in a heliocentric (Sun-centered) reference frame because the dominant gravitational light-time correction—the Shapiro delay—is calculated with respect to the Sun.
Fields§
§x: Real§y: Real§z: RealImplementations§
Source§impl Position
impl Position
Sourcepub const ZERO: Self
pub const ZERO: Self
The zero vector, representing the origin of the coordinate system (commonly the center of the Sun).
Sourcepub const fn new(x: Real, y: Real, z: Real) -> Self
pub const fn new(x: Real, y: Real, z: Real) -> Self
Creates a new Position directly from its Cartesian components in meters.
Sourcepub const fn from_au(x: Real, y: Real, z: Real) -> Self
pub const fn from_au(x: Real, y: Real, z: Real) -> Self
Creates a Position from coordinates expressed in Astronomical Units (AU),
converting them to meters using the IAU 2012 definition
(1 AU = 149 597 870 700 m).
Especially convenient when working with planetary ephemerides or solar-system models that are natively given in AU.
Sourcepub const fn norm(self) -> Real
pub const fn norm(self) -> Real
Returns the Euclidean norm (straight-line distance) of this position from the origin.
When the position is Sun-centered, this is the radial distance from the Sun required for Shapiro-delay calculations.
Sourcepub const fn distance_to(self, other: Self) -> Real
pub const fn distance_to(self, other: Self) -> Real
Computes the straight-line (Euclidean) distance between this position and
another Position.
Together with the two radial distances from the Sun, this value supplies the three geometric inputs needed to evaluate the Shapiro delay.
Sourcepub const fn lerp(self, other: Self, t: Real) -> Self
pub const fn lerp(self, other: Self, t: Real) -> Self
Returns a new position that lies a fraction t of the way along the straight
line between self and other.
This is known as linear interpolation (lerp). It is most commonly used when
you need to generate evenly spaced sample points along a path — for example,
when building the samples slice for [ObserverState::one_way_relativistic_delay_integrated].
§Parameters
other– the ending positiont– interpolation parameter (0.0 = start point, 1.0 = end point). Values outside [0, 1] are allowed and will extrapolate.
§Examples
use deep_time::Position;
let a = Position::new(0.0, 0.0, 0.0);
let b = Position::new(10.0, 20.0, 30.0);
let midpoint = a.lerp(b, 0.5); // (5.0, 10.0, 15.0)
let quarter = a.lerp(b, 0.25); // (2.5, 5.0, 7.5)
let beyond = a.lerp(b, 1.5); // (15.0, 30.0, 45.0)