Trait geo::algorithm::simplifyvw::SimplifyVW [−][src]
pub trait SimplifyVW<T, Epsilon = T> { fn simplifyvw(&self, epsilon: &T) -> Self
where
T: CoordFloat; }
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.
An epsilon less than or equal to zero will return an unaltered version of the geometry.
Required methods
fn simplifyvw(&self, epsilon: &T) -> Self where
T: CoordFloat,
[src]
T: CoordFloat,
Returns the simplified representation of a geometry, using the Visvalingam-Whyatt algorithm
See here for a graphical explanation
Examples
use geo::algorithm::simplifyvw::SimplifyVW; use geo::line_string; let line_string = line_string![ (x: 5.0, y: 2.0), (x: 3.0, y: 8.0), (x: 6.0, y: 20.0), (x: 7.0, y: 25.0), (x: 10.0, y: 10.0), ]; let simplified = line_string.simplifyvw(&30.0); let expected = line_string![ (x: 5.0, y: 2.0), (x: 7.0, y: 25.0), (x: 10.0, y: 10.0), ]; assert_eq!(expected, simplified);
Implementors
impl<T> SimplifyVW<T, T> for LineString<T> where
T: CoordFloat,
[src]
T: CoordFloat,
fn simplifyvw(&self, epsilon: &T) -> LineString<T>
[src]
impl<T> SimplifyVW<T, T> for MultiLineString<T> where
T: CoordFloat,
[src]
T: CoordFloat,
fn simplifyvw(&self, epsilon: &T) -> MultiLineString<T>
[src]
impl<T> SimplifyVW<T, T> for MultiPolygon<T> where
T: CoordFloat,
[src]
T: CoordFloat,
fn simplifyvw(&self, epsilon: &T) -> MultiPolygon<T>
[src]
impl<T> SimplifyVW<T, T> for Polygon<T> where
T: CoordFloat,
[src]
T: CoordFloat,