mourner / delaunator-rs

Fast 2D Delaunay triangulation in Rust. A port of Delaunator.
https://docs.rs/delaunator
ISC License
207 stars 28 forks source link

Robustness questions #34

Open Chris00 opened 10 months ago

Chris00 commented 10 months ago

Thanks for your library. I saw that you use robust for orient2d but I was wondering why you did not use

I can make a PR if you agree to these changes.

mourner commented 10 months ago

This was omitted for consistency with the JavaScript version, which didn't add it because it was not that important for robustness but increased the bundle size notably (see https://github.com/mapbox/delaunator/pull/68):

Adding robust incircle would increase it more significantly (to 5322 bytes), but it doesn't seem necessary since this check only affects which triangles flip, and doesn't affect the integrity of the triangulation unlike orient2d.

Now as for hypot, this is a deliberate optimization because Delaunator doesn't need exact distances, it only calculates squared ones which are much faster since they only need multiplication, without square root.

  • hypot for your distance computations.