Skip to main content

SpaceTimeVector4D

Struct SpaceTimeVector4D 

Source
pub struct SpaceTimeVector4D {
    pub t: f64,
    pub x: f64,
    pub y: f64,
    pub z: f64,
}

Fields§

§t: f64§x: f64§y: f64§z: f64

Implementations§

Source§

impl SpaceTimeVector4D

Source

pub const fn new(t: f64, x: f64, y: f64, z: f64) -> Self

Source

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.

Source

pub const fn components(&self) -> [f64; 4]

The components as [t, x, y, z].

Source

pub const fn spatial(&self) -> [f64; 3]

The spatial part [x, y, z].

Source

pub fn dot(&self, other: &Self) -> f64

The Minkowski inner product -t t' + x x' + y y' + z z'.

Source

pub fn interval_squared(&self) -> f64

The squared interval self · self: negative timelike, zero lightlike, positive spacelike.

Source

pub fn causality(&self, tol: f64) -> Causality

Classifies the vector, treating |interval²| <= tol as lightlike.

Source

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.

Source

pub fn proper_distance(&self) -> Option<f64>

The proper distance between events separated by this spacelike vector; None otherwise.

Source

pub fn spatial_norm(&self) -> f64

The Euclidean magnitude of the spatial part.

Source

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.

Source

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.

Source

pub fn transformed(&self, m: &[[f64; 4]; 4]) -> Self

Applies a 4×4 matrix to the components.

Source

pub fn boosted(&self, beta: [f64; 3]) -> Option<Self>

This vector as seen from a frame moving with velocity beta (units of c).

Source

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.

Source

pub fn rapidity(beta: f64) -> Option<f64>

The rapidity atanh(β) for motion along one axis; None if |beta| >= 1.

Source

pub fn add_collinear_velocities(u: f64, v: f64) -> f64

The relativistic composition of two collinear velocities (units of c).

Trait Implementations§

Source§

impl Add for SpaceTimeVector4D

Source§

type Output = SpaceTimeVector4D

The resulting type after applying the + operator.
Source§

fn add(self, o: Self) -> Self

Performs the + operation. Read more
Source§

impl Clone for SpaceTimeVector4D

Source§

fn clone(&self) -> Self

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 Copy for SpaceTimeVector4D

Source§

impl Debug for SpaceTimeVector4D

Source§

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

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

impl Default for SpaceTimeVector4D

Source§

fn default() -> Self

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

impl Mul<f64> for SpaceTimeVector4D

Source§

type Output = SpaceTimeVector4D

The resulting type after applying the * operator.
Source§

fn mul(self, s: f64) -> Self

Performs the * operation. Read more
Source§

impl Neg for SpaceTimeVector4D

Source§

type Output = SpaceTimeVector4D

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl PartialEq for SpaceTimeVector4D

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SpaceTimeVector4D

Source§

impl Sub for SpaceTimeVector4D

Source§

type Output = SpaceTimeVector4D

The resulting type after applying the - operator.
Source§

fn sub(self, o: Self) -> Self

Performs the - operation. 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> MaybeSerialize for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.