pub trait Translate<T> {
fn translate(&self, xoff: T, yoff: T) -> Self
where
T: CoordNum;
fn translate_in_place(&mut self, xoff: T, yoff: T)
where
T: CoordNum;
fn translate_inplace(&mut self, xoff: T, yoff: T)
where
T: CoordNum;
}
Required Methods
Translate a Geometry along its axes by the given offsets
Examples
use geo::Translate;
use geo::line_string;
let ls = line_string![
(x: 0.0, y: 0.0),
(x: 5.0, y: 5.0),
(x: 10.0, y: 10.0),
];
let translated = ls.translate(1.5, 3.5);
assert_eq!(translated, line_string![
(x: 1.5, y: 3.5),
(x: 6.5, y: 8.5),
(x: 11.5, y: 13.5),
]);
fn translate_in_place(&mut self, xoff: T, yoff: T) where
T: CoordNum,
fn translate_in_place(&mut self, xoff: T, yoff: T) where
T: CoordNum,
Translate a Geometry along its axes, but in place.
fn translate_inplace(&mut self, xoff: T, yoff: T) where
T: CoordNum,
fn translate_inplace(&mut self, xoff: T, yoff: T) where
T: CoordNum,
👎 Deprecated since 0.20.1:
renamed to translate_in_place
Translate a Geometry along its axes, but in place.