Closed AndriBaal closed 1 year ago
I use delaunator in a project of mine and sometimes on specific conditions the delaunator crashes because of the partial_cmp of 2 floats without a fallback. Specifically, this needs to be changed:
fn sortf(f: &mut [(usize, f64)]) { f.sort_unstable_by(|&(_, da), &(_, db)| da.partial_cmp(&db).unwrap()); }
to:
fn sortf(f: &mut [(usize, f64)]) { f.sort_unstable_by(|&(_, da), &(_, db)| da.partial_cmp(&db).unwrap_or(core::cmp::Ordering::Equal)); }
@AndriBaal nice catch! Would you mind making a PR with a fix + test?
Looks like this would fix #9 too.
I have created a pull request, let me know if anything is missing. #28
Fixed by #28
I use delaunator in a project of mine and sometimes on specific conditions the delaunator crashes because of the partial_cmp of 2 floats without a fallback. Specifically, this needs to be changed:
to: