Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Consider moving all library code into delaunay.h to make a single header library #16

Open
abetusk opened this issue May 22, 2019 · 5 comments

Comments

@abetusk
Copy link
Contributor

abetusk commented May 22, 2019

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.

@jianyancheng
Copy link

jianyancheng commented May 23, 2019 via email

@bl4ckb0ne
Copy link
Owner

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.

@abetusk
Copy link
Contributor Author

abetusk commented May 24, 2019

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.

@bl4ckb0ne
Copy link
Owner

bl4ckb0ne commented May 24, 2019

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

@chetgnegy
Copy link

chetgnegy commented Jun 10, 2020

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants