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.3-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47c4f0dc4c8943986e821672b504cb1b8d3e36ddaa3079482808d1efa3b8342d |
|
MD5 | f5875d23943ee814ae818280b493b34e |
|
BLAKE2b-256 | 74a584840d3d335e1c85299a58b71fb188e6fc42de37ea86aefe90980873d3a9 |
Hashes for pybind11_rdp-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | faf80d3fc2c1727b9f9cf2971e19387ee1155f31cc7b4e181db314ae157cd874 |
|
MD5 | 2d5ac5d8a930464a05d7b270978b025b |
|
BLAKE2b-256 | c75822e9ce61331f3923cc2c9e87d0dcac4fa9359727ad7ee3115eb81b6b85bc |
Hashes for pybind11_rdp-0.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b495edb3d438a557361b7ca9af34e7636f2fd627b53b239127b5c3679d435669 |
|
MD5 | b61a3cf567502b67ccfbad69ce5f0fad |
|
BLAKE2b-256 | 29d03b15d863fda057825ae50c38418bb5e49a0bf90735844f847ef59e9f502e |
Hashes for pybind11_rdp-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39f795c727458d08b453fb0312e0e75e83f9c089cba8dbb0bfebc573b6922401 |
|
MD5 | eee7e6293c499015dfcc2f0b7961a38f |
|
BLAKE2b-256 | 809a4df3c666c1a4a5b0018860e5d14878e5b5afe6d31508be69b9e6eccbf03c |
Hashes for pybind11_rdp-0.1.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8b73e8ee6aaf1622512402ac539fa279e0398b5ef9dc0660d65758b067f8f30 |
|
MD5 | dc95aed7d4ca1daf3d1d3e709d3b363c |
|
BLAKE2b-256 | e4385da396aad0611119dd3216c163a9770584d17de4b8b0ab13aa9b38c2df07 |
Hashes for pybind11_rdp-0.1.3-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 139247058b6e25dab4061bdec1584ea4566e3306f0f24979af7b34717c19ab2c |
|
MD5 | f68c28665c979caa6a119f7706eb3e87 |
|
BLAKE2b-256 | e03fe31d2ef770af0a98a38a80b6fe2c2740e92b874775d2292b2fb6d84e1931 |
Hashes for pybind11_rdp-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 099a322c20722e53495bad22ee90d3af3f4f5d8d4fb27fda2b9898eea4894de9 |
|
MD5 | c6413cea06ece455f9dd92ba78a88a7f |
|
BLAKE2b-256 | 80af58a4b8c2613cd609afdf8ce222654a58cb11cac5143f39a810b1fe6ee826 |
Hashes for pybind11_rdp-0.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91a14fc5454ae3c85a69f13824afdc639775cfbca70a028c89410c9fb9d7aa65 |
|
MD5 | 3e66593a7e07fd672dac3486a375b5b0 |
|
BLAKE2b-256 | a8df0c3b840a27ef561ba0e19ea3ae1b6b2aa6cd2305e4c4f7b8ed53665680ec |
Hashes for pybind11_rdp-0.1.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 839410f104579bd872e456744a41c2d6df2cba83f967588ffba7d978bc3b82c7 |
|
MD5 | eb72dfc483d0a0725a4997a8d2b08b68 |
|
BLAKE2b-256 | a1335157ddc9ecdd354fa1b0b61e35b0503e7e49478b3ae2d14c91a929a0b191 |
Hashes for pybind11_rdp-0.1.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd20ad1a64688cd1518d677424449696432fbc8527109cf26b18c343a320d6c7 |
|
MD5 | b59fd3c4b2f0284607b0740087e04d4f |
|
BLAKE2b-256 | 9cf9236b6ff9e66689e4c899924d960f7b1379fd4965db5ee89535e242cb483f |
Hashes for pybind11_rdp-0.1.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ca1d756c014f4a1f2b352aab91e7d222c08022c6469c7bafa845c37d54cfbac |
|
MD5 | 99134c3f20b39bd6ddcc06543f31e866 |
|
BLAKE2b-256 | fcc8ddb51f6f7159a32a35efd0ee3828e33609f7c74b35acb95ae2c9ce874493 |
Hashes for pybind11_rdp-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 341b6d0805db3684a22dfd5120e7ab29dc6a808889f829f89d17b147333a4700 |
|
MD5 | c9cf5c9d218d8f77da641141f6c020c3 |
|
BLAKE2b-256 | 5723b2e988c5c3ff437f30126c1139571fc3f698e4ebcf61aa4601c85597ee7e |
Hashes for pybind11_rdp-0.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bf95983c61330b7f263db7603632c552e2d8a9acb596c7149bfc17d09d52b06 |
|
MD5 | 41e3b2a1b5e2a61d6610e1251dd823c7 |
|
BLAKE2b-256 | 8c666aff547a1408024c17a5c69eb0039c8921b8a899ced34540122575d4ec52 |
Hashes for pybind11_rdp-0.1.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 647935f02f12d23c15f3cf9bd9d2059123adb8f060bc82e1399651332b91f06f |
|
MD5 | c0429a08be591f9559673afc81ab6166 |
|
BLAKE2b-256 | a979283fac2a590d25e9ecb15ba01f37e16d2562b31a51cfc5d7451c2ed3237c |
Hashes for pybind11_rdp-0.1.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07ce5d43ffbc6deaf75d78a9186825c5dcea98d2d7e571f6491ff81d36fb8cc3 |
|
MD5 | a27f37010e47e8614a4007cbdb19881f |
|
BLAKE2b-256 | 6b0026cdd7cf8601dcedfb7e3a23192f0e1e0fac82a204affeaf8bd5338f022f |
Hashes for pybind11_rdp-0.1.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cb203215cdc456b721826eb36768aca42503fc93555c8535ce637cae5d9ebf9 |
|
MD5 | 1fafd7c3e26c4a8f67a928a3b0eba528 |
|
BLAKE2b-256 | 74d47ae4656c8fd0987d8a3f0f39268eba33bc739913a2c239a698d63681a733 |
Hashes for pybind11_rdp-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a4d369b446b2275ca9dc2d08cede1e7a586a3e3d44b64836e585b22eb56eac3 |
|
MD5 | 469c8078467b49b5557c821c95029a65 |
|
BLAKE2b-256 | 428d65fc53ddcd8a4d0958ccfc46b1cd6909119ee8e83ef5993a51594861d847 |
Hashes for pybind11_rdp-0.1.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 638fa6ef1f460fff5790803496a7956861a2bfeb4f7c542dfb72890f626f9061 |
|
MD5 | a0d9b31cef0a6e63a32555e48e30427f |
|
BLAKE2b-256 | 8962d091cdc36323dd76ff297ea76edcddddfeb563cd93dc88092620034f3d97 |
Hashes for pybind11_rdp-0.1.3-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5b3f30d4575b7c44153ed537b5a22fb4ad8d22ca1e81d0e2e326c9273650b9c |
|
MD5 | 4dab704de4da9cf2ee78c7aca214890e |
|
BLAKE2b-256 | 00af949497a809370161e556357e2949a17752705efff319002208bd861e4bb3 |
Hashes for pybind11_rdp-0.1.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd5bb0eeb91ceef4c7c5c7f5ae5cdb84e3f5d559cbf2b20a61f7022e7b40a144 |
|
MD5 | 5368c802d9d7358019f567cf16d8298f |
|
BLAKE2b-256 | 902426ba9009b01c82261201c02f418feb9fe1db7a3f38407fce43009be5e396 |
Hashes for pybind11_rdp-0.1.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 670c4070404939235bf5888a22f20dfc0041e4ac30d7438ad783bd48d3652607 |
|
MD5 | 40da6f61613946cdfb2e2527e9db87d4 |
|
BLAKE2b-256 | 2a6242dd98bf54398c9d9a28a47f3b20c6b4182edb0d7fbfc58d364bba1ce37b |
Hashes for pybind11_rdp-0.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14a38482cf5c13ccff8204b68ee5b249656fd32810fab0f5dc0e75ab770ee9db |
|
MD5 | 17cd4c501ee4c0fc212ca0ef5a4d9539 |
|
BLAKE2b-256 | 114045117ec9baa8af46af79ee4e5d47eaf12d5c7e433d220298c530734e99db |
Hashes for pybind11_rdp-0.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bc26cd5c38f7a161b63b1bd4912fbfe2857d2ecfe28b295a72868baa62c4a34 |
|
MD5 | 0772ecce6bb2eb4fbde7b655c2f5fd7b |
|
BLAKE2b-256 | 6edf7e907444f573a2c69cf3e239633b5c28e5f93fd7c03e97eeb98c097cd48a |
Hashes for pybind11_rdp-0.1.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 983f5ef130e66d8d8b910bc93d68e641cb722d6772d425329551fda0154479b1 |
|
MD5 | dea88b7b68dee3fe22fbf93411c5deb7 |
|
BLAKE2b-256 | 58717ef2b3afdf2ee215dcfc4a4b92bf5aee50c5070ba175e959fc1dc012704a |
Hashes for pybind11_rdp-0.1.3-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82f45ed27b83b300cecf1585d8ac636a42f99bf682d40bad2e3b111a6b42f2ec |
|
MD5 | 1c0fd7a0fcc99c597368fab5c161f007 |
|
BLAKE2b-256 | 5042b024f310c4a3bfc76fc25c965c44505b2dea644cac34ea5c02c8df86c4a4 |
Hashes for pybind11_rdp-0.1.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dac05e31d7055639b5aee71c6ce0970bf010f482a0349127b42a19028b473673 |
|
MD5 | 9e738f957ef2faa2eb2e7c5964763693 |
|
BLAKE2b-256 | 88d59209c6a7ae41cefd1fc7d1b2c33de0a755830591c415ec499a22e5c4815e |
Hashes for pybind11_rdp-0.1.3-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87d26ac1d3969d179424acb8b9e7d5cc612f65d11f4e561acbfb8c87f345436e |
|
MD5 | 2e516e648d1e35efa52942d0af279db9 |
|
BLAKE2b-256 | f3ffeb0e4ffd6a515bc181bd48543286c03eeaa28d081752a13a7f49d2f001aa |
Hashes for pybind11_rdp-0.1.3-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54761c9b7f9cff215f06b8a0a7a94270f409f67ecbe475195b4738cede160418 |
|
MD5 | a08c131f419a1f69cb5cdb23c41146b2 |
|
BLAKE2b-256 | fda87548d62fcf76bcea80a7c11b68d387b63908de18d3353870e6b17041999c |