Skip to main content

InertiaTensor

Struct InertiaTensor 

Source
pub struct InertiaTensor<F>
where F: Frame,
{ /* private fields */ }
Expand description

Mass moment of inertia tensor (kg·m²) expressed in frame F.

Symmetric in physically-meaningful instances, but the type does not enforce symmetry — composition via Self::transform preserves it when the input is symmetric and the rotation is proper.

§Frame-mismatch is a compile error

Adding inertia tensors expressed in different compile-time frames fails to typecheck rather than silently mis-summing them:

use astrodyn_quantities::frame::{Ecef, RootInertial};
use astrodyn_quantities::inertia::InertiaTensor;

let a = InertiaTensor::<RootInertial>::from_principal(1.0, 1.0, 1.0);
let b = InertiaTensor::<Ecef>::from_principal(1.0, 1.0, 1.0);
let _bad = a + b; // Add is only impl'd for matching frames

Implementations§

Source§

impl<F> InertiaTensor<F>
where F: Frame,

Source

pub const fn from_dmat3_unchecked(value: DMat3) -> InertiaTensor<F>

Wrap a raw DMat3 whose entries are interpreted as kg·m² in frame F. The caller is responsible for the unit and for any symmetry / positive-definite invariants the downstream physics expects.

Source

pub fn zero() -> InertiaTensor<F>

The zero tensor (useful as an accumulator seed).

Source

pub fn from_principal(ixx: f64, iyy: f64, izz: f64) -> InertiaTensor<F>

Diagonal tensor with the given principal moments (Ixx, Iyy, Izz); off-diagonal products are zero.

Source

pub fn from_components( ixx: f64, iyy: f64, izz: f64, ixy: f64, ixz: f64, iyz: f64, ) -> InertiaTensor<F>

Symmetric tensor built from JEOD’s six-component layout: Ixx, Iyy, Izz on the diagonal; Ixy, Ixz, Iyz mirrored across.

JEOD stores inertia products as +Ixy = ∫ x·y dm (no negation), matching the convention used in models/dynamics/mass/src/mass_properties_inertia.cc.

Source

pub const fn as_dmat3(&self) -> DMat3

Raw DMat3 view in kg·m². Value copy.

Source

pub fn transpose(&self) -> InertiaTensor<F>

Transpose. For a symmetric inertia tensor this is the identity.

Source

pub fn transform(&self, rot: &DMat3) -> InertiaTensor<F>

Numeric similarity transform T^T · I · T. Matches JEOD’s transpose_transform_matrix usage in mass_properties.cc for composing child inertia about a parent structural frame’s axes.

The frame phantom F is intentionally unchanged. This is the numeric kernel; frame-changing must go through an explicit retag (InertiaTensor::<NewFrame>::from_dmat3_unchecked(...)) or a future typed FrameTransform-style wrapper that updates the phantom coherently. Calling transform alone does not re-express the tensor in a different compile-time frame.

Trait Implementations§

Source§

impl<F> Add for InertiaTensor<F>
where F: Frame,

Component-wise addition. Used by parallel-axis composition: the caller supplies the offset contribution (m · ([d]² · I − d ⊗ d)) as another InertiaTensor<F> in the same frame and adds it.

Source§

type Output = InertiaTensor<F>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: InertiaTensor<F>) -> InertiaTensor<F>

Performs the + operation. Read more
Source§

impl<F> AddAssign for InertiaTensor<F>
where F: Frame,

Source§

fn add_assign(&mut self, rhs: InertiaTensor<F>)

Performs the += operation. Read more
Source§

impl<F> Clone for InertiaTensor<F>
where F: Frame,

Source§

fn clone(&self) -> InertiaTensor<F>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F> Debug for InertiaTensor<F>
where F: Frame,

Source§

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

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

impl<F> Default for InertiaTensor<F>
where F: Frame,

Source§

fn default() -> InertiaTensor<F>

Returns the “default value” for a type. Read more
Source§

impl<F> Mul<f64> for InertiaTensor<F>
where F: Frame,

Scalar multiply on the right (tensor * f64). The left form (f64 * tensor) is omitted — Mul<InertiaTensor<F>> for f64 would require an F-generic foreign-impl that the orphan rules permit but which adds little ergonomic value for what’s almost always a scalar in user code.

Source§

type Output = InertiaTensor<F>

The resulting type after applying the * operator.
Source§

fn mul(self, scalar: f64) -> InertiaTensor<F>

Performs the * operation. Read more
Source§

impl<F> Neg for InertiaTensor<F>
where F: Frame,

Source§

type Output = InertiaTensor<F>

The resulting type after applying the - operator.
Source§

fn neg(self) -> InertiaTensor<F>

Performs the unary - operation. Read more
Source§

impl<F> PartialEq for InertiaTensor<F>
where F: Frame,

Source§

fn eq(&self, other: &InertiaTensor<F>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<F> Sub for InertiaTensor<F>
where F: Frame,

Source§

type Output = InertiaTensor<F>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: InertiaTensor<F>) -> InertiaTensor<F>

Performs the - operation. Read more
Source§

impl<F> SubAssign for InertiaTensor<F>
where F: Frame,

Source§

fn sub_assign(&mut self, rhs: InertiaTensor<F>)

Performs the -= operation. Read more
Source§

impl<F> Copy for InertiaTensor<F>
where F: Frame,

Auto Trait Implementations§

§

impl<F> Freeze for InertiaTensor<F>

§

impl<F> RefUnwindSafe for InertiaTensor<F>
where F: RefUnwindSafe,

§

impl<F> Send for InertiaTensor<F>
where F: Send,

§

impl<F> Sync for InertiaTensor<F>
where F: Sync,

§

impl<F> Unpin for InertiaTensor<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for InertiaTensor<F>

§

impl<F> UnwindSafe for InertiaTensor<F>
where F: UnwindSafe,

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> Same for T

Source§

type Output = T

Should always be Self
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, 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.