pub struct SpaceTimeVector4D {
pub t: f64,
pub x: f64,
pub y: f64,
pub z: f64,
}Fields§
§t: f64§x: f64§y: f64§z: f64Implementations§
Source§impl SpaceTimeVector4D
impl SpaceTimeVector4D
pub const fn new(t: f64, x: f64, y: f64, z: f64) -> Self
Sourcepub fn from_time(time: f64, c: f64, x: f64, y: f64, z: f64) -> Self
pub fn from_time(time: f64, c: f64, x: f64, y: f64, z: f64) -> Self
From a time in seconds (or any unit) and speed of light c in length-per-time units.
Sourcepub const fn components(&self) -> [f64; 4]
pub const fn components(&self) -> [f64; 4]
The components as [t, x, y, z].
Sourcepub fn interval_squared(&self) -> f64
pub fn interval_squared(&self) -> f64
The squared interval self · self: negative timelike, zero lightlike, positive spacelike.
Sourcepub fn causality(&self, tol: f64) -> Causality
pub fn causality(&self, tol: f64) -> Causality
Classifies the vector, treating |interval²| <= tol as lightlike.
Sourcepub fn proper_time(&self) -> Option<f64>
pub fn proper_time(&self) -> Option<f64>
The proper time (as c·τ length) between two events separated by this timelike vector;
None if the separation is not timelike.
Sourcepub fn proper_distance(&self) -> Option<f64>
pub fn proper_distance(&self) -> Option<f64>
The proper distance between events separated by this spacelike vector; None otherwise.
Sourcepub fn spatial_norm(&self) -> f64
pub fn spatial_norm(&self) -> f64
The Euclidean magnitude of the spatial part.
Sourcepub fn gamma(beta: [f64; 3]) -> Option<f64>
pub fn gamma(beta: [f64; 3]) -> Option<f64>
The Lorentz factor 1 / sqrt(1 - β²) for a velocity beta (units of c); None if
|beta| >= 1.
Sourcepub fn boost_matrix(beta: [f64; 3]) -> Option<[[f64; 4]; 4]>
pub fn boost_matrix(beta: [f64; 3]) -> Option<[[f64; 4]; 4]>
The 4×4 matrix (rows/columns ordered t, x, y, z) of the boost to a frame moving with
velocity beta (units of c) relative to the current one: components of a vector in the
current frame map to its components in the moving frame. None if |beta| >= 1.
Sourcepub fn transformed(&self, m: &[[f64; 4]; 4]) -> Self
pub fn transformed(&self, m: &[[f64; 4]; 4]) -> Self
Applies a 4×4 matrix to the components.
Sourcepub fn boosted(&self, beta: [f64; 3]) -> Option<Self>
pub fn boosted(&self, beta: [f64; 3]) -> Option<Self>
This vector as seen from a frame moving with velocity beta (units of c).
Sourcepub fn four_velocity(beta: [f64; 3]) -> Option<Self>
pub fn four_velocity(beta: [f64; 3]) -> Option<Self>
The four-velocity γ (1, v) of a particle with 3-velocity beta (units of c); its
interval is always -1. None if |beta| >= 1.
Sourcepub fn rapidity(beta: f64) -> Option<f64>
pub fn rapidity(beta: f64) -> Option<f64>
The rapidity atanh(β) for motion along one axis; None if |beta| >= 1.
Sourcepub fn add_collinear_velocities(u: f64, v: f64) -> f64
pub fn add_collinear_velocities(u: f64, v: f64) -> f64
The relativistic composition of two collinear velocities (units of c).