In pointInPolygon there is no check if the polygon is already closed. The first point is added anyway. If it is already closed however the result is false.
The problem is not that the extra points introduced for an already closed polygon get in the way, but the specific choice of the "point far away". The round coordinates I chose for my
test case make the point intersect two sides at the vertices.
This is a corner case that needs to be solved!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The problem is not that the extra points introduced for an already closed polygon get in the way, but the specific choice of the "point far away". The round coordinates I chose for my
test case make the point intersect two sides at the vertices.
This is a corner case that needs to be solved!