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

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

Simplifies a geometry.

The Ramer–Douglas–Peucker algorithm simplifes a linestring. Polygons are simplified by running the RDP algorithm on all their constituent rings. This may result in invalid Polygons, and has no guarantee of preserving topology.

Multi* objects are simplified by simplifing all their constituent geometries individually.

An epsilon less than or equal to zero will return an unaltered version of the geometry.

Required methods

fn simplify(&self, epsilon: &T) -> Self where
    T: GeoFloat
[src]

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

Examples

use geo::algorithm::simplify::Simplify;
use geo::line_string;

let line_string = line_string![
    (x: 0.0, y: 0.0),
    (x: 5.0, y: 4.0),
    (x: 11.0, y: 5.5),
    (x: 17.3, y: 3.2),
    (x: 27.8, y: 0.1),
];

let simplified = line_string.simplify(&1.0);

let expected = line_string![
    (x: 0.0, y: 0.0),
    (x: 5.0, y: 4.0),
    (x: 11.0, y: 5.5),
    (x: 27.8, y: 0.1),
];

assert_eq!(expected, simplified)
Loading content...

Implementors

impl<T> Simplify<T, T> for LineString<T> where
    T: GeoFloat
[src]

impl<T> Simplify<T, T> for MultiLineString<T> where
    T: GeoFloat
[src]

impl<T> Simplify<T, T> for MultiPolygon<T> where
    T: GeoFloat
[src]

impl<T> Simplify<T, T> for Polygon<T> where
    T: GeoFloat
[src]

Loading content...