There must be an algorithm to find the coordinates of the segment overlapping (fully or partially) two lines/segments but my googling does not produce any significant result. Maybe I don't use the right keywords? I tried overlapping, segment, line, collinear but nothing of interest was returned.
Does anyone know of such an algo, the name, the implementation, whatever that could help me point toward a solution?
Or does anyone know how to compute the overlapping segment?
For example, having line L1 with P0 (0,0) and P1 (5,5) and line L2 with P2 (3,3) and P3 (10,10) the resulting overlapping segment would be (3,3) to (5,5).
If $L_1$ and $L_2$ are not parallels lines, so there is not any overlap; you can find the coordinates of intersection by solving a 2x2-system (here the Cramer's rules could be usefull).
Else, if the line is not parallel to y-axis: you can do the staff on the real line with the x's of the points and then calculate the corresponding y's (how do you compute the overlap between $[0;5]$ and $[3,10]$?).
If the line is parallel to y-axis, then simply work on the y's of the points.