[−][src]Trait geo::algorithm::translate::Translate
Required methods
fn translate(&self, xoff: T, yoff: T) -> Self where
T: CoordinateType,
T: CoordinateType,
Translate a Geometry along its axes by the given offsets
Examples
use geo::{Point, LineString}; use geo::algorithm::translate::{Translate}; let mut vec = Vec::new(); vec.push(Point::new(0.0, 0.0)); vec.push(Point::new(5.0, 5.0)); vec.push(Point::new(10.0, 10.0)); let linestring = LineString::from(vec); let translated = linestring.translate(1.5, 3.5); let mut correct = Vec::new(); correct.push(Point::new(1.5, 3.5)); correct.push(Point::new(6.5, 8.5)); correct.push(Point::new(11.5, 13.5)); let correct_ls = LineString::from(correct); assert_eq!(translated, correct_ls);
fn translate_inplace(&mut self, xoff: T, yoff: T) where
T: CoordinateType,
T: CoordinateType,
Translate a Geometry along its axes, but in place.
Implementors
impl<T, G> Translate<T> for G where
T: CoordinateType,
G: MapCoords<T, T, Output = G> + MapCoordsInplace<T>,
[src]
T: CoordinateType,
G: MapCoords<T, T, Output = G> + MapCoordsInplace<T>,