use std::ops::Add; use std::ops::Sub; use vector::Vector3; #[derive(Clone, Copy)] pub struct Point { pub x: f32, pub y: f32, pub z: f32, } impl Point { pub fn zero() -> Point { Point { x: 0., y: 0., z: 0., } } } impl Add for Point { type Output = Point; fn add(self, other: Vector3) -> Point { Point { x: self.x + other.x, y: self.y + other.y, z: self.z + other.z, } } } impl Sub for Point { type Output = Point; fn sub(self, other: Point) -> Point { Point { x: self.x - other.x, y: self.y - other.y, z: self.z - other.z, } } }