Trait geo::algorithm::simplify::Simplify [] [src]

pub trait Simplify<T, Epsilon = T> {
    fn simplify(&self, epsilon: &T) -> Self
    where
        T: Float
; }

Required Methods

Returns the simplified representation of a LineString, using the Ramer–Douglas–Peucker algorithm

use geo::{Point, LineString};
use geo::algorithm::simplify::{Simplify};

let mut vec = Vec::new();
vec.push(Point::new(0.0, 0.0));
vec.push(Point::new(5.0, 4.0));
vec.push(Point::new(11.0, 5.5));
vec.push(Point::new(17.3, 3.2));
vec.push(Point::new(27.8, 0.1));
let linestring = LineString(vec);
let mut compare = Vec::new();
compare.push(Point::new(0.0, 0.0));
compare.push(Point::new(5.0, 4.0));
compare.push(Point::new(11.0, 5.5));
compare.push(Point::new(27.8, 0.1));
let ls_compare = LineString(compare);
let simplified = linestring.simplify(&1.0);
assert_eq!(simplified, ls_compare)

Implementors