Skip to main content

Python bindings for CGAL 2D Polygon Partitioning

Project description

pypolypart

Python bindings for CGAL 2D Polygon Partitioning.

Features

  • optimal_convex_partition_2(...)
  • Returns a list of convex polygons

Install

pip install pypolypart

Example

from pypolypart import optimal_convex_partition2
def main() -> None:
    polygon = [
        (391, 374),
        (240, 431),
        (252, 340),
        (374, 320),
        (289, 214),
        (134, 390),
        (68, 186),
        (154, 259),
        (161, 107),
        (435, 108),
        (208, 148),
        (295, 160),
        (421, 212),
        (441, 303),
    ]

    parts = optimal_convex_partition_2(polygon)

    print("Input polygon:")
    print(polygon)
    print()

    print(f"Number of convex pieces: {len(parts)}")
    for idx, poly in enumerate(parts, start=1):
        print(f"Convex part {idx}:")
        for pt in poly:
            print(f"  {pt}")
        print()


if __name__ == "__main__":
    main()

Requirements

  • Linux
  • Python 3.12+
  • CGAL runtime/build dependencies as documented

License

This project is licensed under the GNU General Public License v3.0 or later (GPL-3.0-or-later).

This package depends on CGAL's Polygon Partitioning package, which is licensed under the GPL.

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

pypolypart-0.1.0.tar.gz (15.1 kB view details)

Uploaded Source

File details

Details for the file pypolypart-0.1.0.tar.gz.

File metadata

  • Download URL: pypolypart-0.1.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pypolypart-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b585c86bcaa509f5f38fffc906a0b8e2d8ae13610d7b58d265df271cd721ba46
MD5 7eea6d651e42376a30145c160f2df715
BLAKE2b-256 89ceacd3f7e605ccaf3044e119f650719a9d1f1e08891914094b73c97eeb6a68

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page