You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tests if the given point is inside of a polygon with arbitrary orientation.
which sounds like it should work with any arbitrary polygon. However, in my application, I have non-convex polygons I tested against, and while there are no false positives, it leaves parts of the polygon out:
(the tracing is inexact, I'm just spawning a dot whenever the mouse is detected to be inside the polygon)
Based on the output I'd guess it only works for convex polygons (although I don't understand the algorithm), in which case it would be nice to have a mention of this in the docs.
The text was updated successfully, but these errors were encountered:
I was having a similar problem where I was defining a list of points. Sometimes the method would return true but it mostly return false. Turns out my points were getting jumbled up. I think this only works if the points are defined in sequence clockwise or counter clockwise. If your points are "zig zagged" then it won't work.
If the method should handle concave and convex shapes, this makes sense because changing the sequence of points creates a different shape.
By arbitrary, I think they meant the ordering doesn't matter. For example, the following sequences all form the same polygon:
The documentation says:
which sounds like it should work with any arbitrary polygon. However, in my application, I have non-convex polygons I tested against, and while there are no false positives, it leaves parts of the polygon out:
(the tracing is inexact, I'm just spawning a dot whenever the mouse is detected to be inside the polygon)
Based on the output I'd guess it only works for convex polygons (although I don't understand the algorithm), in which case it would be nice to have a mention of this in the docs.
The text was updated successfully, but these errors were encountered: