delaunay-triangulation
delaunay-triangulation copied to clipboard
Consider moving all library code into `delaunay.h` to make a single header library
Considering the size of vector2.h
, numeric.h
, triangle.h
and edge.h
, these could fit into delaunay.h
easily and would allow people to easily add delaunay.h
to their projects without dragging four other header files with it.
OK,I see.Thank you very much!
---Original---
From: "Abe"[email protected]
Date: Thu, May 23, 2019 02:25 AM
To: "Bl4ckb0ne/delaunay-triangulation"[email protected];
Cc: "Subscribed"[email protected];
Subject: [Bl4ckb0ne/delaunay-triangulation] Consider moving all library code into delaunay.h
to make a single header library (#16)
Considering the size of vector2.h, numeric.h, triangle.h and edge.h, these could fit into delaunay.h easily and would allow people to easily add delaunay.h to their projects without dragging four other header files with it.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
I agree, the code is long due for maintenance, design wise and performance wise. I'll try to find some time in a near future to take care about that. If it's too urgent, I will gladly review any PR.
I'm happy to submit a PR if you don't get around to it. I was mostly making sure this is work that you'd be open to instead of throwing a random PR at you.
I started to think about a new design for the code. This will be my first priority in the next few weeks. I'll make issues tonight to guide our work, I'd like to change more than a few things :D
I commented in #34 with some code that would make short work of this issue, too.
The functionality is contained in 200 lines, but it would take a small amount of plumbing to have this not be a breaking change. https://pastebin.com/NtVzLSCn
All the best!
EDIT: I've got some bugs, I'll follow up when they're fixed. EDIT2: Perhaps it's not a new bug, when I try to triangulate a grid (with unit spacing), I get a few extra edges in the first row that have lengths of 2 or 3. EDIT3: When you have a perfect-ish grid, you may get a few degenerate triangles, but that can be easily fixed by not pushing new triangles with zero area back into the array: for (const IndexEdge& edge : polygon) { if (IsTriangleDegenerate(edge.a, edge.b, vertex_index)) { continue; } triangles.emplace_back(edge.a, edge.b, vertex_index); } where IsTriangleDegenerate checks the determinant for being very near zero. https://people.richland.edu/james/lecture/m116/matrices/applications.html It's possible that I introduced this bug and that this was originally covered by some of the floating point math I stripped out, but I'm leaving that evaluation as an exercise for someone else. Hope any of this helps and sorry for going on a tangent in this thread.