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