TangentSpacetime

Struct TangentSpacetime 

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

A 4D+4D spacetime model combining position and motion, with support for curved geometry.

TangentBundleSpacetime represents an event in spacetime along with its tangent vector (velocity or proper motion). It also carries an embedded metric tensor gᵤᵥ that defines the local geometry of spacetime, allowing for proper interval calculations in curved manifolds.

This model generalizes both flat Minkowski spacetime and dynamic curved spacetime (e.g., Schwarzschild or cosmological spacetimes) by exposing its metric via the MetricTensor4D trait, and supporting runtime updates via update_metric_tensor().

§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)
  • dt: Proper time velocity (usually 1.0)
  • dx, dy, dz: Spatial velocity components (in meters/second)
  • metric: Local 4×4 metric tensor defining the geometry

§Coordinate Index Mapping

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

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

§Curvature Support

The default metric is flat Minkowski (− + + +), but this can be replaced at runtime:

use deep_causality::*;

let mut s = TangentSpacetime::new(1, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0);

// Replace with a custom curved spacetime metric (e.g., anisotropic)
let warped = [
    [-8.98755179e16, 0.0, 0.0, 0.0],
    [0.0, 1.05, 0.0, 0.0],
    [0.0, 0.0, 0.95, 0.0],
    [0.0, 0.0, 0.0, 0.90],
];

s.update_metric_tensor(warped);
let s2 = TangentSpacetime::new(2, 2.0, 3.0, 4.0, 0.0, 1.0, 0.0, 0.0, 0.0);

let interval = s.interval_squared(&s2);
println!("Curved spacetime interval²: {interval}");

§References

  • J.M. Lee, Introduction to Smooth Manifolds, Springer, 2012 — Chapter 8: Tangent Bundles
  • R.M. Wald, General Relativity, University of Chicago Press, 1984 — Ch. 3: Curved Spacetime Geometry

§See also

  • SpacetimeInterval — for causal separation calculations
  • MetricTensor4D — for curvature configuration

Implementations§

Source§

impl TangentSpacetime

Source

pub fn x(&self) -> f64

Source

pub fn y(&self) -> f64

Source

pub fn z(&self) -> f64

Source

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

Returns position as [x, y, z]

Source

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

Returns velocity as [dt, dx, dy, dz]

Source

pub fn time_velocity(&self) -> f64

Returns the coordinate-time velocity (∂t/∂τ)

Source

pub fn spatial_velocity(&self) -> f64

Computes spatial velocity magnitude (ignoring dt)

Source

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

Returns 3D velocity vector

Source

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

Computes Euclidean spatial distance to another point

Source§

impl TangentSpacetime

Source

pub fn new( id: u64, x: f64, y: f64, z: f64, t: f64, dt: f64, dx: f64, dy: f64, dz: f64, ) -> Self

Create a new tangent bundle point with a default Minkowski metric.

Trait Implementations§

Source§

impl Adjustable<f64> for TangentSpacetime

Updates the position of the TangentSpacetime node. The metric tensor is updated via the ‘update_metric_tensor’ method.

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>

Adjust the position of the TangentSpacetime node. The metric tensor is updated via the ‘update_metric_tensor’ method.

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§

impl Clone for TangentSpacetime

Source§

fn clone(&self) -> TangentSpacetime

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 TangentSpacetime

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 TangentSpacetime

Source§

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

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

impl Display for TangentSpacetime

Source§

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

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

impl Identifiable for TangentSpacetime

Source§

fn id(&self) -> u64

Source§

impl MetricTensor4D for TangentSpacetime

Source§

fn metric_tensor(&self) -> [[f64; 4]; 4]

Returns the current local metric tensor gᵤᵥ.
Source§

fn update_metric_tensor(&mut self, new_metric: [[f64; 4]; 4])

Updates the internal metric tensor to a new 4×4 matrix. Read more
Source§

impl PartialEq for TangentSpacetime

Source§

fn eq(&self, other: &TangentSpacetime) -> 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 TangentSpacetime

Source§

fn t(&self) -> &f64

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

impl SpaceTemporalInterval for TangentSpacetime

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 TangentSpacetime

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 TangentSpacetime

Source§

impl Spatial<f64> for TangentSpacetime

Source§

impl StructuralPartialEq for TangentSpacetime

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.