I would like to determine a polygon and implement an algorithm which would check if a point is inside or outside the polygon.
Does anyone know if there is any example available of any similar algorithm?
I would like to determine a polygon and implement an algorithm which would check if a point is inside or outside the polygon.
Does anyone know if there is any example available of any similar algorithm?
Just a heads up (using answer as I can't comment), if you want to use point-in-polygon for geo fencing, then you need to change your algorithm to work with spherical coordinates. -180 longitude is the same as 180 longitude and point-in-polygon will break in such situation.
You can try this simple class https://github.com/xopbatgh/sb-polygon-pointer
It is easy to deal with it
(answer was returned from deleted by myself because initially it was formatted wrong)
I think there is a simpler and more efficient solution.
Here is the code in C++. I should be simple to convert it to C#.
The complete solution in asp.Net C#, you can see the complete detail here, you can see how to find point(lat,lon) whether its inside or Outside the Polygon using the latitude and longitudes ? Article Reference Link
private static bool checkPointExistsInGeofencePolygon(string latlnglist, string lat, string lng) {