You have the right formula, provided that (x1, y1) and (x2, y2) were actually the end-points of the line. Perhaps they weren't... we certainly can't determine that by looking at your post. Also read this: ItDoesntWorkIsUseless and then post something which would help us to help you better.
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
Devious Experiments for a Truly Passive Greenhouse!