Click to add a point. This will make line segments from where you click. If you put your mouse on a line the point will turn red, and the variable tells you how many lines the mouse is touching.
This uses the formula I used to find intersection in the Sutherland-Hodgeman clipping. Now, I use the same formula two more times to detect a line segment instead of a line.