C++/pybind11/NumPy implementation of the Ramer-Douglas-Peucker algorithm (Ramer 1972; Douglas and Peucker 1973) for 2D and 3D data.
Project description
Ramer-Douglas-Peucker Algorithm (c++ binding for python via pybind11)
A speed up (~8000x) version of python version of rdp.
C++/pybind11/NumPy implementation of the Ramer-Douglas-Peucker algorithm (Ramer 1972; Douglas and Peucker 1973) for 2D and 3D data.
The Ramer-Douglas-Peucker algorithm is an algorithm for reducing the number of points in a curve that is approximated by a series of points.
Installation
via pip
pip install -U pybind11-rdp
from source
git clone --recursive https://github.com/cubao/pybind11-rdp
pip install ./pybind11-rdp
Or
pip install git+https://github.com/cubao/pybind11-rdp.git
(you can build wheels for later reuse by pip wheel git+https://github.com/cubao/pybind11-rdp.git
)
Usage
Test installation: python -c 'from pybind11_rdp import rdp; print(rdp([[1, 1], [2, 2], [3, 3], [4, 4]]))'
Simple pythonic interface:
from pybind11_rdp import rdp
rdp([[1, 1], [2, 2], [3, 3], [4, 4]])
[[1, 1], [4, 4]]
With epsilon=0.5:
rdp([[1, 1], [1, 1.1], [2, 2]], epsilon=0.5)
[[1.0, 1.0], [2.0, 2.0]]
Numpy interface:
import numpy as np
from pybind11_rdp import rdp
rdp(np.array([1, 1, 2, 2, 3, 3, 4, 4]).reshape(4, 2))
array([[1, 1],
[4, 4]])
Tests
make python_install
make python_test
Notice
As https://github.com/fhirschmann/rdp/issues/13 points out, pdist
in rdp
is WRONGLY Point-to-Line distance.
We use Point-to-LineSegment distance.
from rdp import rdp
print(rdp([[0, 0], [10, 0.1], [1, 0]], epsilon=1.0)) # wrong
# [[0.0, 0.0],
# [1.0, 0.0]]
from pybind11_rdp import rdp
print(rdp([[0, 0], [10, 0.1], [1, 0]], epsilon=1.0)) # correct
# [[ 0. 0. ]
# [10. 0.1]
# [ 1. 0. ]]
References
Douglas, David H, and Thomas K Peucker. 1973. “Algorithms for the Reduction of the Number of Points Required to Represent a Digitized Line or Its Caricature.” Cartographica: The International Journal for Geographic Information and Geovisualization 10 (2): 112–122.
Ramer, Urs. 1972. “An Iterative Procedure for the Polygonal Approximation of Plane Curves.” Computer Graphics and Image Processing 1 (3): 244–256.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pybind11_rdp-0.1.4-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d26b11bd366118dcf3205f6279624a8547df4257092e89ad449cf0328e576034 |
|
MD5 | 6a98e777cf60ead934985379370f96dd |
|
BLAKE2b-256 | 80e6789e1fbe217144e1cb73cffbb8075901414e456b78550f0c266a67d72cb3 |
Hashes for pybind11_rdp-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99f6ff992cacd1dea55319aad130bd3443c9bbdc214e20e829395c3de713a38d |
|
MD5 | d51ea5cfc2f1b9dec534b6e658595719 |
|
BLAKE2b-256 | beead571290daa592bf290ce19501c89cf54bc79bfd9fdff53710dc8b57d4473 |
Hashes for pybind11_rdp-0.1.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a64b48ec590094c5bf6aa80a5acb857ef5059d9b045f5f675ed9dd845519ae94 |
|
MD5 | e2d36f87ddc669e62a9e5fb551cd00ce |
|
BLAKE2b-256 | 4d3106901bc751524ee88e1f2b2798770ba4e5227798c2f18ef13d1d5271fc56 |
Hashes for pybind11_rdp-0.1.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2202bac072ae76feb7d5714b6e651a17a24c5c77e6dd34ec4d50b912bd0e535b |
|
MD5 | aa3d4af678a92bad96d79a9a1a708edd |
|
BLAKE2b-256 | 3684ab7b5bda249f289747eed1dc982339522f61f257f63dbf8b33e4304d7a0c |
Hashes for pybind11_rdp-0.1.4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 472abbee80ecf23090f3c61eac9cd126ddad71bb1d4fc31c14ac842ec3af6fb0 |
|
MD5 | d1db9c7337bc3a509fc577baefe4f7b5 |
|
BLAKE2b-256 | a4cf5d39172deee59484a44f5d212b879d2b7709aea4fe7f6708587bec636a5b |
Hashes for pybind11_rdp-0.1.4-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1637e1617de030e5c33d91d8c13c7efef82df6ba152f7c9d809d4aed9362674e |
|
MD5 | 9bbcaa868b7f1aae699ebf875fdd5ef8 |
|
BLAKE2b-256 | 74d844459cafc414158db2cc36f0d55afd7e60c03413eb0762c240e62475fb1b |
Hashes for pybind11_rdp-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eac88bdaedc04b8a4b30b91c9fc03ac34bb4232ccf5456da9019771199500d50 |
|
MD5 | d1bd586ca9bc2276af2582ebf97a2ab4 |
|
BLAKE2b-256 | 991fd8a597d9c107a6aa1a3156a6a541c1d15a4850def75f0c80941917f411c2 |
Hashes for pybind11_rdp-0.1.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f91a29162c0b2fbad4c767301daa4e8271b0b94c0bf84ed434be48dfaf09325b |
|
MD5 | d661b1bcc4e81dae4f27c152eab086ab |
|
BLAKE2b-256 | 57c43d99c792e2ad8d11dd844538a4c060f14a198aa33ce150eb39f831b28e9c |
Hashes for pybind11_rdp-0.1.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8753ad4edba4044de84a276424f175b9bb1a04d2972aa879b948251cee4aa697 |
|
MD5 | 862937162d118183fd8dbd7c4daf11a2 |
|
BLAKE2b-256 | ed3282b249749528f498d38504757e012dd0272675990ea85437e32ec2e82cac |
Hashes for pybind11_rdp-0.1.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a62a1068613f6a214d479294a2f19fea4f09521ae8ad53ea8a8d23552944f168 |
|
MD5 | 0de55a7a49edec5258a8d91ae7c95b00 |
|
BLAKE2b-256 | dc0d23d7119c305091818db51b5fb0764ec5f8bb97017d9b055e673bb9fdb4d4 |
Hashes for pybind11_rdp-0.1.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5577b8cf4ad7196aed8d8cbe7a7313f60c8371cac4f273959dc05170e15c5ac2 |
|
MD5 | 24714a9a89f79308625c285f74a9e99f |
|
BLAKE2b-256 | 971ad639f7c8fe06d2a0c5174f628b2b73de90edcb38ab8f275ac464a0372c3e |
Hashes for pybind11_rdp-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8820c826303c4bb4dd6de5a6d3a4ddd581614f295e66d34e60e62f807314de6c |
|
MD5 | c2490ccd6b3fd0dd12ccca0730ea8aa7 |
|
BLAKE2b-256 | 7cf0725919366a00a901357db784b0fdead9f4234a1b5c4fd910a68549336a7a |
Hashes for pybind11_rdp-0.1.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b38a99f1ae668cf8e9637bfa3c3f4f9eefb8ef74facf78985f958beff0dc6fb |
|
MD5 | 441d7a85c9b14e9f26cce273812b91ce |
|
BLAKE2b-256 | 40c72670d2e29d86c214c25fa20903fcdef6f9f17b6fc3b9ebed10535fd16302 |
Hashes for pybind11_rdp-0.1.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec54dfb05f9bc948839ca081177627b2cc291c09d3f8c87bfa138bb9b367f60d |
|
MD5 | 7d3ed2cb9f8aac3a64cfae4c4059f9bc |
|
BLAKE2b-256 | 4c86c041a61257665a44c87e62100cd05d90c226c163a794a0a8439e0ea87d3f |
Hashes for pybind11_rdp-0.1.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47a8204df85527dfea72283dd4e4f977425b22dcfb1286dc39c07aa7d99eba22 |
|
MD5 | 0cf060de99079d0fea8f6daed1d5188f |
|
BLAKE2b-256 | 183de489e9eac3c73db5d5deb55b1aec66e35ffd45f76b3827d316e25ae1a668 |
Hashes for pybind11_rdp-0.1.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc4511fc5d27d6202647a57443ece07a3a81bf742117bc1a832cb0aa9d02a2f3 |
|
MD5 | 6eb462683cf16590f979c69730934cd7 |
|
BLAKE2b-256 | 631af6c795d0b12fc78dee77a2b67a07d5c4e111b8b6741a0e1d13f18f259478 |
Hashes for pybind11_rdp-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a042581be0e4c30ee39b23d0d5c384dbbcd7f27a2c829ae62b5b081b94a5396f |
|
MD5 | 97bcdb0a8aece3434d93c834b98be322 |
|
BLAKE2b-256 | 5ac6f7323ce129fa1469c98b4d29140b01b4fb5579bec4c9ee8617d66c1bcaeb |
Hashes for pybind11_rdp-0.1.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e8374cd0687c8f42545c8f1ba0b311a582c96403a1ee996924f6185212ada5d |
|
MD5 | 2306783356622675a7209182224732be |
|
BLAKE2b-256 | a5f4e62698f9c308ec7b49c3dbb28884db5a26ec8f8c4f832c60ad286e373627 |
Hashes for pybind11_rdp-0.1.4-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34519161edf243812b68726931570c25bf9ef1f309c34acf272d806941e3d126 |
|
MD5 | 203145c7854ba04e5a107926b01d1459 |
|
BLAKE2b-256 | 84a87854e9707205c72a361f2a11010f80cd6dd19578d4ff4be333d33d3b94c1 |
Hashes for pybind11_rdp-0.1.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 585fa665656fced65d2b85d519d4c3e2cb2f4678525c5354285271ae376818da |
|
MD5 | cc2a80800dbb33f90dbdcaa8fb7ad0c7 |
|
BLAKE2b-256 | 1a90fba7c0c6da8a356926937c6309fdf1f314fd38aa3160b458f01ace82413c |
Hashes for pybind11_rdp-0.1.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ffbb5aaa79c3a6f8aca11242a546e84f8ddfd1b4d88762babd9b3a8f70cc01c |
|
MD5 | a1c27ad7faadbed4eca457f9495cff85 |
|
BLAKE2b-256 | 1291a4a065b6a6fc5f05082ed3f22a7772af8a99c3aafbf4186a36f7820ec797 |
Hashes for pybind11_rdp-0.1.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb3f71c1e6c1c0fed74e8bfbc053d94032fd06e146b2400a97dda9ef30b6d064 |
|
MD5 | 04b829308934646ec79e5f2af61a0527 |
|
BLAKE2b-256 | 8faaf29b5e725c10e4731e58218ab4a325c52eb64f5caac7e11a5e00966d87a7 |
Hashes for pybind11_rdp-0.1.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4ef2871027e93605665a2ec4bc9f1ff8813d9e54b045d6c42534cb18a0e35da |
|
MD5 | 8559b959f850579ee32bf66de9abbeb4 |
|
BLAKE2b-256 | 9ba148aaff33d3bde78abf73a40752b5c14bbc332093da8e6b4c6b921b85e5ff |
Hashes for pybind11_rdp-0.1.4-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fccc689e8a56ba2be4f4839155145e53f0946d8b777c973e71fa14929748b4c |
|
MD5 | 10145059d8fd607fa0c187e3af74c5f2 |
|
BLAKE2b-256 | 41cd2aa33f7318fc99713ebb9e9cc32cc3914a31a9f5a8ad0d300bdb1785ccae |
Hashes for pybind11_rdp-0.1.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dae546f6fefcc690fb71fd13b0c9c78bad15c53f39749e03858f20ac9931b52a |
|
MD5 | fff30be98e1f49332948a11f37b2b08b |
|
BLAKE2b-256 | b4246caf261204d2c716e6a5480b26aa7cbf5db907a21a15f191e3a66c379d46 |
Hashes for pybind11_rdp-0.1.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4786abe2dc8c3f7433ea49d432c5b12277fb4fc5f14570a6253f88636c7a9f5 |
|
MD5 | d4b0f717b7c5f234a13fc3acb27676b9 |
|
BLAKE2b-256 | bb5cfd881e1c4a6c2d7a2da806d6dfa0b04530735719cafeea42df5bae966d30 |
Hashes for pybind11_rdp-0.1.4-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93e46034a68ec78b048d3b88919f0925799a3d4c0d61ef1b1458124d4ec9196b |
|
MD5 | 6d6273a97c97f9d437727a7260638e6b |
|
BLAKE2b-256 | c8ea5ff83335fa636104dcbc2f6516b3017bfff8c783c74c38dd05a08b3f0444 |
Hashes for pybind11_rdp-0.1.4-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22613f08a42c167f82ce3bd594a16a8d6c3ef736e67dc468e48a4acb71bd31d0 |
|
MD5 | 05562c9159150e52e29920f9d31b7888 |
|
BLAKE2b-256 | d3860409811165a8c90e9ce486e045cf01f14ce5fa510612b94ca2d484c876af |