Trait geo::algorithm::simplifyvw::SimplifyVW
[−]
[src]
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,
T: Float,
Returns the simplified representation of a geometry, using the Visvalingam-Whyatt algorithm
See here for a graphical explanation
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(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(compare); let simplified = linestring.simplifyvw(&30.0); assert_eq!(simplified, ls_compare)
Implementors
impl<T> SimplifyVW<T> for LineString<T> where
T: Float,impl<T> SimplifyVW<T> for MultiLineString<T> where
T: Float,impl<T> SimplifyVW<T> for Polygon<T> where
T: Float,impl<T> SimplifyVW<T> for MultiPolygon<T> where
T: Float,