Closed Roughsketch closed 1 year ago
There is a panic on the following line when one of the values is NaN: https://github.com/mourner/delaunator-rs/blob/82ddbdb33651139414f2fe581f67dc12522dec32/src/lib.rs#L434
You can get around this by implementing a default ordering with something like
dists.sort_unstable_by(|&(_, da), &(_, db)| da.partial_cmp(&db).unwrap_or(std::cmp::Ordering::Less));
Or by checking if a given argument contains a NaN in the first place if NaN breaks further work. I think having one of these and returning None is preferable to a panic inside the method. At the very least this behavior should be documented.
None
Fixed by #28
There is a panic on the following line when one of the values is NaN: https://github.com/mourner/delaunator-rs/blob/82ddbdb33651139414f2fe581f67dc12522dec32/src/lib.rs#L434
You can get around this by implementing a default ordering with something like
Or by checking if a given argument contains a NaN in the first place if NaN breaks further work. I think having one of these and returning
None
is preferable to a panic inside the method. At the very least this behavior should be documented.