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

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

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.

Required methods

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

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: Float
[src]

Loading content...