generated from cubao/cmake_example
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* clean CI * add python part, add iter implementation * similar API as rdp * add fhirschmann/rdp test * test pass * update readme * lint code * fix * 0.1.2 * release
- Loading branch information
1 parent
a2c8031
commit 7f5c0dd
Showing
14 changed files
with
485 additions
and
129 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import sys | ||
|
||
import numpy as np | ||
from _pybind11_rdp import LineSegment # noqa | ||
from _pybind11_rdp import __version__ # noqa | ||
from _pybind11_rdp import rdp as _rdp # noqa | ||
from _pybind11_rdp import rdp_mask as _rdp_mask # noqa | ||
|
||
|
||
def __notify_dist_fn(dist): | ||
if dist is None: | ||
return | ||
print( | ||
"we don't support dist function, the only built-in dist function is dist(point,line_segment) (NOT dist(point,line))", | ||
file=sys.stderr, | ||
) | ||
|
||
|
||
def rdp_rec(points, epsilon: float, dist=None): | ||
__notify_dist_fn(dist) | ||
points = np.asarray(points, dtype=np.float64) | ||
return _rdp(points, epsilon=epsilon, recursive=True) | ||
|
||
|
||
def rdp_iter(points, epsilon: float, dist=None, return_mask=False): | ||
__notify_dist_fn(dist) | ||
points = np.asarray(points, dtype=np.float64) | ||
if return_mask: | ||
return _rdp_mask(points, epsilon=epsilon, recursive=False) | ||
return _rdp(points, epsilon=epsilon, recursive=False) | ||
|
||
|
||
def rdp(points, epsilon: float = 0.0, dist=None, algo="iter", return_mask=False): | ||
__notify_dist_fn(dist) | ||
points = np.asarray(points, dtype=np.float64) | ||
recursive = "iter" != algo | ||
if return_mask: | ||
return _rdp_mask(points, epsilon=epsilon, recursive=recursive) | ||
return _rdp(points, epsilon=epsilon, recursive=recursive) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
import subprocess | ||
import sys | ||
|
||
from setuptools import Extension, setup | ||
from setuptools import Extension, find_packages, setup | ||
from setuptools.command.build_ext import build_ext | ||
|
||
# Convert distutils Windows platform specifiers to CMake -A arguments | ||
|
@@ -122,13 +122,14 @@ def build_extension(self, ext): | |
# logic and declaration, and simpler if you include description/version in a file. | ||
setup( | ||
name="pybind11_rdp", | ||
version="0.1.1", | ||
version="0.1.2", | ||
author="tzx", | ||
author_email="[email protected]", | ||
url="https://github.com/cubao/pybind11-rdp", | ||
description="C++/pybind11/NumPy implementation of the Ramer-Douglas-Peucker algorithm (Ramer 1972; Douglas and Peucker 1973) for 2D and 3D data.", | ||
long_description=open("README.md", encoding="utf-8").read(), | ||
long_description_content_type="text/markdown", | ||
packages=find_packages(), | ||
ext_modules=[CMakeExtension("pybind11_rdp")], | ||
cmdclass={"build_ext": CMakeBuild}, | ||
zip_safe=False, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.