Il suggerimento te l'ho dato, si tratta di fare qualche trasformazione algebrica sulla formula (y - y1) / (y2 - y1) = (x - x1) / (x2 - x1) :

(y - y1) / (y2 - y1) = (x - x1) / (x2 - x1)
(y - y1) * (x2 - x1) = (x - x1) * (y2 - y1)
...