pub struct Point {
pub x: f64,
pub y: f64,
pub z: f64,
}
#[allow(dead_code)]
impl Point {
pub fn new(x: f64, y: f64, z: f64) -> Point {
Point { x, y, z }
}
pub fn distance(&self, other: &Point) -> f64 {
((self.x - other.x).powi(2) + (self.y - other.y).powi(2) + (self.z - other.z).powi(2))
.sqrt()
}
pub fn translate(&mut self, dx: f64, dy: f64, dz: f64) {
self.x += dx;
self.y += dy;
self.z += dz;
}
}
impl Default for Point {
fn default() -> Self {
Point {
x: 0.0,
y: 0.0,
z: 0.0,
}
}
}