{"id":19097285,"url":"https://github.com/lycantropos/martinez","last_synced_at":"2025-04-30T14:30:02.514Z","repository":{"id":55584570,"uuid":"224819004","full_name":"lycantropos/martinez","owner":"lycantropos","description":"Python port of polygon clipping algorithm by F. Martinez et al. (with separate C++ binding)","archived":false,"fork":false,"pushed_at":"2020-12-18T18:39:05.000Z","size":739,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-18T17:23:55.033Z","etag":null,"topics":["polygon","polygon-boolean","polygon-clipping"],"latest_commit_sha":null,"homepage":"http://www4.ujaen.es/~fmartin/bool_op.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lycantropos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-29T09:16:26.000Z","updated_at":"2025-03-10T11:29:50.000Z","dependencies_parsed_at":"2022-08-15T03:40:34.492Z","dependency_job_id":null,"html_url":"https://github.com/lycantropos/martinez","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lycantropos%2Fmartinez","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lycantropos%2Fmartinez/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lycantropos%2Fmartinez/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lycantropos%2Fmartinez/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lycantropos","download_url":"https://codeload.github.com/lycantropos/martinez/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251721340,"owners_count":21632815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["polygon","polygon-boolean","polygon-clipping"],"created_at":"2024-11-09T03:39:47.906Z","updated_at":"2025-04-30T14:30:02.494Z","avatar_url":"https://github.com/lycantropos.png","language":"Python","readme":"martinez\n========\n\n[![](https://dev.azure.com/lycantropos/martinez/_apis/build/status/lycantropos.martinez?branchName=master)](https://dev.azure.com/lycantropos/martinez/_build/latest?definitionId=15\u0026branchName=master \"Azure Pipelines\")\n[![](https://codecov.io/gh/lycantropos/martinez/branch/master/graph/badge.svg)](https://codecov.io/gh/lycantropos/martinez \"Codecov\")\n[![](https://img.shields.io/github/license/lycantropos/martinez.svg)](https://github.com/lycantropos/martinez/blob/master/LICENSE \"License\")\n[![](https://badge.fury.io/py/martinez.svg)](https://badge.fury.io/py/martinez \"PyPI\")\n\nIn what follows `python` is an alias for `python3.5` or `pypy3.5`\nor any later version (`python3.6`, `pypy3.6` and so on).\n\nInstallation\n------------\n\nInstall the latest `pip` \u0026 `setuptools` packages versions\n```bash\npython -m pip install --upgrade pip setuptools\n```\n\n### User\n\nDownload and install the latest stable version from `PyPI` repository\n```bash\npython -m pip install --upgrade martinez\n```\n\n### Developer\n\nDownload the latest version from `GitHub` repository\n```bash\ngit clone https://github.com/lycantropos/martinez.git\ncd martinez\n```\n\nInstall\n```bash\npython setup.py install\n```\n\nUsage\n-----\n\n```python\n\u003e\u003e\u003e from martinez.contour import Contour\n\u003e\u003e\u003e from martinez.point import Point\n\u003e\u003e\u003e from martinez.polygon import Polygon\n\u003e\u003e\u003e 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)])\n\u003e\u003e\u003e 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)])\n\u003e\u003e\u003e from martinez.boolean import OperationType, compute\n\u003e\u003e\u003e compute(left_polygon, right_polygon, OperationType.INTERSECTION)\nPolygon([Contour([Point(1.0, 1.0), Point(2.0, 1.0), Point(2.0, 2.0), Point(1.0, 2.0)], [], True)])\n\u003e\u003e\u003e compute(left_polygon, right_polygon, OperationType.UNION)\nPolygon([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)])\n\u003e\u003e\u003e compute(left_polygon, right_polygon, OperationType.DIFFERENCE)\nPolygon([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)])\n\u003e\u003e\u003e compute(left_polygon, right_polygon, OperationType.XOR)\nPolygon([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)])\n\n```\noriginal C++ implementation can be invoked by importing from `_martinez` module instead.\n\nDevelopment\n-----------\n\n### Bumping version\n\n#### Preparation\n\nInstall\n[bump2version](https://github.com/c4urself/bump2version#installation).\n\n#### Pre-release\n\nChoose which version number category to bump following [semver\nspecification](http://semver.org/).\n\nTest bumping version\n```bash\nbump2version --dry-run --verbose $CATEGORY\n```\n\nwhere `$CATEGORY` is the target version number category name, possible\nvalues are `patch`/`minor`/`major`.\n\nBump version\n```bash\nbump2version --verbose $CATEGORY\n```\n\nThis will set version to `major.minor.patch-alpha`. \n\n#### Release\n\nTest bumping version\n```bash\nbump2version --dry-run --verbose release\n```\n\nBump version\n```bash\nbump2version --verbose release\n```\n\nThis will set version to `major.minor.patch`.\n\n### Running tests\n\nInstall dependencies\n```bash\npython -m pip install --force-reinstall -r requirements-tests.txt\n```\n\nPlain\n```bash\npytest\n```\n\nInside `Docker` container:\n- with `CPython`\n  ```bash\n  docker-compose --file docker-compose.cpython.yml up\n  ```\n- with `PyPy`\n  ```bash\n  docker-compose --file docker-compose.pypy.yml up\n  ```\n\n`Bash` script (e.g. can be used in `Git` hooks):\n- with `CPython`\n  ```bash\n  ./run-tests.sh\n  ```\n  or\n  ```bash\n  ./run-tests.sh cpython\n  ```\n\n- with `PyPy`\n  ```bash\n  ./run-tests.sh pypy\n  ```\n\n`PowerShell` script (e.g. can be used in `Git` hooks):\n- with `CPython`\n  ```powershell\n  .\\run-tests.ps1\n  ```\n  or\n  ```powershell\n  .\\run-tests.ps1 cpython\n  ```\n- with `PyPy`\n  ```powershell\n  .\\run-tests.ps1 pypy\n  ```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flycantropos%2Fmartinez","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flycantropos%2Fmartinez","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flycantropos%2Fmartinez/lists"}