Is handling the number result of the area call as a boolean value intended in the snippet below?
|
function isValidDiagonal(a, b) { |
|
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges |
|
(locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible |
|
(area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors |
|
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case |
|
} |
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 mrdoob/three.js#20200)
Is handling the number result of the
areacall as a boolean value intended in the snippet below?earcut/src/earcut.js
Lines 476 to 481 in 36742a5
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 mrdoob/three.js#20200)