calculate the distance to the point of intersection:

PHOTO EMBED

Thu Sep 15 2022 23:38:32 GMT+0000 (Coordinated Universal Time)

Saved by @abell_ds #java

float uA = ((x4-x3)*(y1-y3) - (y4-y3)*(x1-x3)) / ((y4-y3)*(x2-x1) - (x4-x3)*(y2-y1));

float uB = ((x2-x1)*(y1-y3) - (y2-y1)*(x1-x3)) / ((y4-y3)*(x2-x1) - (x4-x3)*(y2-y1));
content_copyCOPY

Simple!

http://jeffreythompson.org/collision-detection/line-line.php