Struct oxygengine_physics_2d::prelude::algebra::Inertia2
source · pub struct Inertia2<N>where
N: RealField + Copy,{
pub linear: N,
pub angular: N,
}
Expand description
The inertia of a rigid body grouping both its mass and its angular inertia.
Fields§
§linear: N
The linear part (mass) of the inertia.
angular: N
The angular inertia.
Implementations§
source§impl<N> Inertia2<N>where
N: RealField + Copy,
impl<N> Inertia2<N>where N: RealField + Copy,
sourcepub fn new(linear: N, angular: N) -> Inertia2<N>
pub fn new(linear: N, angular: N) -> Inertia2<N>
Creates an inertia from its linear and angular components.
sourcepub fn new_with_angular_matrix(
linear: N,
angular: Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>>
) -> Inertia2<N>
pub fn new_with_angular_matrix( linear: N, angular: Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>> ) -> Inertia2<N>
Creates an inertia from its linear and angular components.
sourcepub fn angular_matrix(
&self
) -> &Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>>
pub fn angular_matrix( &self ) -> &Matrix<N, Const<1>, Const<1>, ArrayStorage<N, 1, 1>>
Get the angular inertia tensor.
sourcepub fn to_matrix(
&self
) -> Matrix<N, Const<nalgebra::::base::dimension::U3::{constant#0}>, Const<nalgebra::::base::dimension::U3::{constant#0}>, ArrayStorage<N, 3, 3>>
pub fn to_matrix( &self ) -> Matrix<N, Const<nalgebra::::base::dimension::U3::{constant#0}>, Const<nalgebra::::base::dimension::U3::{constant#0}>, ArrayStorage<N, 3, 3>>
Convert the inertia into a matrix where the mass is represented as a 2x2 diagonal matrix on the upper-left corner, and the angular part as a 1x1 matrix on the lower-rigth corner.
Trait Implementations§
source§impl<N> AddAssign<Inertia2<N>> for Inertia2<N>where
N: RealField + Copy,
impl<N> AddAssign<Inertia2<N>> for Inertia2<N>where N: RealField + Copy,
source§fn add_assign(&mut self, rhs: Inertia2<N>)
fn add_assign(&mut self, rhs: Inertia2<N>)
Performs the
+=
operation. Read moreimpl<N> Copy for Inertia2<N>where N: Copy + RealField,
Auto Trait Implementations§
impl<N> RefUnwindSafe for Inertia2<N>where N: RefUnwindSafe,
impl<N> Send for Inertia2<N>
impl<N> Sync for Inertia2<N>
impl<N> Unpin for Inertia2<N>where N: Unpin,
impl<N> UnwindSafe for Inertia2<N>where N: UnwindSafe,
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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.