Trait geo::algorithm::simplify::SimplifyIdx[][src]

pub trait SimplifyIdx<T, Epsilon = T> {
    fn simplify_idx(&self, epsilon: &T) -> Vec<usize>
    where
        T: GeoFloat
; }

Simplifies a geometry, returning the retained indices of the input.

This operation uses the Ramer–Douglas–Peucker algorithm and does not guarantee that the returned geometry is valid.

An epsilon less than or equal to zero will return an unaltered version of the geometry.

Required methods

fn simplify_idx(&self, epsilon: &T) -> Vec<usize> where
    T: GeoFloat
[src]

Returns the simplified indices of a geometry, using the Ramer–Douglas–Peucker algorithm

Examples

use geo::algorithm::simplify::SimplifyIdx;
use geo::line_string;

let line_string = line_string![
    (x: 0.0, y: 0.0),
    (x: 5.0, y: 4.0),
    (x: 11.0, y: 5.5),
    (x: 17.3, y: 3.2),
    (x: 27.8, y: 0.1),
];

let simplified = line_string.simplify_idx(&1.0);

let expected = vec![
    0_usize,
    1_usize,
    2_usize,
    4_usize,
];

assert_eq!(expected, simplified);
Loading content...

Implementors

impl<T> SimplifyIdx<T, T> for LineString<T> where
    T: GeoFloat
[src]

Loading content...