DaveTheCelt / Triangulation

A Bowyer–Watson algorithm for Triangulation, with a Unity3D demo provided.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bowyer-Watson Delaunay Triangulation



This is a simple implementation of the Bowyer-Watson Deluanay Triangulation. It is an incremental algoritm so it isn't particularly fast.

The algorithm is data orientated, so all of the data types are using structs instead of classes. And the API is engine agnostic but I have added a demo scene via Unity3D.

I have also added support for Unity's Job System to allow the use of threads, but it isn't ideal for this type of algoritm due to its incremental nature. I might try a new approach to using the job system for this algorithm in future when I have time to optimise.

Note

This implementation is not fully optimised as much as it could be. The aim was to learn the algoritm not make it highly performant.

Preview

Here is a Unity3D preview of the triangulated mesh being generated whilst the points move randomly. The triangulation runs every frame after the points have been moved to re-triangulate the mesh. Additionally moving the mouse over the mesh will act as an additional point to be traingulated which is highlighted in purple with adjacent triangules within a certain distance being highlighted in purple aswell.


Sources

Helpful sources to learn the algorithm:

Wikipedia :: Delaunay Triangulation
Wikipedia :: Circumscribed Circle
Wikipedia :: The Bowyer-Watson Algorithm
PDF :: An implementation of Watson's algorithm for computing 2-dimensional Delaunay triangulations
YouTube :: A visual Guide by Scott Anderson

About

A Bowyer–Watson algorithm for Triangulation, with a Unity3D demo provided.


Languages

Language:C# 100.0%