I need help coming up with an algorithm to determine if the user clicks on any point of a line. A line is given by two points.
So you have x1, y1 positions of the first point, and x2,y2 positions of the second point.
I need to determine in the mousePressed event, if the x and y positions of the mouse (evt.getX() and evt.getY()) fall on a point on the line between the two original points.
Any help on this would be greatly appreciated. Thanks