|
I think there was an error in my original reply - the sign of Delta is reversed.
For what you're after a "Method of Similar Triangles" is probably more appropriate but requires a diagram to be clear. Mathematically it is the same though.
Line A-B, what is X for a particular Y?
A=Ax,Ay
B=Bx,By
Like triangles gives:
(Ax-Bx) / (Ay-By) = ( X - Bx) / ( Y - By)
Note: Ay=By will give an error - you need to check for this.
As will Y = By
Re-arranging,
(X-Bx) = (Ax-Bx) * (Y-By) / (Ay-By)
=> X = Bx + (Ax-Bx) * (Y-By) / (Ay-By)
Richard |