1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
use mini_math::Point;
use crate::LineSegment;
/// A cylinder capped with a half-sphere at each end
#[derive(Debug)]
pub struct Capsule {
/// The central axis of the capsule
pub axis: LineSegment,
/// The radius of the capsule
pub radius: f32,
}
impl Capsule {
/// Construct a capsule from the end points of the central axis, and a radius
pub fn new(a: Point, b: Point, radius: f32) -> Self {
Self {
axis: LineSegment::new(a, b),
radius,
}
}
}