1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
//! Translations. use crate::{P2, V2}; /// A trait for spatially translatable types. pub trait Translate { /// Translate `self` by the given translation vector. fn translate(self, translation: V2) -> Self; } impl Translate for P2 { fn translate(self, translation: V2) -> Self { self + translation } }