[−][src]Trait geo::algorithm::simplify::Simplify
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.
Required methods
fn simplify(&self, epsilon: &T) -> Self where
T: Float,
T: Float,
Returns the simplified representation of a geometry, using the Ramer–Douglas–Peucker algorithm
Examples
use geo::algorithm::simplify::Simplify; use geo::{LineString, Point}; 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::from(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::from(compare); let simplified = linestring.simplify(&1.0); assert_eq!(simplified, ls_compare)
Implementors
impl<T> Simplify<T, T> for LineString<T> where
T: Float,
[src]
T: Float,
impl<T> Simplify<T, T> for MultiLineString<T> where
T: Float,
[src]
T: Float,
impl<T> Simplify<T, T> for MultiPolygon<T> where
T: Float,
[src]
T: Float,
impl<T> Simplify<T, T> for Polygon<T> where
T: Float,
[src]
T: Float,