pub struct CompoundShape {
pub children: Vec<CompoundChild>,
/* private fields */
}Expand description
Compound shape: multiple child shapes combined into one body
Fields§
§children: Vec<CompoundChild>Child shapes with their local transforms
Implementations§
Source§impl CompoundShape
impl CompoundShape
Sourcepub fn add_sphere(
&mut self,
sphere: Sphere,
position: Vec3Fix,
rotation: QuatFix,
)
pub fn add_sphere( &mut self, sphere: Sphere, position: Vec3Fix, rotation: QuatFix, )
Add a sphere child
Sourcepub fn add_capsule(
&mut self,
capsule: Capsule,
position: Vec3Fix,
rotation: QuatFix,
)
pub fn add_capsule( &mut self, capsule: Capsule, position: Vec3Fix, rotation: QuatFix, )
Add a capsule child
Sourcepub fn add_convex_hull(
&mut self,
hull: ConvexHull,
position: Vec3Fix,
rotation: QuatFix,
)
pub fn add_convex_hull( &mut self, hull: ConvexHull, position: Vec3Fix, rotation: QuatFix, )
Add a convex hull child
Sourcepub fn from_decomposition(result: &DecompositionResult) -> Self
pub fn from_decomposition(result: &DecompositionResult) -> Self
A compound of the convex pieces of a decomposed SDF: one hull child per piece, at the origin, so the compound is in the SDF’s own coordinates.
Together the hulls are the concave solid the SDF describes, up to the grid’s resolution (a hull is smaller than the solid by up to a cell per side), where a single convex hull would fill every dent.
Sourcepub fn from_sdf(
sdf: &dyn SdfField,
min: Vec3Fix,
max: Vec3Fix,
config: &DecomposeConfig,
) -> Self
pub fn from_sdf( sdf: &dyn SdfField, min: Vec3Fix, max: Vec3Fix, config: &DecomposeConfig, ) -> Self
Decompose sdf inside [min, max] (crate::convex_decompose::decompose_sdf)
and build the compound of its convex pieces
(from_decomposition).
Sourcepub fn add_box(
&mut self,
obox: OrientedBox,
position: Vec3Fix,
rotation: QuatFix,
)
pub fn add_box( &mut self, obox: OrientedBox, position: Vec3Fix, rotation: QuatFix, )
Add a box child
Sourcepub fn compute_aabb(&mut self) -> AABB
pub fn compute_aabb(&mut self) -> AABB
Compute the AABB enclosing all children (in local space)
Sourcepub fn child_world_aabb(
&self,
child_idx: usize,
body_pos: Vec3Fix,
body_rot: QuatFix,
) -> AABB
pub fn child_world_aabb( &self, child_idx: usize, body_pos: Vec3Fix, body_rot: QuatFix, ) -> AABB
Get world-space AABB for a specific child, given body transform
Sourcepub fn world_aabb(&self, body_pos: Vec3Fix, body_rot: QuatFix) -> AABB
pub fn world_aabb(&self, body_pos: Vec3Fix, body_rot: QuatFix) -> AABB
Get world-space AABB for entire compound given body transform
Sourcepub fn overlapping_children(
&self,
target_aabb: &AABB,
body_pos: Vec3Fix,
body_rot: QuatFix,
) -> Vec<usize>
pub fn overlapping_children( &self, target_aabb: &AABB, body_pos: Vec3Fix, body_rot: QuatFix, ) -> Vec<usize>
AABB-based closest pair pruning: 対象AABBと重なる子のみを返す。 ブロードフェーズで不要なナローフェーズ判定を除外する。
Sourcepub fn support_world(
&self,
direction: Vec3Fix,
body_pos: Vec3Fix,
body_rot: QuatFix,
) -> Vec3Fix
pub fn support_world( &self, direction: Vec3Fix, body_pos: Vec3Fix, body_rot: QuatFix, ) -> Vec3Fix
Support function for the compound shape (selects the child with maximum support)
Sourcepub fn mass_properties(&self, density: Fix128) -> MassProperties
pub fn mass_properties(&self, density: Fix128) -> MassProperties
Mass, centre of mass and the inertia about it, for the compound made of
density, in the compound’s own frame.
Each child contributes its shape’s mass properties (a capsule’s along its
own axis, a box’s in its own frame, a hull’s by the exact integral over its
mesh), carried to where the child is, and the tensors are summed about the
common centre of mass with the parallel-axis theorem
(crate::mass_properties::translate_inertia). Overlapping children are
counted twice where they overlap: a compound is a union of solids, not a
boolean one.
MassProperties::ZERO for an empty compound, a non-positive density, or
children with no volume.
Trait Implementations§
Source§impl Clone for CompoundShape
impl Clone for CompoundShape
Source§impl Debug for CompoundShape
impl Debug for CompoundShape
Auto Trait Implementations§
impl Freeze for CompoundShape
impl RefUnwindSafe for CompoundShape
impl Send for CompoundShape
impl Sync for CompoundShape
impl Unpin for CompoundShape
impl UnsafeUnpin for CompoundShape
impl UnwindSafe for CompoundShape
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more