[−][src]Struct nalgebra_spacetime::FrameN
Inertial frame of reference in $n$-dimensional Lorentzian space $\R^{-,+} = \R^{1,n-1}$.
Holds a statically sized direction axis $\hat u \in \R^{n-1}$ and two boost
parameters precomputed from either velocity $u^\mu$, rapidity $\vec \zeta$,
or velocity ratio $\vec \beta$ whether using Self::from_velocity
,
Self::from_zeta
, or Self::from_beta
:
$$ \cosh \zeta = \gamma $$
$$ \sinh \zeta = \beta \gamma $$
Where $\gamma$ is the Lorentz factor.
Implementations
impl<N, D> FrameN<N, D> where
N: SimdRealField + Signed + Real,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
[src]
N: SimdRealField + Signed + Real,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
pub fn from_velocity<R, C>(u: &MatrixMN<N, R, C>) -> Self where
R: Dim,
C: Dim,
ShapeConstraint: SameNumberOfRows<R, D> + SameNumberOfColumns<C, U1>,
DefaultAllocator: Allocator<N, R, C>,
[src]
R: Dim,
C: Dim,
ShapeConstraint: SameNumberOfRows<R, D> + SameNumberOfColumns<C, U1>,
DefaultAllocator: Allocator<N, R, C>,
Inertial frame of reference with velocity $u^\mu$.
pub fn from_zeta(scaled_axis: VectorN<N, DimNameDiff<D, U1>>) -> Self
[src]
Inertial frame of reference with rapidity $\vec \zeta$.
pub fn from_axis_zeta(
axis: Unit<VectorN<N, DimNameDiff<D, U1>>>,
zeta: N
) -> Self
[src]
axis: Unit<VectorN<N, DimNameDiff<D, U1>>>,
zeta: N
) -> Self
Inertial frame of reference along $\hat u$ with rapidity $\zeta$.
pub fn from_beta(scaled_axis: VectorN<N, DimNameDiff<D, U1>>) -> Self
[src]
Inertial frame of reference with velocity ratio $\vec \beta$.
pub fn from_axis_beta(
axis: Unit<VectorN<N, DimNameDiff<D, U1>>>,
beta: N
) -> Self
[src]
axis: Unit<VectorN<N, DimNameDiff<D, U1>>>,
beta: N
) -> Self
Inertial frame of reference along $\hat u$ with velocity ratio $\beta$.
pub fn velocity(&self) -> VectorN<N, D> where
DefaultAllocator: Allocator<N, D>,
[src]
DefaultAllocator: Allocator<N, D>,
Velocity $u^\mu$.
pub fn axis(&self) -> Unit<VectorN<N, DimNameDiff<D, U1>>>
[src]
Direction $\hat u$.
pub fn zeta(&self) -> N
[src]
Rapidity $\zeta$.
pub fn beta(&self) -> N
[src]
Velocity ratio $\beta$.
pub fn gamma(&self) -> N
[src]
Lorentz factor $\gamma$.
pub fn beta_gamma(&self) -> N
[src]
Product of velocity ratio $\beta$ and Lorentz factor $\gamma$.
pub fn compose(&self, frame: &Self) -> Self where
DefaultAllocator: Allocator<N, D>,
[src]
DefaultAllocator: Allocator<N, D>,
Relativistic velocity addition self
$\oplus$frame
.
Equals frame.velocity().boost(&-self.clone()).frame()
.
impl<N> FrameN<N, U4> where
N: SimdRealField + Signed + Real,
DefaultAllocator: Allocator<N, U3>,
[src]
N: SimdRealField + Signed + Real,
DefaultAllocator: Allocator<N, U3>,
pub fn axis_angle(&self, frame: &Self) -> (Unit<Vector3<N>>, N)
[src]
$
\gdef \Bu {B^{\mu'}_{\phantom {\mu'} \mu} (\vec \beta_u)}
\gdef \Bv {B^{\mu''}_{\phantom {\mu''} \mu'} (\vec \beta_v)}
\gdef \Puv {u \oplus v}
\gdef \Buv {B^{\mu'}_{\phantom {\mu'} \mu} (\vec \beta_{\Puv})}
\gdef \Ruv {R^{\mu''}_{\phantom {\mu''} \mu'} (\epsilon)}
\gdef \Luv {\Lambda^{\mu''}_{\phantom {\mu''} \mu} (\vec \beta_{\Puv})}
$
Wigner rotation axis $\widehat {\vec \beta_u \times \vec \beta_v}$ and
angle $\epsilon$ of the boost composition self
$\oplus$frame
.
The composition of two pure boosts, $\Bu$ to self
followed by $\Bv$
to frame
, results in a composition of a pure boost $\Buv$ and a
non-vanishing spatial rotation $\Ruv$ for non-collinear boosts:
$$ \Luv = \Ruv \Buv = \Bv \Bu $$
$$ \epsilon = \arcsin \Bigg({ 1 + \gamma + \gamma_u + \gamma_v \over (1 + \gamma) (1 + \gamma_u) (1 + \gamma_v) } \gamma_u \gamma_v |\vec \beta_u \times \vec \beta_v| \Bigg) $$
$$ \gamma = \gamma_u \gamma_v (1 + \vec \beta_u \cdot \vec \beta_v) $$
use nalgebra::Vector3; use nalgebra_spacetime::{LorentzianN, Frame4}; use approx::{assert_abs_diff_ne, assert_ulps_eq}; let u = Frame4::from_beta(Vector3::new(0.18, 0.73, 0.07)); let v = Frame4::from_beta(Vector3::new(0.41, 0.14, 0.25)); let ucv = u.compose(&v).axis(); let vcu = v.compose(&u).axis(); let (axis, angle) = u.axis_angle(&v); let axis = axis.into_inner(); assert_abs_diff_ne!(angle, 0.0, epsilon = 1e-15); assert_ulps_eq!(angle, ucv.angle(&vcu), epsilon = 1e-15); assert_ulps_eq!(axis, ucv.cross(&vcu).normalize(), epsilon = 1e-15);
pub fn rotation(&self, frame: &Self) -> Matrix4<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U4, U4>,
[src]
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U4, U4>,
Wigner rotation matrix $R(\widehat {\vec \beta_u \times \vec \beta_v},
\epsilon)$ of the boost composition self
$\oplus$frame
.
See Self::axis_angle
for further details.
use nalgebra::{Vector3, Matrix4}; use nalgebra_spacetime::{LorentzianN, Frame4}; use approx::{assert_ulps_eq, assert_ulps_ne}; let u = Frame4::from_beta(Vector3::new(0.18, 0.73, 0.07)); let v = Frame4::from_beta(Vector3::new(0.41, 0.14, 0.25)); let ucv = u.compose(&v); let vcu = v.compose(&u); let boost_u = Matrix4::new_boost(&u); let boost_v = Matrix4::new_boost(&v); let boost_ucv = Matrix4::new_boost(&ucv); let boost_vcu = Matrix4::new_boost(&vcu); let rotation_ucv = u.rotation(&v); assert_ulps_ne!(boost_ucv, boost_v * boost_u); assert_ulps_ne!(boost_vcu, boost_u * boost_v); assert_ulps_eq!(rotation_ucv * boost_ucv, boost_v * boost_u); assert_ulps_eq!(boost_vcu * rotation_ucv, boost_v * boost_u);
Trait Implementations
impl<N, D> Add<FrameN<N, D>> for FrameN<N, D> where
N: SimdRealField + Signed + Real,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>> + Allocator<N, D>,
[src]
N: SimdRealField + Signed + Real,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>> + Allocator<N, D>,
type Output = Self
The resulting type after applying the +
operator.
pub fn add(self, rhs: Self) -> Self::Output
[src]
impl<N: Clone, D: Clone> Clone for FrameN<N, D> where
N: Scalar,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
[src]
N: Scalar,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
impl<N, D> Copy for FrameN<N, D> where
N: SimdRealField + Signed + Real,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
Owned<N, DimNameDiff<D, U1>>: Copy,
[src]
N: SimdRealField + Signed + Real,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
Owned<N, DimNameDiff<D, U1>>: Copy,
impl<N: Debug, D: Debug> Debug for FrameN<N, D> where
N: Scalar,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
[src]
N: Scalar,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
impl<N: Eq, D: Eq> Eq for FrameN<N, D> where
N: Scalar,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
[src]
N: Scalar,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
impl<N, D> From<FrameN<N, D>> for VectorN<N, D> where
N: SimdRealField + Signed + Real,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>> + Allocator<N, D>,
[src]
N: SimdRealField + Signed + Real,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>> + Allocator<N, D>,
impl<N, R, C> From<Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>> for FrameN<N, R> where
N: SimdRealField + Signed + Real,
R: DimNameSub<U1>,
C: DimName,
ShapeConstraint: SameNumberOfColumns<C, U1>,
DefaultAllocator: Allocator<N, R, C> + Allocator<N, DimNameDiff<R, U1>>,
[src]
N: SimdRealField + Signed + Real,
R: DimNameSub<U1>,
C: DimName,
ShapeConstraint: SameNumberOfColumns<C, U1>,
DefaultAllocator: Allocator<N, R, C> + Allocator<N, DimNameDiff<R, U1>>,
impl<N, D> Neg for FrameN<N, D> where
N: SimdRealField + Signed + Real,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
[src]
N: SimdRealField + Signed + Real,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
type Output = Self
The resulting type after applying the -
operator.
pub fn neg(self) -> Self::Output
[src]
impl<N: PartialEq, D: PartialEq> PartialEq<FrameN<N, D>> for FrameN<N, D> where
N: Scalar,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
[src]
N: Scalar,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
pub fn eq(&self, other: &FrameN<N, D>) -> bool
[src]
pub fn ne(&self, other: &FrameN<N, D>) -> bool
[src]
impl<N, D> StructuralEq for FrameN<N, D> where
N: Scalar,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
[src]
N: Scalar,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
impl<N, D> StructuralPartialEq for FrameN<N, D> where
N: Scalar,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
[src]
N: Scalar,
D: DimNameSub<U1>,
DefaultAllocator: Allocator<N, DimNameDiff<D, U1>>,
Auto Trait Implementations
impl<N, D> !RefUnwindSafe for FrameN<N, D>
[src]
impl<N, D> !Send for FrameN<N, D>
[src]
impl<N, D> !Sync for FrameN<N, D>
[src]
impl<N, D> !Unpin for FrameN<N, D>
[src]
impl<N, D> !UnwindSafe for FrameN<N, D>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> ClosedNeg for T where
T: Neg<Output = T>,
T: Neg<Output = T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> Scalar for T where
T: PartialEq<T> + Copy + Any + Debug,
[src]
T: PartialEq<T> + Copy + Any + Debug,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,