[][src]Trait geo::algorithm::simplifyvw::SimplifyVwIdx

pub trait SimplifyVwIdx<T, Epsilon = T> {
    fn simplifyvw_idx(&self, epsilon: &T) -> Vec<usize>
    where
        T: Float
; }

Simplifies a geometry, returning the retained indices of the output

This operation uses the Visvalingam-Whyatt algorithm, and does not guarantee that the returned geometry is valid.

Required methods

fn simplifyvw_idx(&self, epsilon: &T) -> Vec<usize> where
    T: Float

Returns the simplified representation of a geometry, using the Visvalingam-Whyatt algorithm

See here for a graphical explanation

Examples

use geo::algorithm::simplifyvw::SimplifyVwIdx;
use geo::{LineString, Point};

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::from(vec);
let mut compare = Vec::new();
compare.push(0_usize);
compare.push(3_usize);
compare.push(4_usize);
let simplified = linestring.simplifyvw_idx(&30.0);
assert_eq!(simplified, compare)
Loading content...

Implementors

impl<T> SimplifyVwIdx<T, T> for LineString<T> where
    T: Float
[src]

Loading content...