A basic concept
Base point: The coordinate point where the selected picture is selected.
Straight line: It is the X-direction and Y to the axis of the base point, but there is a length range, in fact, a line segment, the middle is the assumption.
Path: Composed of some connected lines, not more than three straight lines.
Two specific ideas
1. First obtain the base points P1, P2 at two selected pictures.
2, establish a straight line of P1 and P2, with up to four.
3. Judgment the relationship between the base points P1 and P2.
4. If two base points are on the same straight line, they can be directly connected to a path to generate a path.
5, not on the same line. At this point, it is also necessary to determine whether the straight line of P1 and P2 intersects. If there is intersect, it can also directly form a pathway. If you do not intersect, you need another straight line to form a path and can only add a straight line. Look for two straight lines in parallel, start every point of the vertical line from one end of a straight line, see if it is intersecting another line, if you intersect, you get a new path. If there is no intersection, it means that the two base points cannot be connected. In this way, the other two lines can also be searched over again to know if the two base points can be connected.
This is a thought of connecting the algorithm in the connection, just not realized, first here, then realize it later.