Skip to main content

Python port of polygon clipping algorithm by F. Martinez et al.

Project description

martinez

In what follows

  • python is an alias for python3.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


Download files

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

Source Distribution

martinez-0.5.2.tar.gz (23.3 kB view details)

Uploaded Source

Built Distributions

martinez-0.5.2-cp38-cp38-win_amd64.whl (157.7 kB view details)

Uploaded CPython 3.8 Windows x86-64

martinez-0.5.2-cp38-cp38-win32.whl (138.1 kB view details)

Uploaded CPython 3.8 Windows x86

martinez-0.5.2-cp38-cp38-manylinux2010_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

martinez-0.5.2-cp38-cp38-manylinux2010_i686.whl (2.8 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

martinez-0.5.2-cp37-cp37m-win_amd64.whl (157.5 kB view details)

Uploaded CPython 3.7m Windows x86-64

martinez-0.5.2-cp37-cp37m-win32.whl (140.0 kB view details)

Uploaded CPython 3.7m Windows x86

martinez-0.5.2-cp37-cp37m-manylinux2010_x86_64.whl (3.0 MB view details)

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

martinez-0.5.2-cp37-cp37m-manylinux2010_i686.whl (2.9 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

martinez-0.5.2-cp36-cp36m-win_amd64.whl (157.4 kB view details)

Uploaded CPython 3.6m Windows x86-64

martinez-0.5.2-cp36-cp36m-win32.whl (140.0 kB view details)

Uploaded CPython 3.6m Windows x86

martinez-0.5.2-cp36-cp36m-manylinux2010_x86_64.whl (3.0 MB view details)

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

martinez-0.5.2-cp36-cp36m-manylinux2010_i686.whl (2.9 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

martinez-0.5.2-cp35-cp35m-win_amd64.whl (157.4 kB view details)

Uploaded CPython 3.5m Windows x86-64

martinez-0.5.2-cp35-cp35m-win32.whl (140.0 kB view details)

Uploaded CPython 3.5m Windows x86

martinez-0.5.2-cp35-cp35m-manylinux2010_x86_64.whl (3.0 MB view details)

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

martinez-0.5.2-cp35-cp35m-manylinux2010_i686.whl (2.2 MB view details)

Uploaded CPython 3.5m manylinux: glibc 2.12+ i686

martinez-0.5.2-cp35-cp35m-macosx_10_9_x86_64.whl (250.4 kB view details)

Uploaded CPython 3.5m macOS 10.9+ x86-64

File details

Details for the file martinez-0.5.2.tar.gz.

File metadata

  • Download URL: martinez-0.5.2.tar.gz
  • Upload date:
  • Size: 23.3 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

Hashes for martinez-0.5.2.tar.gz
Algorithm Hash digest
SHA256 f3f82dd6b5a020ee912bafd2173ae2b7a101435448bfd4c321fd2c36bb236a26
MD5 2daf20283e1be4eea0ca82f4530898bb
BLAKE2b-256 c1c7195cf5fb2a8f72f6bd8989da1038d653cafab0b8dcc57bc9d84d387aa87d

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 9596d242b9c78ab9769abff99cd41800c4c2113be2afa006871a5527e40cc7d4
MD5 bd80ff5f479eeac8b3cd73920519be97
BLAKE2b-256 80e5c7953eafe89660448d17086e17c5d7d8e674d4b1e0568fd02e9a193c0348

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp38-cp38-win32.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 171a736ef54d065c22f2ee6593002a96e7c7bcb68d3b2b65f02caa7ee2341999
MD5 d16a63b289ce6681de06abaa6dcfad28
BLAKE2b-256 39aa752b965ebd145a0888f0bbab88f12f9b15528396eaa68df551c8b336f2a8

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3352873165628650de91fd5fcf36ce67a404dbf64366dc2cb8d664913aa0af0c
MD5 5d6ccc84384083adb68ca086a65b828c
BLAKE2b-256 ffc37fd68d9b17bf2fc1fad33cefb11faac9025830f58e025f9817b02ab770cf

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp38-cp38-manylinux2010_i686.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp38-cp38-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 1932de7c93447722428fea351a5f341cf26592ccffcdd2f5b455abc674019034
MD5 95f9c12d3ea63ee1d907dc271f62c5e5
BLAKE2b-256 021ca7b983bc9a2f7fb4dcec81b07a95e3fab1282786cc0bd78d0ae25e59c42a

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 7ac1184e885a8c4de726b2fc3c8da1976dd93e15ba7446aa86b8f3917483dcce
MD5 787914f5b99f98564e9b02eb12731014
BLAKE2b-256 ba47b4cb6b3ad78f28b1ce2bec735f9d8b7b1afc8a0ec6daafc4d4e2e5ce7454

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp37-cp37m-win32.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 98b91844cfd4096535a545d332e4282496f5ba32b09be85780301f4563360834
MD5 5c42ff4e9d9a628e605cc30c8c1c1778
BLAKE2b-256 668ba028c4e6ac1b479dbe6579e184fa773f5fdc9e36a9a5988b29a3bf6c4cb9

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 129af33496be72e199e089b0365a2b410042f7bb6cf6284013de5798fad69393
MD5 c63976dc8da57cd998ef98ba61b93b1a
BLAKE2b-256 061daccd16d151c0da27b4ade90927bc23aea8375a9605891cbebe5575608832

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp37-cp37m-manylinux2010_i686.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp37-cp37m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 7119e7415231c971a12fae34f3474e7b5f5c6334088d87f38f549dfea7c0bf43
MD5 d72868ae35345325670c3d66477fbb90
BLAKE2b-256 8c5ed8226b781250193b57026968785336b537fbaf896f84360640ffc8656702

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 f1fd21bf70adfad65573ba73e40448410020be3da061354bd75e2ea18536f52e
MD5 09fbaabbdda17552fb18b474cf4c8874
BLAKE2b-256 6449b86b20606393ce79e50cf6ad32b25d4a4d9527804e1b779b4a2034670358

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp36-cp36m-win32.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 fd571924890973dc1e97d866d1c1483c48b73d81126e11d7c25f06bca0b8cbdd
MD5 c84f86683387720151c46e7b6df6b396
BLAKE2b-256 6b245e485a97e382a0da6589bf560cbb8471ef41535a1208b88da1a5ecb11305

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 db86ce0a5639c4e57493571d60f89288da8c59a1570928a55f27748aef854ea1
MD5 b11b68b05aa437d721ed569b71146de9
BLAKE2b-256 48d38abbf9df845dd78c3dcc5d2db6a6c4d534337944107ac4b243257cf718cb

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp36-cp36m-manylinux2010_i686.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp36-cp36m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 f6cc67f107699e2856be73b990203b309969f2ea137ccb3e9268b8546f56c610
MD5 a7b8261b6bd0b871632a8dd4b85a0dbc
BLAKE2b-256 6706b04087c0de4a3915532a271b8d2fa45567d754d489645c440bccc0942098

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 df498647874ab6b8251e5f394e87fe011e0855e666c5a3ddd96670390a9a084d
MD5 17a584d2671908cedf9b179c23508beb
BLAKE2b-256 df22367be1876c86ce6b2ad409992f94f7d82291da5f365a93077dd9bda9683b

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp35-cp35m-win32.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 997c249f9459b7b530f2a5ac65d07a6d33c178014b051d293ffee2b036c67d08
MD5 c65b436572ff8574d7f6000ca414664b
BLAKE2b-256 a1818f9677a0df9aa3153ee494cd60333d7dc5f89fe9db1ef568d11171f20010

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp35-cp35m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f23bb39563db7d0111612bd55008729919afd586a0c93b9fa5833b0bf76bbb6a
MD5 d9a085c96ab434f22ff529a89d858aa0
BLAKE2b-256 51e393c2590c7705e25379fabd1941a64d0c13b62589ee904cb5862b8e416f63

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp35-cp35m-manylinux2010_i686.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp35-cp35m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 cf03fda34cee466a3b75ce0949e7565f76d8ee114384107cb6732e8ba71b3148
MD5 28cda7cb7f47f36bec14796afe39faca
BLAKE2b-256 3b054bd408b17f415696c3c08ca82b5e0b7f6a632067db1c6e3c34c3c256730b

See more details on using hashes here.

File details

Details for the file martinez-0.5.2-cp35-cp35m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: martinez-0.5.2-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

Hashes for martinez-0.5.2-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9c6f284a70e9d1bb4f8fd4ddf1b1d48088be0b9b590f5760571a34a820d2b9f3
MD5 dc85ac5b1b87e5cc27176d4f72471109
BLAKE2b-256 657b13be5447ed31e89bce69513586f441520a45f87d1903154fc96f528b1ee8

See more details on using hashes here.

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