Application situation:
Give a series of lane lines (end ends), hoping to find out which lane the car is in. Lane lines are not parallel to each other because the data originates from image projections.
Scenario A:
assuming that the lane line is around 90 degrees, you can directly use the x-coordinate of the point and the average x-coordinate distance at both ends of the lane line. Take the two closest lines from the x-coordinate
Programme B:
Further extended to a straight line in any direction, you can find the distance from the point to the lane line. Take points to the nearest two lines from the line
Reference: point to line y = kx + b Distance distance = ABS (k * point.x-point.y + b)/sqrt (k * k + 1);
Programme c:
After you remove the proportional relationship between segments, the previous method will not work.
This calculates the angle between the point and the 4 endpoint of the adjacent segment. If 4 angles (between adjacent lines) and 360 degrees, the pair of segments.
Reference: Vertex (x, y) with an angle of 2 points (xa, ya), (XB, YB) on the Edge a = ABS (Arctan ((ya-y)/(Xa-x)) –arctan ((yb-y)/(xb-x));
The graph point is judged by the position of the line (the point is between the two lines)