I am going through code snippets that calculate the x-intersection point between the line parallel to the x-ais and an arbitrary line between points (x1,y1) and (x2,y2). The code snippet does the following:
double t = (x2 - x1)/(y2 - y1);
xDbl = (static_cast(yPos) - y1) * t + x1;
I am having difficulty to understand the calculation of t, is it rise over run ? Some mathematical reference to the above snippet would be very helpful.
Thanks