Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 1.03 KB

README.md

File metadata and controls

31 lines (20 loc) · 1.03 KB

Delaunay-Triangulation-Pygame

The code is based on this article.

Overview

Delaunay Triangulation implemented in python and solved using Bowyer-Watson algorithm. The program takes a set of points and connects them using a mesh.

Delauny Triangulation Gif

Usage

Running the main.py will create a delaunay triangulated mesh out of random points. Clicking on the screen will create a new point the mesh is recalculated to add the new point into the mesh. The mesh and its heatmap are rendered using Pygame.

The Delaunay triangulation code can be used without using any renderer.

from delaunayTriangulation import DelaunayTriangulation
from random import randint

N = 50

for i in range(N):
	point = Point(randint(0, 100), randint(0, 100), randint(0, 50))
	DT.AddPoint(point)

DT.Triangulate()
# The DT.mesh contains the triangles that make up the delaunay triangulated mesh