algorithm to define a geofence and see if a point is inside/outside it

Nilgiri picture Nilgiri · Jun 1, 2012 · Viewed 9.9k times · Source

I am looking for an algorithm through I can create a geofence and check if a device is entering/leaving the fence. I have looked at point in polygon algorithms (ray casting and winding number) but are there any algorithms which can be applied to circle and any irregular shapes as well? The important constraint is time efficiency.

Thank you.

Answer

Josh C picture Josh C · Oct 9, 2012

Here is the c code algorithm that is simple to understand:

http://alienryderflex.com/polygon/