In cartesian coordinate system for segment $AB$ with known points $A(x_1, y_1)$ and $B(x_2, y_2)$ which lies on a line $a$ what is the easiest way to realise does the segment contains point of intersection $C (x_0, y_0)$ of the line $a$ and it's perpendicular $b$ to the centre $O (0, 0)$? The point of intersection of lines $a$ and $b$ isn't necessary.
Following algorithm looks like difficult:
- find equation of the $a$;
- find equation of the $b$;
- solve the system of equations and find the point $C$;
- check does $x_o$ and $y_0$ belong to $AB$.
If $OB\ge OA$, segment $AB$ contains the projection of $O$ on line $AB$ if and only if $OB^2- OA^2\le AB^2$. That way you check if $\angle OAB\le 90°$.