mapbox / delaunator

An incredibly fast JavaScript library for Delaunay triangulation of 2D points
https://mapbox.github.io/delaunator/
ISC License
2.34k stars 141 forks source link

Cryptic error messages when data contains <3 points #45

Closed johnd0e closed 5 years ago

johnd0e commented 5 years ago
Delaunator.from([])
Uncaught RangeError: Invalid typed array length: -15

Delaunator.from([[1,2])
Uncaught RangeError: Invalid typed array length: -9

Delaunator.from([[1,2],[2,3]])
Uncaught RangeError: Invalid typed array length: -3

I suppose more clear message would be Uncaught Error: No Delaunay triangulation exists for this input.

(Well, actually I am not sure that Delaunator should throw this error as there are more simple ways to process such cases, see #46)

mourner commented 5 years ago

Fixed by #47