Mathematically speaking you cannot find the intersection of mouse and point/line because the latter do not have an area. What you probably need is finding the distance between mouse cursor and your object - line or point. And if the distance is below certain value you treat your object as "selected".
To find distance between two pints you can simply use Euclidean distance formula.
Here is an example (in C) how to find distance between line segment and point. You have to test for three possible cases - the closest point to cusrsor is one endpoint, other endpoint or certain mid-line point.
static double
nr_line_point_distance2 (float Ax, float Ay, float Bx, float By, float Px, float Py)
{
double Dx, Dy, s;
double dist2;
Dx = Bx - Ax;
Dy = By - Ay;
s = ((Px - Ax) * Dx + (Py - Ay) * Dy) / (Dx * Dx + Dy * Dy);
if (s <= 0.0) {
dist2 = (Px - Ax) * (Px - Ax) + (Py - Ay) * (Py - Ay);
} else if (s >= 1.0) {
dist2 = (Px - Bx) * (Px - Bx) + (Py - By) * (Py - By);
} else {
double Qx, Qy;
Qx = Ax + s * Dx;
Qy = Ay + s * Dy;
dist2 = (Px - Qx) * (Px - Qx) + (Py - Qy) * (Py - Qy);
}
return sqrt (dist2);
}