Trait geo::algorithm::translate::Translate[][src]

pub trait Translate<T> {
    fn translate(&self, xoff: T, yoff: T) -> Self
    where
        T: CoordNum
;
fn translate_inplace(&mut self, xoff: T, yoff: T)
    where
        T: CoordNum
; }

Required methods

fn translate(&self, xoff: T, yoff: T) -> Self where
    T: CoordNum
[src]

Translate a Geometry along its axes by the given offsets

Examples

use geo::algorithm::translate::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_inplace(&mut self, xoff: T, yoff: T) where
    T: CoordNum
[src]

Translate a Geometry along its axes, but in place.

Loading content...

Implementors

impl<T, G> Translate<T> for G where
    T: CoordNum,
    G: MapCoords<T, T, Output = G> + MapCoordsInplace<T>, 
[src]

Loading content...