Closed trehn closed 3 years ago
Interesting! Might be a bug — will look at it next week.
The reference implementation (Delaunator in JavaScript) works fine on that input, so must be something off in the port.
I've been getting the same issue while trying out this library. It makes it impossible to use for my purpose since it involves lots of calls with moving points. It seems I can only loop a few thousand times on average before it hits this and crashes.
From what I can tell the cause is on line 232: https://github.com/mourner/delaunator-rs/blob/82ddbdb33651139414f2fe581f67dc12522dec32/src/lib.rs#L230-L235
e
at this point will be -1, or EMPTY
, and instead of handling the empty value it instead tries to index into the slice. I do not know enough about the algorithm to know what is causing this, so I'm not sure if a simple empty check would suffice.
@mourner - whenever you get some time, do you think you could do a package release on crates.io with this fix? I use this crate on my library and I'd love to be able to reference the package version with this fix. Let me know if I can help in any way. Thank you!
I'm trying to triangulate a detailed map of the world. On several "chunks" (think islands on the map) of my data, delaunator crashes. Here is one example:
When I run this code, delaunator panics:
Any idea what's going on here?