pub enum Attachment {
Body(usize),
World,
}Expand description
What one side of a pairwise quantity is attached to: a body in the model, or the static world.
§Why this type exists
Contacts, constraints and relative Jacobians all need to express “body i
against body j, where j may be the ground”. The engine long spelled
that as a plain usize with usize::MAX meaning the world — an in-band
sentinel, and a hazardous one: usize::MAX is a perfectly valid-looking
index, so a stale or miscomputed index that happens to land on it is
silently reinterpreted as “the world” instead of panicking. The failure is
not a crash but a contact that quietly stops pushing back on one side.
Attachment makes the two cases distinct at the type level, so the
compiler forces every consumer to say which it means. It carries no
sentinel and cannot be constructed from a bare index by accident — there is
deliberately no From<usize> impl, because that would reintroduce exactly
the ambiguity this type removes.
Variants§
Body(usize)
A body in the model, by index.
World
The static world: infinitely massive, never moves, and contributes no columns to a Jacobian.
Implementations§
Trait Implementations§
Source§impl Clone for Attachment
impl Clone for Attachment
Source§fn clone(&self) -> Attachment
fn clone(&self) -> Attachment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more