TJ Hanson
2016-07-29 18:22:33 UTC
I’ve drawn a polygon on a canvas. For simplicity assume the x axis is longitude and the y axis is latitude. The polygon can have any shape, with 3 to many sides.
Now I have a point to plot. The point is designated with x,y coordinates (or in this case, lat/long coordinates).
I want to plot this point only if it falls within the polygon.
How can I tell if I am inside the polygon?
This may sound like an easy problem, but I’ve spent the last 24 hours looking at it, and it keeps getting more complicated. Especially since the polygon can take on any shape. For example:
|
| /———|
| / | Given three points I can see that only one falls inside the polygon. But
| • / | ——| I need to be able to figure that out programatically.
| / |
| / / —-\ • |
| / / • \ |
| /——/ \——|
|—————————————-
Any ideas would be greatly appreciated.
TJ
_______________________________________________
Unsubscribe by sending a message to:
<nug-lea
Now I have a point to plot. The point is designated with x,y coordinates (or in this case, lat/long coordinates).
I want to plot this point only if it falls within the polygon.
How can I tell if I am inside the polygon?
This may sound like an easy problem, but I’ve spent the last 24 hours looking at it, and it keeps getting more complicated. Especially since the polygon can take on any shape. For example:
|
| /———|
| / | Given three points I can see that only one falls inside the polygon. But
| • / | ——| I need to be able to figure that out programatically.
| / |
| / / —-\ • |
| / / • \ |
| /——/ \——|
|—————————————-
Any ideas would be greatly appreciated.
TJ
_______________________________________________
Unsubscribe by sending a message to:
<nug-lea