blob: e9d534a407860300e5947694f9be656441f4b4dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Vec2d {
pub x: f64,
pub y: f64
}
impl Vec2d {
pub fn distance(&self, other: Vec2d) -> f64 {
((other.x-self.x).powi(2) + (other.y-self.y).powi(2)).sqrt()
}
}
|