{"id":24260,"library":"polygon3","title":"Polygon3","description":"A Python 3 library for handling polygonal shapes in 2D, including intersection, union, and clipping operations. Current version 3.0.9.1, with maintenance updates as needed.","status":"active","version":"3.0.9.1","language":"python","source_language":"en","source_url":"https://github.com/Phylliida/polygon3","tags":["2D geometry","polygons","clipping","computational geometry"],"install":[{"cmd":"pip install polygon3","lang":"bash","label":"pip install"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"Polygon","correct":"from polygon import Polygon"}],"quickstart":{"code":"from polygon import Polygon\n\n# Create two polygons\npoly1 = Polygon([(0,0), (1,0), (1,1), (0,1)])\npoly2 = Polygon([(0.5,0.5), (1.5,0.5), (1.5,1.5), (0.5,1.5)])\n\n# Compute intersection\nintersection = poly1 & poly2\nprint(f\"Intersection area: {intersection.area()}\")\n\n# Compute union\nunion = poly1 | poly2\nprint(f\"Union area: {union.area()}\")","lang":"python","description":"Create two polygons, compute their intersection and union."},"warnings":[{"fix":"Install with `pip install polygon3`, then import as `from polygon import Polygon`.","message":"Polygon3 is a fork of the original 'polygon' library (Python 2). Do not confuse with 'polygon' package; import from 'polygon' (not 'polygon3') after installation.","severity":"breaking","affected_versions":"all"},{"fix":"Ensure polygons are simple and vertices are ordered consistently.","message":"Coordinates must be in clockwise or counterclockwise order; self-intersecting or malformed polygons may cause incorrect results or crashes.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from polygon import Polygon` after installing polygon3.","cause":"Installed 'polygon3' but tried to import 'polygon3'.","error":"ModuleNotFoundError: No module named 'polygon'"},{"fix":"Uninstall 'polygon' and install 'polygon3' with `pip install polygon3`.","cause":"Installed the wrong 'polygon' package (from PyPI), which is different.","error":"AttributeError: module 'polygon' has no attribute 'Polygon'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}