ghostelet / delaunator-sharp

Fast Delaunay triangulation of 2D points implemented in C#.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Delaunator C#

Fast Delaunay triangulation of 2D points implemented in C#.

This code was ported from Mapbox's Delaunator project (JavaScript).

Documentation

See https://mapbox.github.io/delaunator/ for more information about the Triangles and Halfedges data structures.

Unity Installation

Simply edit manifest.json file in your Unity Packages directory

{
  "dependencies": {
    "com.nol1fe.delaunator": "https://github.com/nol1fe/delaunator-sharp-unitypackage.git",
}

Unity Example

From UnityPackage Menager select Delaunator and press "Import into Project".

WPF Example

There is available playground in DelaunatorSharp.WPF.Example project that shows examples of drawing Voronoi Diagram, Delaunay triangulation and Convex Hull

Points were generated with Poisson Disc Sampling implemented by UniformPoissonDiskSampler

Performance

BenchmarkDotNet=v0.12.1
Intel Core i5-4460 CPU 3.20GHz (Haswell), 1 CPU, 4 logical and 4 physical cores .NET Core SDK=3.1.201
Count Type Mean
100000 Uniform 85.53 ms
100000 Gaussian 84.49 ms
100000 Grid 71.95 ms
1000000 Uniform 1,127.57 ms
1000000 Gaussian 1,128.37 ms
1000000 Grid 874.02 ms

NuGet

https://www.nuget.org/packages/Delaunator/

About

Fast Delaunay triangulation of 2D points implemented in C#.

License:MIT License


Languages

Language:C# 100.0%