pub struct Capsule {
pub from: [f64; 3],
pub to: [f64; 3],
pub radius: f64,
}Expand description
A capsule: every point within radius of the segment from from to to. A slanted rod, arm or shaft as a part
that can hit an obstacle (Machine::collision_capsules), where a box along the scene’s axes around it would be up to
its length wider than it. Metres, in scene coordinates.
Fields§
§from: [f64; 3]§to: [f64; 3]§radius: f64Implementations§
Source§impl Capsule
impl Capsule
Sourcepub fn gap_capsule(&self, other: &Capsule) -> f64
pub fn gap_capsule(&self, other: &Capsule) -> f64
The clearance between two capsules (the planning check of the machine’s own parts, Machine::connected_bodies):
the distance of the two segments (closest points as Ericson, Real-Time Collision Detection 5.1.9) less both
radii. Negative in an overlap, then up to the radii’s sum where the segments cross (a measure of how deep, not
the exact depth).
Sourcepub fn extent(&self) -> ([f64; 3], [f64; 3])
pub fn extent(&self) -> ([f64; 3], [f64; 3])
The least and greatest corner of the box along the scene’s axes around the capsule.
Sourcepub fn gap(&self, other: &Aabb) -> ([f64; 3], [f64; 3], f64)
pub fn gap(&self, other: &Aabb) -> ([f64; 3], [f64; 3], f64)
The nearest points of the capsule and the box, one on each, and the clearance between them, as Aabb::gap has
them: the least signed distance of the segment’s points to the box, less the radius. Negative in an overlap,
where it is the depth to the box face nearest to the segment’s deepest point (both points then on the
segment). The signed distance of a point to a box is convex along a line, so its least along the segment is
found by a golden-section search, to the last bit of the segment’s parameter: exact, as is the box’s.