About
clipper-py is a Boost.Python wrapper exposing the C++ translation of the Angus Johnson's Clipper library (6.4 Rev 495).
clipper-py is tested and built against Python 3.8 on Arch Linux.
This project is very much a work-in-progress. Please contribute.
About Clipper
Clipper - an open source freeware library for clipping and offsetting lines and polygons.
The Clipper library performs line & polygon clipping - intersection, union, difference & exclusive-or, and line & polygon offsetting. The library is based on Vatti's clipping algorithm.
Angus Johnson's Clipper library
Install
Dependencies
Linux
- Boost.Python Headers (
libboost-python-dev) compiled against version1.67.0
Debian, Ubuntu
apt-get install libboost-python-dev
Arch
pacman -S libboost-python-dev
Mac
Homebrew
brew install boost-python3
From PyPI
pip install clipper-py
From source
CMake required.
Install:
pip3 install .
Usage
Basic clipping example (based on Angus Johnson's Clipper library):
from clipper_py import Path, Paths, Clipper, IntPoint
subj = Paths()
subj.push(Path().push(IntPoint(180, 200)).push(IntPoint(260, 200)).push(IntPoint(260, 150)).push(IntPoint(180, 150)))
subj.push(Path().push(IntPoint(215, 160)).push(IntPoint(230, 190)).push(IntPoint(200, 190)))
print(subj, subj[0], subj[1])
clip = Paths()
clip.push(Path().push(IntPoint(190, 210)).push(IntPoint(240, 210)).push(IntPoint(240, 130)).push(IntPoint(190, 130)))
print(clip, clip[0])
clipper = Clipper(0)
clipper.add_paths(subj, 'subject', True)
clipper.add_paths(clip, 'clip', True)
solution = clipper.execute('intersection', 'non-zero', 'non-zero')
# solution: [[[240, 200], [190, 200], [190, 150], [240, 150]], [[200, 190], [230, 190], [215, 160]]]
Authors
- The Clipper library is written by Angus Johnson,
- This readme was modified from the original written by various authors of the pyclipper library
- The PyPI
setup.pyfile was modified from a CMake-based build example of the PyBind project
License
- clipper-py is available under a MIT license.
- Pyclipper is available under a MIT license.
- The core Clipper library is available under a Boost Software License. Freeware for both open source and commercial applications.
- cmake_example by Pybind is available under a BSD-style license
Changelog
0.1.5
- Fix complex (
PolyTree-based) clipping to actually work kinda
0.1.4
- Add
PolyTree,PolyNode,PolyNodestypes - Add
executeComplex - Add
open_paths_from_polytree.closed_paths_from_polytree,polytree_to_paths
0.1.3
- Dynamically determine version of Python for Boost.Python headers
- Minor cleanup
0.1.2
- Get MacOS builds working
- Make things a little bit more portable on Linux
0.1.0
- update
setup.pywith urls - Publish to PyPI
0.0.1
Initial project setup.
Metadata
Release files for clipper-py 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| clipper-py-0.1.5.tar.gz | 44.5 kB | Without provenance | Details for clipper-py-0.1.5.tar.gz |
Release files / clipper-py-0.1.5.tar.gz
| Download URL | clipper-py-0.1.5.tar.gz |
|---|---|
| Size | 44.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d9fc6fcf38dad8a04d21155aa72aa751e52e5d0398d5e5df4784cb86edfe1b4
|
|
BLAKE2b-256 checksum How to use checksums |
35106e1531a0e773e9869e2817e44d41cc4536d68657c8e1c883da5ab3f75903
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
|
Security for clipper-py 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.