TheSwamp

Code Red => .NET => Topic started by: It's Alive! on October 26, 2021, 08:40:22 PM

Title: DelaunatorSharp, Delaunay triangulation, tin
Post by: It's Alive! on October 26, 2021, 08:40:22 PM


Worthy of its own thread as its very impressive performance, might be useful
Source is https://github.com/nol1fe/delaunator-sharp

Note the original source is 2D, but the input point set is const, so the indexing seems to work on any array. See my notes in the code.
It could have been faster, but the authors used their own point class, so there’s memory duplication.

GenTin number of points= 41769, time in Milliseconds = 31
GenTin number or points= 1000004, time in Milliseconds = 812


Title: Re: DelaunatorSharp, Delaunay triangulation, tin
Post by: MickD on October 26, 2021, 10:48:17 PM
Will definitely take a look as time permits, C# is pretty impressive speed wise, especially after a run or two to set up the JIT compiled code. From all accounts it can be the same speed or close enough to as C/C++'s speed if done correctly.
Title: Re: DelaunatorSharp, Delaunay triangulation, tin
Post by: huiz on October 27, 2021, 02:15:24 AM
It is worth mentioning the license, which is MIT, and therefor you can use it in your own application without restrictions.
Title: Re: DelaunatorSharp, Delaunay triangulation, tin
Post by: It's Alive! on October 27, 2021, 03:12:35 AM
Will definitely take a look as time permits, C# is pretty impressive speed wise, especially after a run or two to set up the JIT compiled code. From all accounts it can be the same speed or close enough to as C/C++'s speed if done correctly.

Yes very close indeed.
Milliseconds = 812 C#
Milliseconds = 645 C++;

Though there’s one function in https://www.theswamp.org/index.php?topic=57094.msg606824#msg606824

That caused .NET to stall miserably, pointInTriangle, which is an interesting case