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

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§

source

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

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

Examples
use geo::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);

Implementors§

source§

impl<T> SimplifyIdx<T> for LineString<T>where T: GeoFloat,