Skip to main content

Module lorentz

Module lorentz 

Source
Expand description

Lorentz contraction and transformations.

Structs§

FourVector
A four-vector in Minkowski spacetime with signature (+, -, -, -).
LorentzBoost
Lorentz boost parameters.
LorentzContractor
Modifies entity visual scale based on velocity relative to observer. Contracts along the direction of motion by 1/gamma.
LorentzRenderer
Render objects with velocity-dependent squish along motion direction.

Functions§

boost
General Lorentz boost of a four-vector along an arbitrary velocity direction.
compose_collinear_boosts
Compose two boosts by adding rapidities (for collinear boosts).
contract_length
Length contraction: L = L_0 / gamma.
doppler_factor
Relativistic Doppler factor for radial motion.
four_momentum
Four-momentum from mass and 3-velocity. p^mu = (gammamc, gammamvx, gammamvy, gammamvz)
four_velocity
Four-velocity from 3-velocity.
invariant_mass
Invariant mass from energy and momentum: m^2 = E^2/c^4 - p^2/c^2. Returns the mass (taking sqrt, returns 0 for tachyonic cases).
is_lightlike
Check if a four-vector is lightlike/null (norm_sq ~ 0).
is_spacelike
Check if a four-vector is spacelike (norm_sq < 0).
is_timelike
Check if a four-vector is timelike (norm_sq > 0).
kinetic_energy
Compute the kinetic energy: KE = (gamma - 1) * m * c^2.
lorentz_factor
Compute the Lorentz factor gamma = 1 / sqrt(1 - v^2/c^2). Clamps v to be strictly less than c.
proper_time
Proper time: tau = t / gamma (coordinate time to proper time).
rapidity
Rapidity: phi = atanh(v/c).
relativistic_energy
Relativistic energy: E = gamma * m * c^2.
relativistic_momentum
Relativistic momentum magnitude: p = gamma * m * v.
velocity_addition
Relativistic velocity addition: w = (v1 + v2) / (1 + v1*v2/c^2).
velocity_from_rapidity
Convert between rapidity and velocity.