Skip to content

Binary version of MIT licensed RDP Point Reduction algorithm

License

Notifications You must be signed in to change notification settings

user01/rdp-rust

Repository files navigation

RDP Rust

Rust

Binary version of MIT licensed RDP implementation by fhirschmann.

Binary wheels are built for Python >= 3.7

Benchmarks show approximately 60x speed increase.

Rust implementation of the Ramer-Douglas-Peucker algorithm (Ramer 1972; Douglas and Peucker 1973) for 2D data.

Installation

pip install rdp-rust

Usage

The inputs must all be floating points values.

>>> import numpy as np
>>> from rdp_rust import reduce_points

>>> arr = np.array([5.0, 0, 4, 0, 3, 0, 3, 1, 3, 2]).reshape(5, 2)
>>> reduce_points(arr, 0.2)
array([[5., 0.],
       [3., 0.],
       [3., 2.]])
>>> import numpy as np
>>> from rdp_rust import mask_points

>>> arr = np.array([5.0, 0, 4, 0, 3, 0, 3, 1, 3, 2]).reshape(5, 2)
>>> mask_points(small_arr, 0.2)
array([ True, False,  True, False,  True])

Example

Demo of RDP

About

Binary version of MIT licensed RDP Point Reduction algorithm

Resources

License

Stars

Watchers

Forks

Packages

No packages published