the math eludes me

for some reason I cannot make what should be a simple equation to work out right

Given. a Vector (ie. a Line) defined by X1,Y1, X2, Y2

find the point (x3,y3) that is ON the defined line, and is 40% the distance from (X1,Y1)

therefore all 3 points are on the line (x1,y1), (x3,y3), and (x2,y2)

where D is the distance from (x1,y1) to (x2,y2)
and D*0.40 is the distance from (x1,y1) to (x3,y3)

I THOUGHT it would be


If you copied and pasted that code, you have a bug. Look at the very last line.

proportionnality gives : x3 = X1 + 0.4*(X2-X1), and Y3 = Y1+ 0.4*(Y2-Y1)
it seems like what you wrote.

forum typo

I found my error… I had an array of points… and needed the 40% mark between each pair.
but I was calculate DX,DY inverse based on the order in the array.