Trait geo::algorithm::simplifyvw::SimplifyVW
[−]
[src]
pub trait SimplifyVW<T, Epsilon = T> {
fn simplifyvw(&self, epsilon: &T) -> Self where T: Float;
}
Required Methods
fn simplifyvw(&self, epsilon: &T) -> Self where T: Float
Returns the simplified representation of a LineString, 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