Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Tools for 2D open and closed paths

Project description

pypathlib

CircleCI codecov Code style: black PyPi Version GitHub stars

Lightweight package for working with 2D paths/polygons.

import pypathlib

# Create path
path = pypathlib.ClosedPath([[0, 0], [0, 1], [1, 1], [1, 0]])

# Get the squared distance of some points to the path
path.squared_distance([[0.5, 0.5], [0.1, 2.4]])

# Get the _signed_ squared distance of some points to the path
# (negative if inside the path)
path.signed_squared_distance([[0.5, 0.5], [0.1, 2.4]])

# Check if the path contains the points
# (with a tolerance; set negative if you want to exclude the boundary)
path.contains_points([[0.5, 0.5], [0.1, 2.4]], tol=1.0e-12)

pypathlib is fully vectorized, so it's pretty fast. (Not quite as fast as mathplotlib.path.contains_points though.)

Relevant publications

Installation

pypathlib is available from the Python Package Index, so simply type

pip install -U pypathlib

to install or upgrade.

Testing

To run the pypathlib unit tests, check out this repository and type

pytest

Distribution

To create a new release

  1. bump the __version__ number,

  2. publish to PyPi and GitHub:

    make publish
    

License

pypathlib is published under the MIT license.

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pypathlib, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size pypathlib-0.1.2-py2.py3-none-any.whl (5.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size pypathlib-0.1.2.tar.gz (5.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page