Live data from Hacker News

Exact, parallel 2D Delaunay triangulation for int32 coordinates

github.com

21–26 of 26 posts

Re: Exact, parallel 2D Delaunay triangulation for int32 coordinates

#21

Impressive work. @author : I'm trying to wrap my head around the following question: are there any situations where the "int32 constraint" would be an issue? My gut feeling says that fine a grid (4B steps) is likely to generate a good enough approximation to the exact answer for general problem (64 bit float) for most cases. Am I wrong? Also: can the algorithm easily be extended to int64 ?

yes, there are currently two modes for internal integer math: 64 and 128 bit. (the internal int math needs larger ranges than the inputs since we work with squares etc)

64bit integers works with an input coordinate range of 29,609. this is typically fine for raster image coordinates or floats that can allow for some quantization (only the triangles/edges are affected by this not the original points!)

if the input range is larger than 29,609, the algorithm switches to a 128bit implementation with a range of 1,940,470,527 which is close to, but still smaller than, what could theoretically be stored in an int32 value. hence that's why the input is currently only up to int32.

in theory it could be extended to 64bit input range but it comes with performance and portability trade-offs that currently don't seem worth it

Re: Exact, parallel 2D Delaunay triangulation for int32 coordinates

#22

Neat, now do a 3D Delaunay tetrahedrization! :)

You can look into [HXT](https://gitlab.onelab.info/gmsh/gmsh/tree/master/contrib/hxt) for that. More specifically [this file](https://gitlab.onelab.info/gmsh/gmsh/-/blob/master/contrib/h...) which shows how create the Delaunay tetrahedralization of a set of point using the tetMesh library. It's a shameless plug since I am the author of the HXT core and tet meshing stuffs.

Re: Exact, parallel 2D Delaunay triangulation for int32 coordinates

#23

Impressive work. @author : I'm trying to wrap my head around the following question: are there any situations where the "int32 constraint" would be an issue? My gut feeling says that fine a grid (4B steps) is likely to generate a good enough approximation to the exact answer for general problem (64 bit float) for most cases. Am I wrong? Also: can the algorithm easily be extended to int64 ?

yes, there are currently two modes for internal integer math: 64 and 128 bit. (the internal int math needs larger ranges than the inputs since we work with squares etc) 64bit integers works with an input coordinate range of 29,609. this is typically fine for raster image coordinates or floats that can allow for some quantization (only the triangles/edges are affected by this not the original points!) if the input ran…

Wouldn't most of the triangles be small, and thus computable using a smaller number of bits because coordinates can be made relative to one corner?

Re: Exact, parallel 2D Delaunay triangulation for int32 coordinates

#24

from the site > For large point sets, Delaunay32 is over 10× faster than delaunator-cpp and around 4× faster than Fade2D.

For one million unconstrained points on the reference Apple M1 system, eight-thread Delaunay32 completes in roughly 50 ms.

Using that as the 1.0× baseline: • Delaunay32, one thread: ~2.8× runtime. • Fade2D, automatic threads: ~4.5×. • Fade2D, one thread: ~6×. • delaunator-cpp: ~11×. • Triangle: ~11×.

Re: Exact, parallel 2D Delaunay triangulation for int32 coordinates

#25
Very nice results. For my Unity C# code I use Andy's package: https://github.com/andywiecko/BurstTriangulator

Looking at his performance graph it looks like he does about 1 million points in around 320ms or so (if I managed to read his graph correctly), albeit for float2 values and using Unity Burst which does SIMD+multiple threads.

Re: Exact, parallel 2D Delaunay triangulation for int32 coordinates

#26

Neat, now do a 3D Delaunay tetrahedrization! :)

> Neat, now do a 3D Delaunay tetrahedrization! :) I do see the smiley, but still: show a litle more appreciation man, this is really impressive work and deserves more than a "great, can you do it on one leg now?" comment.

I upvoted, I favorited, I starred the repo, and I even used a smiley.

What has OP done for me lately? :)

Post reply on HN