Struct nalgebra_spacetime::MomentumN
source · pub struct MomentumN<N, D>{ /* private fields */ }
Expand description
Momentum in $n$-dimensional Lorentzian space $\R^{-,+} = \R^{1,n-1}$.
Assuming unit system with speed of light $c=1$ and rest mass $m$ as timelike norm in spacelike sign convention as in:
$$ m^2=E^2-\vec {p}^2=-p_\mu p^\mu $$
Where $p^\mu$ is the $n$-momentum with energy $E$ as temporal $p^0$ and momentum $\vec p$ as spatial $p^i$ components:
$$ p^\mu = m u^\mu = m \begin{pmatrix} \gamma \\ \gamma \vec \beta \end{pmatrix} = \begin{pmatrix} \gamma m = E \\ \gamma m \vec \beta = \vec p \end{pmatrix} $$
With $n$-velocity $u^\mu$, Lorentz factor $\gamma$, and velocity ratio $\vec \beta$.
Implementations§
source§impl<N, D> MomentumN<N, D>
impl<N, D> MomentumN<N, D>
sourcepub fn from_split(energy: &N, momentum: &OVector<N, DimNameDiff<D, U1>>) -> Selfwhere
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
<DefaultAllocator as Allocator<N, D, U1>>::Buffer: StorageMut<N, D, U1, RStride = U1, CStride = D>,
pub fn from_split(energy: &N, momentum: &OVector<N, DimNameDiff<D, U1>>) -> Selfwhere
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
<DefaultAllocator as Allocator<N, D, U1>>::Buffer: StorageMut<N, D, U1, RStride = U1, CStride = D>,
Momentum with spacetime LorentzianN::split
, energy
$E$ and
momentum
$\vec p$.
sourcepub fn from_mass_at_velocity(mass: N, velocity: OVector<N, D>) -> Self
pub fn from_mass_at_velocity(mass: N, velocity: OVector<N, D>) -> Self
Momentum $p^\mu=m u^\mu$ with rest mass
$m$ at velocity
$u^\mu$.
sourcepub fn from_mass_in_frame(mass: N, frame: &FrameN<N, D>) -> Self
pub fn from_mass_in_frame(mass: N, frame: &FrameN<N, D>) -> Self
Momentum $p^\mu$ with rest mass
$m$ in frame
.
Equals frame.velocity() * mass
.
sourcepub fn from_mass_at_rest(mass: N) -> Self
pub fn from_mass_at_rest(mass: N) -> Self
Momentum $p^\mu$ with rest mass
$m$ in center-of-momentum frame.
sourcepub fn mass(&self) -> N
pub fn mass(&self) -> N
Rest mass $m$ as timelike norm $\sqrt{-p_\mu p^\mu}$ in spacelike sign convention.
sourcepub fn velocity(&self) -> OVector<N, D>
pub fn velocity(&self) -> OVector<N, D>
Velocity $u^\mu$ as momentum $p^\mu$ divided by rest mass()
$m$.
sourcepub fn energy(&self) -> &N
pub fn energy(&self) -> &N
Energy $E$ as LorentzianN::temporal
component.
sourcepub fn momentum(&self) -> VectorView<'_, N, DimNameDiff<D, U1>, U1, D>where
DefaultAllocator: Allocator<N, D, U1>,
<DefaultAllocator as Allocator<N, D, U1>>::Buffer: Storage<N, D, U1, RStride = U1, CStride = D>,
pub fn momentum(&self) -> VectorView<'_, N, DimNameDiff<D, U1>, U1, D>where
DefaultAllocator: Allocator<N, D, U1>,
<DefaultAllocator as Allocator<N, D, U1>>::Buffer: Storage<N, D, U1, RStride = U1, CStride = D>,
Momentum $\vec p$ as LorentzianN::spatial
components.
Trait Implementations§
source§impl<N, D> From<Matrix<N, D, Const<1>, <DefaultAllocator as Allocator<N, D>>::Buffer>> for MomentumN<N, D>
impl<N, D> From<Matrix<N, D, Const<1>, <DefaultAllocator as Allocator<N, D>>::Buffer>> for MomentumN<N, D>
source§impl<N, D> PartialEq for MomentumN<N, D>
impl<N, D> PartialEq for MomentumN<N, D>
impl<N, D> Copy for MomentumN<N, D>where
N: SimdRealField + Signed + Real,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, D>,
Owned<N, D>: Copy,
impl<N, D> StructuralPartialEq for MomentumN<N, D>
Auto Trait Implementations§
impl<N, D> !RefUnwindSafe for MomentumN<N, D>
impl<N, D> !Send for MomentumN<N, D>
impl<N, D> !Sync for MomentumN<N, D>
impl<N, D> !Unpin for MomentumN<N, D>
impl<N, D> !UnwindSafe for MomentumN<N, D>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.