Skip to main content

Shape

Trait Shape 

Source
pub trait Shape<const D: usize>: Send + Sync {
    // Required methods
    fn support(&self, direction: &SVector<f64, D>) -> SVector<f64, D>;
    fn bounding_sphere(&self) -> (Point<D>, f64);
}
Expand description

Trait for D-dimensional convex shapes compatible with GJK collision detection.

The support function is the only requirement for GJK — given a direction, return the point on the shape’s boundary furthest in that direction. This generalizes naturally to any dimension.

Required Methods§

Source

fn support(&self, direction: &SVector<f64, D>) -> SVector<f64, D>

Support function: furthest point on the boundary in the given direction.

Source

fn bounding_sphere(&self) -> (Point<D>, f64)

Bounding sphere: (center, radius).

Implementors§

Source§

impl<const D: usize> Shape<D> for Capsule<D>

Source§

impl<const D: usize> Shape<D> for ConvexHull<D>

Source§

impl<const D: usize> Shape<D> for HalfSpace<D>

Source§

impl<const D: usize> Shape<D> for HyperBox<D>

Source§

impl<const D: usize> Shape<D> for Sphere<D>