Kruptein / PlanarAlly

A companion tool for when you travel into the planes.
https://www.planarally.io/
MIT License
400 stars 73 forks source link

bug(Polygon): Fix code that checks if a certain point is on the polygon #1380

Closed Kruptein closed 8 months ago

Kruptein commented 8 months ago

Two bugs were fixed in this code.

The below image shows a blue polygon with in red what the contains check was actually going through.

image

The contains code was wrongly using code that filters out duplicate points, causing 2 edges to be completely skipped and a direct line being drawn between two vertices that are not connected.

Additionally the first and last points were also being connected even though the polygon is not closed.