changeset 14144 | 165e43c3ed59 |
parent 14142 | 11202097584f |
child 14146 | 4791c9a7d5e8 |
--- a/rust/integral-geometry/src/lib.rs Tue Nov 06 17:00:35 2018 +0100 +++ b/rust/integral-geometry/src/lib.rs Tue Nov 06 19:44:20 2018 +0300 @@ -98,9 +98,14 @@ } #[inline] - pub fn to_fppoint(&self) -> FPPoint { + pub fn to_fppoint(self) -> FPPoint { FPPoint::new(self.x.into(), self.y.into()) } + + #[inline] + pub fn from_fppoint(p: &FPPoint) -> Self { + Self::new(p.x().round(), p.y().round()) + } } #[derive(PartialEq, Eq, Clone, Copy, Debug)]