|
Is this a straight line? If so:
You can derive it from the principle of like triangles. Or from vector addition.
Let your endpoints be A and B
A = (x1,y1)
B = (x2, y2)
Let Delta = A - B
ie. Delta_X = x1-x2 and Delta_Y = y1-y2
Point P on line = (xp,yp)
xp = x1 + L * Delta_X
yp = y1 + L * Delta_Y
L = Real number in the range 0...1
0 gives A, 1 gives B |