Spurious points in the corner polygon
Fil opened this issue · comments
This is not a graphic error, as the points are aligned, but topologically it could be nice (?) to avoid them, as we did in #83 to avoid repeated points.
In the following example the cell for point 0 has 6 different points, when 4 would be enough (discounting the last one which closes the path).
So, eliminate successive collinear points, the same way we eliminate coincident points to fix #42? My guess is that this probably isn’t worth the additional computational effort.
Filtering out collinear points should be very fast so it likely won't add much overhead. And it only happens on cells near the border right?
I seem to find them only at the corners.
Here's an explorable notebook that seems to confirm it's only the corners:
https://observablehq.com/d/390c5610c938f86f
The filter I have works for what I was looking for, but maybe the situation can be prevented earlier.
@Fil if it's only for the corners, you could replace orientation test with a much simpler check since edges are axis-aligned (x0 === x1 === x2
or y0 === y1 === y2
).