I don't know if polygon is the way to do it...
I can suggest a more basic approach, where you compute the distance of point to a line segment and check for distance < fence radius
you can compute line segments of your route, in your case the segments are (A,B) (B,C)
when you got a new position and want to know if it reside within the fence, you just compute the distance of that position to each line segments
the calculation of this is explained (very clearly, with code examples) in here
the math of geo position is pretty straight forward when dealing with small areas (don't need to take the earth curvature into consideration) but even if you do, it's a small change and there a lot of code examples for that either