Struct heron::rapier_plugin::rapier3d::dynamics::MassProperties
source · pub struct MassProperties {
pub local_com: OPoint<f32, Const<3>>,
pub inv_mass: f32,
pub inv_principal_inertia_sqrt: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>,
pub principal_inertia_local_frame: Unit<Quaternion<f32>>,
}
Expand description
The local mass properties of a rigid-body.
Fields
local_com: OPoint<f32, Const<3>>
The center of mass of a rigid-body expressed in its local-space.
inv_mass: f32
The inverse of the mass of a rigid-body.
If this is zero, the rigid-body is assumed to have infinite mass.
inv_principal_inertia_sqrt: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
The inverse of the principal angular inertia of the rigid-body.
Components set to zero are assumed to be infinite along the corresponding principal axis.
principal_inertia_local_frame: Unit<Quaternion<f32>>
The principal vectors of the local angular inertia tensor of the rigid-body.
Implementations
sourceimpl MassProperties
impl MassProperties
sourcepub fn new(
local_com: OPoint<f32, Const<3>>,
mass: f32,
principal_inertia: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
) -> MassProperties
pub fn new(
local_com: OPoint<f32, Const<3>>,
mass: f32,
principal_inertia: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
) -> MassProperties
Initializes the mass properties from the given center-of-mass, mass, and principal angular inertia.
The center-of-mass is specified in the local-space of the rigid-body. The principal angular inertia are the angular inertia along the coordinate axes in the local-space of the rigid-body.
sourcepub fn with_principal_inertia_frame(
local_com: OPoint<f32, Const<3>>,
mass: f32,
principal_inertia: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>,
principal_inertia_local_frame: Unit<Quaternion<f32>>
) -> MassProperties
pub fn with_principal_inertia_frame(
local_com: OPoint<f32, Const<3>>,
mass: f32,
principal_inertia: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>,
principal_inertia_local_frame: Unit<Quaternion<f32>>
) -> MassProperties
Initializes the mass properties from the given center-of-mass, mass, and principal angular inertia.
The center-of-mass is specified in the local-space of the rigid-body.
The principal angular inertia are the angular inertia along the coordinate axes defined by
the principal_inertia_local_frame
expressed in the local-space of the rigid-body.
sourcepub fn with_inertia_matrix(
local_com: OPoint<f32, Const<3>>,
mass: f32,
inertia: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>
) -> MassProperties
pub fn with_inertia_matrix(
local_com: OPoint<f32, Const<3>>,
mass: f32,
inertia: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>
) -> MassProperties
Initialize a new MassProperties
from a given center-of-mass, mass, and angular inertia matrix.
The angular inertia matrix will be diagonalized in order to extract the principal inertia values and principal inertia frame.
sourcepub fn principal_inertia(
&self
) -> Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
pub fn principal_inertia(
&self
) -> Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
The angular inertia along the principal inertia axes of the rigid-body.
sourcepub fn world_com(
&self,
pos: &Isometry<f32, Unit<Quaternion<f32>>, 3>
) -> OPoint<f32, Const<3>>
pub fn world_com(
&self,
pos: &Isometry<f32, Unit<Quaternion<f32>>, 3>
) -> OPoint<f32, Const<3>>
The world-space center of mass of the rigid-body.
sourcepub fn world_inv_inertia_sqrt(
&self,
rot: &Unit<Quaternion<f32>>
) -> SdpMatrix3<f32>
pub fn world_inv_inertia_sqrt(
&self,
rot: &Unit<Quaternion<f32>>
) -> SdpMatrix3<f32>
The world-space inverse angular inertia tensor of the rigid-body.
sourcepub fn reconstruct_inverse_inertia_matrix(
&self
) -> Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>
pub fn reconstruct_inverse_inertia_matrix(
&self
) -> Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>
Reconstructs the inverse angular inertia tensor of the rigid body from its principal inertia values and axes.
sourcepub fn reconstruct_inertia_matrix(
&self
) -> Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>
pub fn reconstruct_inertia_matrix(
&self
) -> Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>
Reconstructs the angular inertia tensor of the rigid body from its principal inertia values and axes.
sourcepub fn transform_by(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>
) -> MassProperties
pub fn transform_by(
&self,
m: &Isometry<f32, Unit<Quaternion<f32>>, 3>
) -> MassProperties
Transform each element of the mass properties.
sourcepub fn set_mass(&mut self, new_mass: f32, adjust_angular_inertia: bool)
pub fn set_mass(&mut self, new_mass: f32, adjust_angular_inertia: bool)
Changes the mass on these mass-properties.
The adjust_angular_inertia
argument should always be true
, unless
there are some specific reasons not to do so. Setting this to true
will automatically adjust the angular inertia of self
to account
for the mass change (i.e. it will multiply the angular inertia by
new_mass / prev_mass
). Setting it to false
will not change the
current angular inertia.
sourceimpl MassProperties
impl MassProperties
sourcepub fn from_ball(density: f32, radius: f32) -> MassProperties
pub fn from_ball(density: f32, radius: f32) -> MassProperties
Computes the mass properties of a ball.
sourceimpl MassProperties
impl MassProperties
sourceimpl MassProperties
impl MassProperties
sourcepub fn from_compound(
density: f32,
shapes: &[(Isometry<f32, Unit<Quaternion<f32>>, 3>, SharedShape)]
) -> MassProperties
pub fn from_compound(
density: f32,
shapes: &[(Isometry<f32, Unit<Quaternion<f32>>, 3>, SharedShape)]
) -> MassProperties
Computes the mass properties of a compound shape.
sourceimpl MassProperties
impl MassProperties
sourceimpl MassProperties
impl MassProperties
sourcepub fn from_convex_polyhedron(
density: f32,
vertices: &[OPoint<f32, Const<3>>],
indices: &[[u32; 3]]
) -> MassProperties
pub fn from_convex_polyhedron(
density: f32,
vertices: &[OPoint<f32, Const<3>>],
indices: &[[u32; 3]]
) -> MassProperties
Computes the mass properties of a convex polyhedron.
sourceimpl MassProperties
impl MassProperties
sourcepub fn from_cuboid(
density: f32,
half_extents: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
) -> MassProperties
pub fn from_cuboid(
density: f32,
half_extents: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>
) -> MassProperties
Computes the mass properties of a cuboid.
sourceimpl MassProperties
impl MassProperties
sourcepub fn from_cylinder(
density: f32,
half_height: f32,
radius: f32
) -> MassProperties
pub fn from_cylinder(
density: f32,
half_height: f32,
radius: f32
) -> MassProperties
Computes the mass properties of a cylinder.
sourceimpl MassProperties
impl MassProperties
sourcepub fn from_trimesh(
density: f32,
vertices: &[OPoint<f32, Const<3>>],
indices: &[[u32; 3]]
) -> MassProperties
pub fn from_trimesh(
density: f32,
vertices: &[OPoint<f32, Const<3>>],
indices: &[[u32; 3]]
) -> MassProperties
Computes the mass properties of a triangle mesh.
Trait Implementations
sourceimpl AbsDiffEq<MassProperties> for MassProperties
impl AbsDiffEq<MassProperties> for MassProperties
sourcefn default_epsilon() -> <MassProperties as AbsDiffEq<MassProperties>>::Epsilon
fn default_epsilon() -> <MassProperties as AbsDiffEq<MassProperties>>::Epsilon
sourcefn abs_diff_eq(
&self,
other: &MassProperties,
epsilon: <MassProperties as AbsDiffEq<MassProperties>>::Epsilon
) -> bool
fn abs_diff_eq(
&self,
other: &MassProperties,
epsilon: <MassProperties as AbsDiffEq<MassProperties>>::Epsilon
) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq
].sourceimpl Add<MassProperties> for MassProperties
impl Add<MassProperties> for MassProperties
type Output = MassProperties
type Output = MassProperties
+
operator.sourcefn add(self, other: MassProperties) -> MassProperties
fn add(self, other: MassProperties) -> MassProperties
+
operation. Read moresourceimpl AddAssign<MassProperties> for MassProperties
impl AddAssign<MassProperties> for MassProperties
sourcefn add_assign(&mut self, rhs: MassProperties)
fn add_assign(&mut self, rhs: MassProperties)
+=
operation. Read moresourceimpl Clone for MassProperties
impl Clone for MassProperties
sourcefn clone(&self) -> MassProperties
fn clone(&self) -> MassProperties
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for MassProperties
impl Debug for MassProperties
sourceimpl Default for MassProperties
impl Default for MassProperties
sourcefn default() -> MassProperties
fn default() -> MassProperties
impl From<MassProperties> for ColliderMassProps
impl From<MassProperties> for ColliderMassProps
fn from(mprops: MassProperties) -> ColliderMassProps
fn from(mprops: MassProperties) -> ColliderMassProps
impl From<MassProperties> for RigidBodyMassProps
impl From<MassProperties> for RigidBodyMassProps
fn from(local_mprops: MassProperties) -> RigidBodyMassProps
fn from(local_mprops: MassProperties) -> RigidBodyMassProps
sourceimpl PartialEq<MassProperties> for MassProperties
impl PartialEq<MassProperties> for MassProperties
sourcefn eq(&self, other: &MassProperties) -> bool
fn eq(&self, other: &MassProperties) -> bool
sourceimpl RelativeEq<MassProperties> for MassProperties
impl RelativeEq<MassProperties> for MassProperties
sourcefn default_max_relative(
) -> <MassProperties as AbsDiffEq<MassProperties>>::Epsilon
fn default_max_relative(
) -> <MassProperties as AbsDiffEq<MassProperties>>::Epsilon
sourcefn relative_eq(
&self,
other: &MassProperties,
epsilon: <MassProperties as AbsDiffEq<MassProperties>>::Epsilon,
max_relative: <MassProperties as AbsDiffEq<MassProperties>>::Epsilon
) -> bool
fn relative_eq(
&self,
other: &MassProperties,
epsilon: <MassProperties as AbsDiffEq<MassProperties>>::Epsilon,
max_relative: <MassProperties as AbsDiffEq<MassProperties>>::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
RelativeEq::relative_eq
].sourceimpl Sub<MassProperties> for MassProperties
impl Sub<MassProperties> for MassProperties
type Output = MassProperties
type Output = MassProperties
-
operator.sourcefn sub(self, other: MassProperties) -> MassProperties
fn sub(self, other: MassProperties) -> MassProperties
-
operation. Read moresourceimpl SubAssign<MassProperties> for MassProperties
impl SubAssign<MassProperties> for MassProperties
sourcefn sub_assign(&mut self, rhs: MassProperties)
fn sub_assign(&mut self, rhs: MassProperties)
-=
operation. Read moresourceimpl Sum<MassProperties> for MassProperties
impl Sum<MassProperties> for MassProperties
sourcefn sum<I>(iter: I) -> MassPropertieswhere
I: Iterator<Item = MassProperties>,
fn sum<I>(iter: I) -> MassPropertieswhere
I: Iterator<Item = MassProperties>,
Self
from the elements by
“summing up” the items. Read moresourceimpl Zero for MassProperties
impl Zero for MassProperties
impl Copy for MassProperties
impl StructuralPartialEq for MassProperties
Auto Trait Implementations
impl RefUnwindSafe for MassProperties
impl Send for MassProperties
impl Sync for MassProperties
impl Unpin for MassProperties
impl UnwindSafe for MassProperties
Blanket Implementations
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist. Read moresourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
. Read morefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read morefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read morefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read moreimpl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given [World]sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
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>
self
from the equivalent element of its
superset. Read morefn 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).fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.