Python port of polygon clipping algorithm by F. Martinez et al.
Project description
martinez
In what follows
python
is an alias forpython3.5
or any later version (python3.6
and 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
File details
Details for the file martinez-0.5.0.tar.gz
.
File metadata
- Download URL: martinez-0.5.0.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.5.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1712521b13336b003d7a7648e2f862d91a943b57e45ad47523935c32a119b24 |
|
MD5 | bb427a2c960440d72d0405fdb0de107d |
|
BLAKE2b-256 | 4c51ef792b19fc0461f3cfac6938afeb31c967a4474a7ad932042928fe087aa3 |
File details
Details for the file martinez-0.5.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: martinez-0.5.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 157.1 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e2024fe0de58969f1f74ebde63c82913d87aa753221ed4db40bac248a623806 |
|
MD5 | b0b403644cd1b72e8de24113e7df98fc |
|
BLAKE2b-256 | c31be83904f0ec23d33190664c09ee2f3cb7fc50e415736d4eb58c80ba6278ff |
File details
Details for the file martinez-0.5.0-cp38-cp38-win32.whl
.
File metadata
- Download URL: martinez-0.5.0-cp38-cp38-win32.whl
- Upload date:
- Size: 135.1 kB
- Tags: CPython 3.8, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a0e16e4432402d1da190170c01a7e98bc12d23e13a7d5790c7e74312a15128b |
|
MD5 | 7b84dc8de7602b2a8447f8784867ba62 |
|
BLAKE2b-256 | f54ca3808465af66e859a399873e36cd1d2bcc7bab554d515bebb29b35985dd4 |
File details
Details for the file martinez-0.5.0-cp38-cp38-manylinux2010_x86_64.whl
.
File metadata
- Download URL: martinez-0.5.0-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.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d359f6f5ddcb19cfad4a97e6ae3ae3052047d49e540515c959df4cc611f6d8a9 |
|
MD5 | f466b92e6f5659860e585b683abc8b67 |
|
BLAKE2b-256 | ed103ec6f22349a1c117db35bce8c87a3f76b2d28329f08fa53be572514ef494 |
File details
Details for the file martinez-0.5.0-cp38-cp38-manylinux2010_i686.whl
.
File metadata
- Download URL: martinez-0.5.0-cp38-cp38-manylinux2010_i686.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.8, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4fa8e9f1c10dcce2ad0e0cea6652245e36ef90bc65fbd30bc0c5d153c9b72ed |
|
MD5 | 3f2904cd23d801adecc25ec56b41e741 |
|
BLAKE2b-256 | aad8b7a7a5e0b4da03041f96658bcd2df28420a48902f4526e4304c8198d1013 |
File details
Details for the file martinez-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: martinez-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 257.2 kB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ce099c4af264c403ea93ba1a2485d672d6136cccd0286947984231d03baaa23 |
|
MD5 | fdd0042feed9494c4ee999c57799dfd1 |
|
BLAKE2b-256 | 07cdfe62a57478f206cb8a9eb307e44e66bd62e99f47358f6b7943cdaa03cb9a |
File details
Details for the file martinez-0.5.0-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: martinez-0.5.0-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 155.8 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24725eaaa9153b8dc551c1a4726fc02f881abb39442bc8847aac7ceb32b8b51c |
|
MD5 | 7756734417dc839eca6efd0f725f667d |
|
BLAKE2b-256 | 98854043f7fd83795acdf75b33fd1e5f48ef0f47da84643329dd66574e052d68 |
File details
Details for the file martinez-0.5.0-cp37-cp37m-win32.whl
.
File metadata
- Download URL: martinez-0.5.0-cp37-cp37m-win32.whl
- Upload date:
- Size: 138.0 kB
- Tags: CPython 3.7m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49684870d82f29a9211518582e82f8c4a98d376739a19f1219786574931caea4 |
|
MD5 | 08b6bcbe4ce658226e079f06d0ccdc3a |
|
BLAKE2b-256 | 2dc9d44c18b4d67fb635aa2a5c1e0495ee082e581d8f52327088d5f82f08e18f |
File details
Details for the file martinez-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: martinez-0.5.0-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.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 987776716a5b891cce874774b8ac23e2216838f49ec4982543b5f3ea4a0faebb |
|
MD5 | f1a95ca92d46700c91d100bcd0c98f33 |
|
BLAKE2b-256 | c1554da14e4d6c0d2e03c7869748a494482e310fffc21db005dcd375450ef159 |
File details
Details for the file martinez-0.5.0-cp37-cp37m-manylinux2010_i686.whl
.
File metadata
- Download URL: martinez-0.5.0-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.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f91803c07fdf11c5a8222a5566a1b78b55239d3d1a4e3e3e45d8fde8d7fa8ab |
|
MD5 | 92b81b26c2a6a5c8bdbd6defacfe6b82 |
|
BLAKE2b-256 | d95464c2a58bc370471f33aa3f1fe1a179886a7a3fc2dfd975b13117a7f186da |
File details
Details for the file martinez-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: martinez-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 248.8 kB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa8889b149e9870273a6ceaa7811b8ec4026fbae7d94b353d4514f6730f96ee0 |
|
MD5 | 24028ac0ddc8e5be8f9dfdaaea34c125 |
|
BLAKE2b-256 | 5277fcd1d27ed3add0c601f92c1f60039bf7045c71533a5954564042aecb7310 |
File details
Details for the file martinez-0.5.0-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: martinez-0.5.0-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 155.8 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3ecd6e6187050e748482748caf4dd4781372224a737bfe5b5cce29991c901c7 |
|
MD5 | 2c380626490822e67993ebc00c96463c |
|
BLAKE2b-256 | 8941dbe67be86bf8c5c1e62128588b1fb1b94e4e811ef3abdc6b57ea484a031c |
File details
Details for the file martinez-0.5.0-cp36-cp36m-win32.whl
.
File metadata
- Download URL: martinez-0.5.0-cp36-cp36m-win32.whl
- Upload date:
- Size: 138.0 kB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d053c5f3031055eeb89441ff488c887599f1320bb2de66ebea2ddbf263276855 |
|
MD5 | d6a833838a5c1a16cbb54123f13a5084 |
|
BLAKE2b-256 | a88621f3e932487224e35234364c1be9bc9af0c089cf451242cb022f39c8fc90 |
File details
Details for the file martinez-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: martinez-0.5.0-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.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6ba2c3ffad53ec207b02acc5c7d6ce7e88b0a045d922d3d57d073b479ed2dd0 |
|
MD5 | 9a5f6c63bc1ef74f0f2c765cadd2ed30 |
|
BLAKE2b-256 | 579d7ac77913139af19497f6948787e5dbde6b7c2cd3d7bb0a4037af6decdba1 |
File details
Details for the file martinez-0.5.0-cp36-cp36m-manylinux2010_i686.whl
.
File metadata
- Download URL: martinez-0.5.0-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.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | beceebeb7ccad9c218dc50da2392ddc1d6ddfdfe5e3efe6c013393b7f73d8420 |
|
MD5 | 8016a34fad42b22e0e399ec320a7ec50 |
|
BLAKE2b-256 | 4270276ce1251a9bcdb61b6dda36743a3524f6f5b5de6e1f9ae286b71d8bf22c |
File details
Details for the file martinez-0.5.0-cp36-cp36m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: martinez-0.5.0-cp36-cp36m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 248.8 kB
- Tags: CPython 3.6m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f879e8c4cdeaec533b6b187c10e191110b57d7738bae6d473f8fd089f316fda |
|
MD5 | 2daddab919ccfe7c45b88728d0d0d89a |
|
BLAKE2b-256 | 56a1de2afa861aad7cda2b0c5da2158ab7f4a3900e20ac58b01078c50e237125 |
File details
Details for the file martinez-0.5.0-cp35-cp35m-win_amd64.whl
.
File metadata
- Download URL: martinez-0.5.0-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 155.8 kB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.5.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7895f322c34126d79e9896a06407cff4b4920ffabd8f840ad16dfc32bdbed296 |
|
MD5 | 3575f6ee04968ccbf9954477b9be2758 |
|
BLAKE2b-256 | 6d222122e12c727f4d53a184d41d6d84c152c3e48f71b7b2562dc53b43600e73 |
File details
Details for the file martinez-0.5.0-cp35-cp35m-win32.whl
.
File metadata
- Download URL: martinez-0.5.0-cp35-cp35m-win32.whl
- Upload date:
- Size: 138.0 kB
- Tags: CPython 3.5m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.5.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e0c244a066202ecfd19cc4f01b2b6d080bd63299164a9f286a308cebe10616d |
|
MD5 | f89ac202d9923a7813c531e870eb6d64 |
|
BLAKE2b-256 | a963648fbf43eea2733a744510c5ade1aea2e60b16c6425f67ca09cfde16da81 |
File details
Details for the file martinez-0.5.0-cp35-cp35m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: martinez-0.5.0-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.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.5.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be80ae2d2bcfc316d26d4a78e96b56f3fdf1e9f8b7bf45b2975d9e3bc42f039d |
|
MD5 | 5382ec55fb47df7f9dda1c04308fa054 |
|
BLAKE2b-256 | d2112ff561d8b284fd96cd9c8c817e0d971bc3886dde912b5877dd901625a8ea |
File details
Details for the file martinez-0.5.0-cp35-cp35m-manylinux2010_i686.whl
.
File metadata
- Download URL: martinez-0.5.0-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.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.5.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aca990268ecaf0b7bf69f4e85e3bb9a036010143f213d3ede8e87f2d299bb190 |
|
MD5 | 178b1820e2d210f21d5b2f9868b1f9f1 |
|
BLAKE2b-256 | c48b8ec930b94a86cfae94c8060aef8289efc4fcc8cbb238685db164f1891bd5 |
File details
Details for the file martinez-0.5.0-cp35-cp35m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: martinez-0.5.0-cp35-cp35m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 248.7 kB
- Tags: CPython 3.5m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.5.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b6e9f2dc5afb6bb29f911dbf2c8e729cf447298dc8445aee0b82b089602de43 |
|
MD5 | b851b327e5bcd6f1e2693fa62d56b5fc |
|
BLAKE2b-256 | c68c94570f056d2f422b11495dbf7f176f75ae2a0665471d3bc4234d77cf0c70 |