MinkowskiSpacetime

Struct MinkowskiSpacetime 

Source
pub struct MinkowskiSpacetime { /* private fields */ }
Expand description

A 4D spacetime context based on the Minkowski metric of special relativity.

MinkowskiSpacetime represents an event in flat spacetime using four real-valued coordinates: t (time) and x, y, z (space). It assumes a Minkowski metric signature (−+++), and enables interval calculations according to:

s² = −c²·Δt² + Δx² + Δy² + Δz²

This allows precise modeling of:

  • Time-like, space-like, and light-like (null) separations
  • Proper time and relativistic intervals
  • Special relativistic propagation constraints

§Fields

  • id: Unique numeric identifier
  • x: X-coordinate in meters
  • y: Y-coordinate in meters
  • z: Z-coordinate in meters
  • t: time (e.g., seconds)
  • time_scale: Time scale unit (e.g., microseconds, milliseconds)

§Coordinate Index Mapping

When used with the Coordinate trait, the following index mapping applies:

  • 0 => x
  • 1 => y
  • 2 => z
  • 3 => t

§Common Applications

  • Relativistic simulation
  • Causal propagation with light cones
  • Quantum field theory spacetime diagrams

§Example

use deep_causality::*;

let e1 = MinkowskiSpacetime::new(1, 1.0, 0.0, 0.0, 0.0, TimeScale::Second);
let e2 = MinkowskiSpacetime::new(2, 3.0, 3.0, 4.0, 1.0, TimeScale::Second);

let s2 = e1.interval_squared(&e2);
println!("s² = {}", s2);
assert!(s2 < 0.0); // time-like interval

Implementations§

Source§

impl MinkowskiSpacetime

Source

pub fn x(&self) -> f64

Source

pub fn y(&self) -> f64

Source

pub fn z(&self) -> f64

Source§

impl MinkowskiSpacetime

Source

pub fn new( id: u64, x: f64, y: f64, z: f64, t: f64, time_scale: TimeScale, ) -> Self

Trait Implementations§

Source§

impl Adjustable<f64> for MinkowskiSpacetime

Source§

fn update<const W: usize, const H: usize, const D: usize, const C: usize>( &mut self, array_grid: &ArrayGrid<f64, W, H, D, C>, ) -> Result<(), UpdateError>

The default implementation does nothing to keep update optional. Override this method to implement a node update when needed. For a sample implementation, see src/types/context_types/node_types_adjustable
Source§

fn adjust<const W: usize, const H: usize, const D: usize, const C: usize>( &mut self, array_grid: &ArrayGrid<f64, W, H, D, C>, ) -> Result<(), AdjustmentError>

The default implementation does nothing to keep adjustment optional. Override this method to implement a node adjustment when needed. Depending on the type of node adjustment, select a 1, 2,3, or 4 dimensional array grid that contains the transformation data to apply to the node. For a sample implementation, see src/types/context_types/node_types_adjustable
Source§

impl Clone for MinkowskiSpacetime

Source§

fn clone(&self) -> MinkowskiSpacetime

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Coordinate<f64> for MinkowskiSpacetime

Source§

fn dimension(&self) -> usize

Returns the number of dimensions in the coordinate system (always 4).

Source§

fn coordinate(&self, index: usize) -> Result<&f64, IndexError>

Returns a reference to the coordinate value at the specified index.

§Index Mapping
  • 0 => x
  • 1 => y
  • 2 => z
  • 3 => t
§Errors

Returns IndexError if the index is out of bounds.

Source§

impl Debug for MinkowskiSpacetime

Source§

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

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

impl Display for MinkowskiSpacetime

Source§

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

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

impl Identifiable for MinkowskiSpacetime

Source§

fn id(&self) -> u64

Source§

impl PartialEq for MinkowskiSpacetime

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl SpaceTemporal<f64, f64> for MinkowskiSpacetime

Source§

fn t(&self) -> &f64

Returns the value associated with the temporal (4th) dimension.
Source§

impl SpaceTemporalInterval for MinkowskiSpacetime

Source§

fn time(&self) -> f64

Returns the time coordinate in seconds.
Source§

fn position(&self) -> [f64; 3]

Returns the spatial coordinates [x, y, z] in meters.
Source§

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

Computes the squared Minkowski interval between self and other. Read more
Source§

impl Temporal<f64> for MinkowskiSpacetime

Source§

fn time_scale(&self) -> TimeScale

Returns the unit scale of time (e.g. TimeScale::Milliseconds).
Source§

fn time_unit(&self) -> f64

Returns a reference to the numeric time unit (e.g. 0, 100, 32768).
Source§

impl Copy for MinkowskiSpacetime

Source§

impl Spatial<f64> for MinkowskiSpacetime

Source§

impl StructuralPartialEq for MinkowskiSpacetime

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.