2 Lat/Long Segments Defined By 4 Lat/Long Points - Calculate If They Intersect & How
I have 2 lat/long segments defined by lat and long end points.
For example, I have Segment X (defined by A.lat, A.long and B.lat, B.long where A and B are end points) and similarly Segment Y (defined by C.lat, C.long, D.lat, D.long).
I want to work out if they cross first. (For cartesian coordinates I would check the signs of the dot products).
Then if they cross I want to work out how far as a proportion along Segment X (between A and B) does it cross Segment Y.
Is there any sample code that does this to a high degree of accuracy (I'm talking about mm rather then km).
Thanks.
أكثر...
I have 2 lat/long segments defined by lat and long end points.
For example, I have Segment X (defined by A.lat, A.long and B.lat, B.long where A and B are end points) and similarly Segment Y (defined by C.lat, C.long, D.lat, D.long).
I want to work out if they cross first. (For cartesian coordinates I would check the signs of the dot products).
Then if they cross I want to work out how far as a proportion along Segment X (between A and B) does it cross Segment Y.
Is there any sample code that does this to a high degree of accuracy (I'm talking about mm rather then km).
Thanks.
أكثر...