Skip to main content

A lightweight collection of helper classes and methods to create a delaunay triangulation.

Project description

Installing

Python 3.6 or higher is required

other than that it's just as simple as

pip install delaunay-triangulation

Features

Geometry Math Classes - typing.py

StandardLine

A line in a coordinate grid described in standard form (ax + by = c).

Coordinate

A single x or y coordinate that doesn't have a specific value yet.

Vertex

A Vertex - a point in 2D space described by an x and y value.

Edge

An Edge - a line(AB) in 2D space described by 2 vertices

Triangle

A Triangle represented as 3 vertices a, b, c

Circle

A Circle described by its center and its radius

Calculation Methods - triangulation.py

scatter_vertices

helper method to scatter random vertices on a specified plane.

get_super_triangle

get super triangle from vertices

delaunay

the crux of this package. A method to Delaunay Triangulate a list of vertices using the Bowyer-Watson algorithm.

Basic usage

from delaunay_triangulation.triangulate import scatter_vertices, delaunay

width = 1920
height = 1080
spacing = 250
scatter = 0.75

vertices = scatter_vertices(
    plane_width=width,
    plane_height=height,
    spacing=spacing,
    scatter=scatter
)

# delete_super_shared is True by default but can be turned off if you need to fill a plane completely
triangles = delaunay(
    vertices=vertices,
    delete_super_shared=False
)

You are now free to do with those triangles what ever you may desire!

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

delaunay-triangulation-1.0.4.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

delaunay_triangulation-1.0.4-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file delaunay-triangulation-1.0.4.tar.gz.

File metadata

  • Download URL: delaunay-triangulation-1.0.4.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for delaunay-triangulation-1.0.4.tar.gz
Algorithm Hash digest
SHA256 7322858d8ba28a40deeb43d46e68e847a5965025288de9f1e32ddf6131e4b4e7
MD5 7865eded9091860426b8d8001077b68e
BLAKE2b-256 cdeb858df93a6b8b50133740f22b7b5c7a34c5df49c08cef3e1402275002508c

See more details on using hashes here.

File details

Details for the file delaunay_triangulation-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: delaunay_triangulation-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for delaunay_triangulation-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c4ea49e4b8ad172dde690090405ec9e2855550b92c1dad2b852ae07bee5a94ec
MD5 e752ca4f3feeb1b378084cae60d6f4d1
BLAKE2b-256 ffaa909f30d39f0b470fbb5710859c66ff3d7ad64e6078ae118a15aa77898af9

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