Skip to main content

Module compound

Module compound 

Source
Expand description

Compound shape: a rigid body composed of multiple convex sub-shapes.

Each child is placed at a fixed offset (Transform) relative to the compound origin. The support function reduces to an argmax over all children’s individual support points — O(n_children) per GJK query, which is acceptable since compound bodies typically have ≤16 parts.

§Usage

use symtropy_math::{CompoundShape, Point, Sphere, Transform};

// A dumbbell: two spheres connected along the x axis.
let mut compound = CompoundShape::<3>::new();
compound.add_child(
    Transform::from_translation(Point::new([-2.0, 0.0, 0.0])),
    Box::new(Sphere::unit()),
);
compound.add_child(
    Transform::from_translation(Point::new([2.0, 0.0, 0.0])),
    Box::new(Sphere::unit()),
);

Structs§

CompoundShape
A convex rigid body composed of multiple child shapes.