0

I am using c# and have a geofence. I have a starting point lat and long and a end point lat and long. I want to detect if at any point the line that would be between the lat and long would intersect or goes "through" a geofence.

I looked at the Ray Casting algorithm but I'm not sure how to implement it in this use case.

Beachmat
  • 45
  • 6
  • Duplicate of https://stackoverflow.com/questions/16203760/how-to-check-if-line-segment-intersects-a-rectangle – Caius Jard Sep 28 '21 at 05:15
  • I'm not sure this is the same since it would pass through multiple vectors. – Beachmat Sep 28 '21 at 14:50
  • I don't really know what you mean by that, but it made me realize that I'm not sure what you meant by "geofence" either; to me a geofence is either a point plus a radius (a circle), or it's a polygon defined by a set of lines, themselves defined by a set of points. In either case it's programmatically possible to calculate if your line intersects as they're basic "does line a intersect line/circle b" (and if it's a polygon that has 10 sides then you run the check 10 times, quitting early if there is an intersection) – Caius Jard Sep 28 '21 at 19:38

0 Answers0