earcut
earcut copied to clipboard
Suspicious handling of a number (result of area) as a boolean
Is handling the number result of the area call as a boolean value intended in the snippet below?
https://github.com/mapbox/earcut/blob/36742a5a24497f56d89f024a7b44a0a4f8e07128/src/earcut.js#L476-L481
As I understand the code now, it checks that at least one of the triangles a.prev, a, b.prev and a, b.prev, b has non zero area. I do not understand the intent well enough, the comment says "does not create opposite-facing sectors".
If the code is correct, perhaps an explicit comparion using !== 0 would make the intent clearer?
(Originally reported as https://github.com/mrdoob/three.js/issues/20200)