Skip to main content

Simplify 2D and 3D Lines

Project description

Simplify 2D and 3D Lines

PyPI Run Tests Docs License

A high performance 2D and 3D line simplification algorithm. Uses Ramer-Douglas-Peucker Line Simplification.

Key Features

  • Simplify 2D and 3D lines
  • Written in C++ with python bindings. Can be used standalone in a C++ project with CMake as well.
  • Based on high-performance Simplify.js

Install with Python and Use

The python library can be installed as so:

  1. pip install simplifyline

Example Use:

from simplifyline import simplify_line_2d, MatrixDouble 
mat2D = MatrixDouble([[0.0, 0.0], [1.0, 1.0], [2.0, 2.0], [3.0, 3.0]])
results_mat2D = simplify_line_2d(mat2D, max_distance=0.1, high_quality=True)
results = np.array(results_mat2D)
np.testing.assert_array_equal(results, np.array([[0.0, 0.0], [3.0, 3.0]]))

See documentation for more details.

Build Project Manually

You can build the project manually in two ways: using python setup.py, or in pure CMake

Build Manually with Python

The root directory setup.py file has been modified to build with CMake. This is meant for python users that need to build manually (for some reason) but are not actively developing or changing the code.

  1. Install conda or create a python virtual environment (Why?). I recommend conda for Windows users.
  2. pip install . - Call from root directory

Build Manually With CMake

Building happens entirely with CMake. This is meant really only for the library developers who are working on C++ and Python in an edit-compile cycle.

C++ Library

  1. mkdir cmake-build && cd cmake-build
  2. cmake .. - Note - For windows also add -DCMAKE_GENERATOR_PLATFORM=x64
  3. cmake --build . -j$(nproc) --config Release

Build options:

SPL_BUILD_BENCHMARKS:BOOL=ON // SPL - Build Benchmarks
SPL_BUILD_EXAMPLES:BOOL=ON // SPL - Build Examples
SPL_BUILD_PYMODULE:BOOL=ON // SPL -Build Python Module
SPL_BUILD_TESTS:BOOL=ON // SPL - Build Tests
SPL_BUILD_WERROR:BOOL=OFF // SPL - Add Werror flag to build (turns warnings into errors)
SPL_WITH_OPENMP:BOOL=ON // SPL - Build with OpenMP Support

Python Extension

This is meant for advanced python users who are actively developing the extension.

  1. Install conda or create a python virtual environment (Why?). I recommend conda for Windows users.
  2. Perform CMake build as described above
  3. cd cmake-build && cmake --build . --target python-package --config Release
  4. cd lib/python_package && pip install -e . . This installs the library in develop/edit mode. To update the python extension in your python virtual environment all you need to do is run step 3 again.

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

simplifyline-0.0.7.tar.gz (28.8 kB view hashes)

Uploaded Source

Built Distributions

simplifyline-0.0.7-cp39-cp39-win_amd64.whl (151.7 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

simplifyline-0.0.7-cp39-cp39-manylinux2010_x86_64.whl (243.9 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

simplifyline-0.0.7-cp38-cp38-win_amd64.whl (151.5 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

simplifyline-0.0.7-cp38-cp38-manylinux2010_x86_64.whl (243.8 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

simplifyline-0.0.7-cp37-cp37m-win_amd64.whl (152.1 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

simplifyline-0.0.7-cp37-cp37m-manylinux2010_x86_64.whl (243.8 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

simplifyline-0.0.7-cp36-cp36m-win_amd64.whl (151.7 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

simplifyline-0.0.7-cp36-cp36m-manylinux2010_x86_64.whl (243.9 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page