[][src]Trait geo::algorithm::simplifyvw::SimplifyVW

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

Simplifies a geometry.

Polygons are simplified by running the algorithm on all their constituent rings. This may result in invalid Polygons, and has no guarantee of preserving topology. Multi* objects are simplified by simplifying all their constituent geometries individually.

Required methods

fn simplifyvw(&self, epsilon: &T) -> Self where
    T: Float

Returns the simplified representation of a geometry, using the Visvalingam-Whyatt algorithm

See here for a graphical explanation

Examples

use geo::{Point, LineString};
use geo::algorithm::simplifyvw::{SimplifyVW};

let mut vec = Vec::new();
vec.push(Point::new(5.0, 2.0));
vec.push(Point::new(3.0, 8.0));
vec.push(Point::new(6.0, 20.0));
vec.push(Point::new(7.0, 25.0));
vec.push(Point::new(10.0, 10.0));
let linestring = LineString::from(vec);
let mut compare = Vec::new();
compare.push(Point::new(5.0, 2.0));
compare.push(Point::new(7.0, 25.0));
compare.push(Point::new(10.0, 10.0));
let ls_compare = LineString::from(compare);
let simplified = linestring.simplifyvw(&30.0);
assert_eq!(simplified, ls_compare)
Loading content...

Implementors

impl<T> SimplifyVW<T, T> for LineString<T> where
    T: Float
[src]

impl<T> SimplifyVW<T, T> for MultiLineString<T> where
    T: Float
[src]

impl<T> SimplifyVW<T, T> for MultiPolygon<T> where
    T: Float
[src]

impl<T> SimplifyVW<T, T> for Polygon<T> where
    T: Float
[src]

Loading content...