{"id":19097254,"url":"https://github.com/lycantropos/gon","last_synced_at":"2025-04-30T14:29:53.563Z","repository":{"id":34987683,"uuid":"194597548","full_name":"lycantropos/gon","owner":"lycantropos","description":"Geometries processing","archived":false,"fork":false,"pushed_at":"2023-06-27T00:30:10.000Z","size":2045,"stargazers_count":20,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-30T14:29:47.290Z","etag":null,"topics":["computational-geometry","constrained-delaunay-triangulation","delaunay-triangulation","polygon","polygon-boolean","polygon-clipping"],"latest_commit_sha":null,"homepage":"https://gon.rtfd.io","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-01T04:06:06.000Z","updated_at":"2024-12-23T18:01:39.000Z","dependencies_parsed_at":"2024-11-09T03:39:50.359Z","dependency_job_id":null,"html_url":"https://github.com/lycantropos/gon","commit_stats":{"total_commits":1880,"total_committers":2,"mean_commits":940.0,"dds":"0.0021276595744680327","last_synced_commit":"177bd0de37255462c60adcbfcdf76bfdc343a9c1"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lycantropos%2Fgon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lycantropos%2Fgon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lycantropos%2Fgon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lycantropos%2Fgon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lycantropos","download_url":"https://codeload.github.com/lycantropos/gon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251721321,"owners_count":21632807,"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":["computational-geometry","constrained-delaunay-triangulation","delaunay-triangulation","polygon","polygon-boolean","polygon-clipping"],"created_at":"2024-11-09T03:39:34.842Z","updated_at":"2025-04-30T14:29:53.540Z","avatar_url":"https://github.com/lycantropos.png","language":"Python","readme":"gon\n===\n\n[![](https://github.com/lycantropos/gon/workflows/CI/badge.svg)](https://github.com/lycantropos/gon/actions/workflows/ci.yml \"Github Actions\")\n[![](https://codecov.io/gh/lycantropos/gon/branch/master/graph/badge.svg)](https://codecov.io/gh/lycantropos/gon \"Codecov\")\n[![](https://readthedocs.org/projects/gon/badge/?version=latest)](https://gon.readthedocs.io/en/latest \"Documentation\")\n[![](https://img.shields.io/github/license/lycantropos/gon.svg)](https://github.com/lycantropos/gon/blob/master/LICENSE \"License\")\n[![](https://badge.fury.io/py/gon.svg)](https://badge.fury.io/py/gon \"PyPI\")\n\nSummary\n-------\n\n`gon` is a pure Python library that provides support\nfor planar geometry objects built from discrete points,\nfinite number of straight line segments (e.g. polylines)\nand areas bound by closed polylines (e.g. polygons).\n\nMain features are\n- convenience: all geometric objects\nare [immutable](https://docs.python.org/3/glossary.html#term-immutable), \n[hashable](https://docs.python.org/3/glossary.html#term-hashable)\nand implement [set-like](https://docs.python.org/3/library/collections.abc.html#collections.abc.Set) interface,\ni.e. support containment, equality, \"is-subset\" tests\nand boolean set operations (e.g. finding intersection).\n- correctness: all calculations are robust for floating point numbers\n\u0026 precise for integral numbers (like `int`),\neach operation corresponds to its mathematical definition\nand property-based tested.\n- efficiency: all operations are efficient\nin terms of both time \u0026 memory complexity,\nupper bound for expected time complexity is `O(n * log n)`,\nfor memory complexity is `O(n)`.\n\n---\n\nIn what follows `python` is an alias for `python3.7` or `pypy3.7`\nor any later version (`python3.7`, `pypy3.8` 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 gon\n```\n\n### Developer\n\nDownload the latest version from `GitHub` repository\n```bash\ngit clone https://github.com/lycantropos/gon.git\ncd gon\n```\n\nInstall dependencies\n```bash\npython -m pip install -r requirements.txt\n```\n\nInstall\n```bash\npython setup.py install\n```\n\nUsage\n-----\n\n```python\n\u003e\u003e\u003e from gon.base import EMPTY, Angle, Contour, Point, Polygon\n\u003e\u003e\u003e square = Polygon(Contour([Point(0, 0), Point(4, 0), Point(4, 4),\n...                           Point(0, 4)]))\n\u003e\u003e\u003e square == square\nTrue\n\u003e\u003e\u003e square \u003e= square\nTrue\n\u003e\u003e\u003e square \u003c= square\nTrue\n\u003e\u003e\u003e square \u003c square\nFalse\n\u003e\u003e\u003e square \u003e square\nFalse\n\u003e\u003e\u003e square \u0026 square == square\nTrue\n\u003e\u003e\u003e square | square == square\nTrue\n\u003e\u003e\u003e square - square is EMPTY\nTrue\n\u003e\u003e\u003e square ^ square is EMPTY\nTrue\n\u003e\u003e\u003e Point(0, 0) in square\nTrue\n\u003e\u003e\u003e square.index()\n\u003e\u003e\u003e Point(0, 0) in square\nTrue\n\u003e\u003e\u003e len(square.border.vertices) == 4\nTrue\n\u003e\u003e\u003e len(square.holes) == 0\nTrue\n\u003e\u003e\u003e square.is_convex\nTrue\n\u003e\u003e\u003e square.convex_hull == square\nTrue\n\u003e\u003e\u003e square.area == 16\nTrue\n\u003e\u003e\u003e square.perimeter == 16\nTrue\n\u003e\u003e\u003e square.centroid == Point(2, 2)\nTrue\n\u003e\u003e\u003e square.distance_to(Point(2, 2)) == 0\nTrue\n\u003e\u003e\u003e square.distance_to(Point(7, 8)) == 5\nTrue\n\u003e\u003e\u003e (square.rotate(Angle(0, 1), Point(4, 4))\n...  == Polygon(Contour([Point(8, 0), Point(8, 4), Point(4, 4), Point(4, 0)])))\nTrue\n\u003e\u003e\u003e (square.scale(1, 2)\n...  == Polygon(Contour([Point(0, 0), Point(4, 0), Point(4, 8), Point(0, 8)])))\nTrue\n\u003e\u003e\u003e (square.translate(1, 2)\n...  == Polygon(Contour([Point(1, 2), Point(5, 2), Point(5, 6), Point(1, 6)])))\nTrue\n\u003e\u003e\u003e (square.triangulate().triangles()\n...  == [Contour([Point(0, 4), Point(4, 0), Point(4, 4)]),\n...      Contour([Point(0, 0), Point(4, 0), Point(0, 4)])])\nTrue\n\n```\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 -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:\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:\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%2Fgon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flycantropos%2Fgon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flycantropos%2Fgon/lists"}