Expand description
Lorentz contraction and transformations.
Structs§
- Four
Vector - A four-vector in Minkowski spacetime with signature (+, -, -, -).
- Lorentz
Boost - Lorentz boost parameters.
- Lorentz
Contractor - Modifies entity visual scale based on velocity relative to observer. Contracts along the direction of motion by 1/gamma.
- Lorentz
Renderer - 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.