Python port of polygon clipping algorithm by F. Martinez et al.
Project description
martinez
In what follows
pythonis an alias forpython3.5or any later version (python3.6and so on).
Installation
Install the latest pip & setuptools packages versions:
python -m pip install --upgrade pip setuptools
User
Download and install the latest stable version from PyPI repository:
python -m pip install --upgrade martinez
Developer
Download the latest version from GitHub repository
git clone https://github.com/lycantropos/martinez.git
cd martinez
Install dependencies:
python -m pip install --force-reinstall -r requirements.txt
Install:
python setup.py install
Usage
>>> from martinez.contour import Contour
>>> from martinez.point import Point
>>> from martinez.polygon import Polygon
>>> left_polygon = Polygon([Contour([Point(0.0, 0.0), Point(2.0, 0.0), Point(2.0, 2.0), Point(0.0, 2.0)], [], True)])
>>> right_polygon = Polygon([Contour([Point(1.0, 1.0), Point(3.0, 1.0), Point(3.0, 3.0), Point(1.0, 3.0)], [], True)])
>>> from martinez.boolean import OperationType, compute
>>> compute(left_polygon, right_polygon, OperationType.INTERSECTION)
Polygon([Contour([Point(1.0, 1.0), Point(2.0, 1.0), Point(2.0, 2.0), Point(1.0, 2.0)], [], True)])
>>> compute(left_polygon, right_polygon, OperationType.UNION)
Polygon([Contour([Point(0.0, 0.0), Point(2.0, 0.0), Point(2.0, 1.0), Point(3.0, 1.0), Point(3.0, 3.0), Point(1.0, 3.0), Point(1.0, 2.0), Point(0.0, 2.0)], [], True)])
>>> compute(left_polygon, right_polygon, OperationType.DIFFERENCE)
Polygon([Contour([Point(0.0, 0.0), Point(2.0, 0.0), Point(2.0, 1.0), Point(1.0, 1.0), Point(1.0, 2.0), Point(0.0, 2.0)], [], True)])
>>> compute(left_polygon, right_polygon, OperationType.XOR)
Polygon([Contour([Point(0.0, 0.0), Point(2.0, 0.0), Point(2.0, 1.0), Point(1.0, 1.0), Point(1.0, 2.0), Point(0.0, 2.0)], [], True), Contour([Point(1.0, 2.0), Point(2.0, 2.0), Point(2.0, 1.0), Point(3.0, 1.0), Point(3.0, 3.0), Point(1.0, 3.0)], [], True)])
original C++ implementation can be invoked by importing from _martinez module instead.
Development
Bumping version
Preparation
Install bump2version.
Pre-release
Choose which version number category to bump following semver specification.
Test bumping version
bump2version --dry-run --verbose $CATEGORY
where $CATEGORY is the target version number category name, possible
values are patch/minor/major.
Bump version
bump2version --verbose $CATEGORY
This will set version to major.minor.patch-alpha.
Release
Test bumping version
bump2version --dry-run --verbose release
Bump version
bump2version --verbose release
This will set version to major.minor.patch.
Running tests
Install dependencies:
python -m pip install --force-reinstall -r requirements-tests.txt
Plain
pytest
Inside Docker container:
docker-compose up
Bash script (e.g. can be used in Git hooks):
./run-tests.sh
PowerShell script (e.g. can be used in Git hooks):
.\run-tests.ps1
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file martinez-0.5.3.tar.gz.
File metadata
- Download URL: martinez-0.5.3.tar.gz
- Upload date:
- Size: 27.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.5.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6fbb7d7c7e31fc3595b0479fd112cbd212604e63c4cb77b8c677782d9d89a3f
|
|
| MD5 |
61d9557ae450c0c5bd5ff69a757f7115
|
|
| BLAKE2b-256 |
d82d6ad3f2aa7cf57e1f6fcdb6eeed51be38c8e5d78da6af6fcc43efb10b4b07
|
File details
Details for the file martinez-0.5.3-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: martinez-0.5.3-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 157.7 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c74b1fc0e50e1d28381daa4c9aa9d527663a67e1f071ed27b6cac5fdc8e540a5
|
|
| MD5 |
7ffd4036dfcc1d1057f9bf0f9506542b
|
|
| BLAKE2b-256 |
cf332a2adb574672a27c9caf8ff3b0f7988c8e689bc6ada11019471d16cb5fe8
|
File details
Details for the file martinez-0.5.3-cp38-cp38-win32.whl.
File metadata
- Download URL: martinez-0.5.3-cp38-cp38-win32.whl
- Upload date:
- Size: 138.1 kB
- Tags: CPython 3.8, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49e9db4eade315eefa9796f95d8d467e51a7a1aa8420be6ce950140f8dc2033a
|
|
| MD5 |
300bf2b66fef4a168e0d18f1ba00426d
|
|
| BLAKE2b-256 |
31ee5e60b113ba315c50363b87270a3e954d064d3e189d918e5d94a5c35041b8
|
File details
Details for the file martinez-0.5.3-cp38-cp38-manylinux2010_x86_64.whl.
File metadata
- Download URL: martinez-0.5.3-cp38-cp38-manylinux2010_x86_64.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e19e8e2b99195e637c307acef6ad1909eaf7069a9a8bd7e135d7e25ebac128d6
|
|
| MD5 |
3118ef42ce9b4ada02117ddee5c485b8
|
|
| BLAKE2b-256 |
0e486cc5f7ad54a873823f0c124fb2ebfa1f9603d2be24f3c2ed00b4ade3bdbc
|
File details
Details for the file martinez-0.5.3-cp38-cp38-manylinux2010_i686.whl.
File metadata
- Download URL: martinez-0.5.3-cp38-cp38-manylinux2010_i686.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.8, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8112becc558190c00eb703c3e6593f6e3ad2bf5d645253c69cbe54df4e370f6d
|
|
| MD5 |
30bde40247bee734981d616014fe19cb
|
|
| BLAKE2b-256 |
853c2783af71015788a6c889161b60fee37053144a44664bdf6380d023b36157
|
File details
Details for the file martinez-0.5.3-cp38-cp38-macosx_10_9_x86_64.whl.
File metadata
- Download URL: martinez-0.5.3-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 257.8 kB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fca2396fce183e9321f0aabf877f08f14efb42b3cad6fcb7e3b120f6c9378ac3
|
|
| MD5 |
d8c2352bf81c2aa4752119649a5a50bf
|
|
| BLAKE2b-256 |
6fa75ce77dee34f8a0e404d4e45aeabd0849b3f1fab7ef816797b8500bd774a9
|
File details
Details for the file martinez-0.5.3-cp37-cp37m-win_amd64.whl.
File metadata
- Download URL: martinez-0.5.3-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 157.5 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
501b985ac94ddb62d14d4131bd65184846ec27e8ead674f0c31acb38a22ab796
|
|
| MD5 |
7d12c40953061219e97409632e2a1c7a
|
|
| BLAKE2b-256 |
7743e05e034d08180fc964354f7cc279a5dec37421e166aac65ed7cf9df3e8bb
|
File details
Details for the file martinez-0.5.3-cp37-cp37m-win32.whl.
File metadata
- Download URL: martinez-0.5.3-cp37-cp37m-win32.whl
- Upload date:
- Size: 140.0 kB
- Tags: CPython 3.7m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f870c86fe2310f36181bf980177d670740f79cd2e7f5fbef54978278ae4884f
|
|
| MD5 |
29e012fd9b4b9d77bb96b00ebb453655
|
|
| BLAKE2b-256 |
457d57f95cd7027ff03c5e33696eaf04373363ad5fb3b8aece2183a6fcae2aa9
|
File details
Details for the file martinez-0.5.3-cp37-cp37m-manylinux2010_x86_64.whl.
File metadata
- Download URL: martinez-0.5.3-cp37-cp37m-manylinux2010_x86_64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49dc303fb7f41c3e01185b0a5478c18518902e295fa21666e602083bdde918ab
|
|
| MD5 |
2d945215861ebaad64dce3c1a697f766
|
|
| BLAKE2b-256 |
b72cb37bd31a17aefc9a4a4c55c3f3714c67d626f7f9b2d3bdc6c8a3925861cb
|
File details
Details for the file martinez-0.5.3-cp37-cp37m-manylinux2010_i686.whl.
File metadata
- Download URL: martinez-0.5.3-cp37-cp37m-manylinux2010_i686.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.7m, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
598628e055eaf7f07e39ff1d1af024296a2e7df5e63f0549044060bf2a84ed42
|
|
| MD5 |
c707b4ecc7f13fbd2363312380ce3242
|
|
| BLAKE2b-256 |
d31a150d222923e61806fb05cf3fa4e823f1bbb76da9751ca5a1d447a99f41df
|
File details
Details for the file martinez-0.5.3-cp37-cp37m-macosx_10_9_x86_64.whl.
File metadata
- Download URL: martinez-0.5.3-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 250.3 kB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59ac11f9ec88c4f894c8954aa6d1d26d45a607877d81e727e28cb1e066d5d0ae
|
|
| MD5 |
ddbbcfd0e4122017b86b1362b54cd1c5
|
|
| BLAKE2b-256 |
d971df1035c2ac711b2a215bf291d71b12f81511cb1af999772e44fe1b4a5779
|
File details
Details for the file martinez-0.5.3-cp36-cp36m-win_amd64.whl.
File metadata
- Download URL: martinez-0.5.3-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 157.4 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
232c575777181ab86345918567dd31f890123cf3a47ccf21896880ec17cd3d1a
|
|
| MD5 |
16f4437ecd62617ec763d1fd2c0b360d
|
|
| BLAKE2b-256 |
eb14ba9811f0f1744d063574383baff9a269a139609fb553883d42e6532ef59b
|
File details
Details for the file martinez-0.5.3-cp36-cp36m-win32.whl.
File metadata
- Download URL: martinez-0.5.3-cp36-cp36m-win32.whl
- Upload date:
- Size: 140.0 kB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a783661e40c2d1236bd0bee86dcd3449957dd587087bbe76381446fd4ece4bd
|
|
| MD5 |
072f11396007b1615ec46c49ed2340cf
|
|
| BLAKE2b-256 |
2820ab8abc720e395303135b0858d761165a9ee7de8f40c810641c075289cf70
|
File details
Details for the file martinez-0.5.3-cp36-cp36m-manylinux2010_x86_64.whl.
File metadata
- Download URL: martinez-0.5.3-cp36-cp36m-manylinux2010_x86_64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02192858a3be565fc8b29b54c204b95c80012e82f9ea394371d126fcda86576c
|
|
| MD5 |
c6c0b8ee7d6397be78a6b41371966cc2
|
|
| BLAKE2b-256 |
f76e0889dc2209931d2e3cb6964daa60f1439a4cbba9c98a90f96c960e27eaec
|
File details
Details for the file martinez-0.5.3-cp36-cp36m-manylinux2010_i686.whl.
File metadata
- Download URL: martinez-0.5.3-cp36-cp36m-manylinux2010_i686.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.6m, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b7db5712908d3e8da2faad1ab3e262517ba00a4046562ac01d9ff7ae6bf1e04
|
|
| MD5 |
eb5ba7c6bc6782c8bd03b4d7478050e9
|
|
| BLAKE2b-256 |
fc16d5058bacb1123d133d5014123774fe4dcb5545e05ff05c2536692e18b626
|
File details
Details for the file martinez-0.5.3-cp36-cp36m-macosx_10_9_x86_64.whl.
File metadata
- Download URL: martinez-0.5.3-cp36-cp36m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 250.3 kB
- Tags: CPython 3.6m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b3ae3f72d67f094f8e1fd04d463d5cd78803135a84fb5ec6f7a611caac15632
|
|
| MD5 |
c4e52077f382ff61545223381b785de0
|
|
| BLAKE2b-256 |
c787537c93d4c6229c2e8a43554de7d731a6906da0a1442e0794b6f0bb75d1c8
|
File details
Details for the file martinez-0.5.3-cp35-cp35m-win_amd64.whl.
File metadata
- Download URL: martinez-0.5.3-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 157.4 kB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.5.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f3233580a82ba11a66bc50e03858d6e69d599228985b3b65db4d64b975e06e0
|
|
| MD5 |
27b1a1dfd33e874872546a6b14f29035
|
|
| BLAKE2b-256 |
2160efebdf4f619f7186272db01703a1c52d36c41edd7fbaf8e4fea39970ffb3
|
File details
Details for the file martinez-0.5.3-cp35-cp35m-win32.whl.
File metadata
- Download URL: martinez-0.5.3-cp35-cp35m-win32.whl
- Upload date:
- Size: 140.0 kB
- Tags: CPython 3.5m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.5.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d88090a9b3ccd9d7afed58fc11023a121dc16f7e3b1248120190e78d354b4057
|
|
| MD5 |
581664f515a9d402e451f4e337f41bda
|
|
| BLAKE2b-256 |
a06a9f1e07d460793e054e70002cef41c448a7cb723817a14063dc5d2870d8c4
|
File details
Details for the file martinez-0.5.3-cp35-cp35m-manylinux2010_x86_64.whl.
File metadata
- Download URL: martinez-0.5.3-cp35-cp35m-manylinux2010_x86_64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.5m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.5.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5952a87c6e4622c658b645e05dc51804e2b37df122c6e84bdcb37473e7d9e76b
|
|
| MD5 |
3249689dfbb88c249b05fe38d9566480
|
|
| BLAKE2b-256 |
a516464a56e6642ffa9b311498f50eae2d92b51ffc91b62a23f4bc8a5fb18d92
|
File details
Details for the file martinez-0.5.3-cp35-cp35m-manylinux2010_i686.whl.
File metadata
- Download URL: martinez-0.5.3-cp35-cp35m-manylinux2010_i686.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.5m, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.5.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e260743218f343f0458cf56d6c0cec7107fc0efa2e53e2e1e0a998645062940
|
|
| MD5 |
330a6fefb4584132a101ae0348ab1609
|
|
| BLAKE2b-256 |
67a9677fd3d78c022811161da86e6dccc1ac9d4b25ee1c87b733f85e174f9ed8
|
File details
Details for the file martinez-0.5.3-cp35-cp35m-macosx_10_9_x86_64.whl.
File metadata
- Download URL: martinez-0.5.3-cp35-cp35m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 250.4 kB
- Tags: CPython 3.5m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.5.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c348eb240882f0e173a31f74772d3fcdcd325e6eb75dd9b5a20eec3674c7cabf
|
|
| MD5 |
f6be303cb51bdd2a9e58e15d65cb6132
|
|
| BLAKE2b-256 |
95b475a694274f0468cc1279ab736b54bbff6586ad5f7cd96b32f224ebd9981d
|