use geometry::*; pub trait CircleHitbox { fn pos(&self) -> Vec2d; fn radius(&self) -> f64; /** * True if the point is inside the hitbox */ fn touches_point(&self, point: Vec2d) -> bool { self.pos().distance(point) <= self.radius() } fn touches_circle(&self, other: &CircleHitbox) -> bool { self.pos().distance_squared(other.pos()) <= (self.radius() + other.radius()).powi(2) } }