pub trait Shape:
Debug
+ Send
+ Sync {
// Required methods
fn bounding_box(&self) -> Aabb;
fn support_point(&self, direction: &Vec3) -> Vec3;
fn volume(&self) -> Real;
fn center_of_mass(&self) -> Vec3;
fn inertia_tensor(&self, mass: Real) -> Mat3;
fn ray_cast(
&self,
ray_origin: &Vec3,
ray_direction: &Vec3,
max_toi: Real,
) -> Option<RayHit>;
// Provided method
fn mass_properties(&self, density: Real) -> MassProperties { ... }
}Expand description
Trait for geometric shapes used in physics simulation.
Required Methods§
Sourcefn bounding_box(&self) -> Aabb
fn bounding_box(&self) -> Aabb
Compute the axis-aligned bounding box of this shape (in local space).
Sourcefn support_point(&self, direction: &Vec3) -> Vec3
fn support_point(&self, direction: &Vec3) -> Vec3
Compute the support point in the given direction (for GJK).
Sourcefn center_of_mass(&self) -> Vec3
fn center_of_mass(&self) -> Vec3
Compute the center of mass in local space.
Sourcefn inertia_tensor(&self, mass: Real) -> Mat3
fn inertia_tensor(&self, mass: Real) -> Mat3
Compute the inertia tensor for the given mass.
Provided Methods§
Sourcefn mass_properties(&self, density: Real) -> MassProperties
fn mass_properties(&self, density: Real) -> MassProperties
Compute full mass properties for a given density.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".