Skip to main content

(Constrained) Delaunay Triangulation of Planar Straight Line Graphs (pure Python)

Project description

Tri - (Constrained) Delaunay Triangulation of Planar Straight Line Graphs

Installation

  • Download the source

  • Run python setup.py install (or python setup.py develop)

Usage

To triangulate a polygon with one outer and one inner shell:

from tri import ToPointsAndSegments, triangulate
from tri.delaunay import output_triangles, TriangleIterator

# create points and segments for triangulation
pts_segs = ToPointsAndSegments()
pts_segs.add_polygon([[(0,0), (10,0), (5,10), (0,0)],
                      [(0,0), (8,2), (6,4), (5,7), (0,0)]
                      ],
                     )

# triangulate the points and segments
dt = triangulate(pts_segs.points, pts_segs.infos, pts_segs.segments)

# write the output
with open("tris.wkt", "w") as fh:
    output_triangles([t for t in TriangleIterator(dt)], fh)

The resulting file is readable with QGIS (Add Delimited Text Layer).

Changelog

See CHANGES.txt.

Bug reports

If you discover any bugs, feel free to create an issue on Bitbucket.

Please add as much information as possible to help us fixing the possible bug. We also encourage you to help even more by forking and sending us a pull request.

The issue tracker lives here.

Maintainers

Contributors

License

MIT License

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

tri-0.3.tar.gz (26.5 kB view details)

Uploaded Source

File details

Details for the file tri-0.3.tar.gz.

File metadata

  • Download URL: tri-0.3.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tri-0.3.tar.gz
Algorithm Hash digest
SHA256 bea99e539e91414178fe5c54ee164e9cee1538c7d1c121a9dec24165f7a9a4b4
MD5 a8247d4e3d0e06e3839fa4e34b54015a
BLAKE2b-256 89a3d965d71161b911fc2db4626444587ba01759eb5057fbdc74664b738f8a08

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