Hello, I tried the challenge with the formula and I made a mistake by doing y1-y2 / x1 - x2 and even so, the result was correct. I only know if it is reversed in calculating vector direction, it gets the opposite direction, but here it is the same. It only changed on which side of the division line thingy (I do not know the English word for it ) the minus sign is. So I am wondering if it is a serious mistake and will eventually bite me in the ass, or why it even works in the first place. Thanks for reading!
Hi @Desfell, weâve mostly been dealing with negative gradients so far, since weâre concerned with fuel running out over time. Depending on which order you subtract the points, youâll just end up with a single negative sign on either the top or the bottom of the fraction. This doesnât really matter though since -a/b = a/-b = -(a/b)
.
However, if you try doing this with a line that has a positive gradient then youâll find that one way will be easier to work with than the other.
If you take the second point away from the first then youâll end up with two positive values and youâre done.
If instead you take the first away from the second, youâll end up with two negative values and will have to add an extra step to simplify things.
The end result in either case will still be the same but doing it the âwrongâ way just creates some unnecessary work that could have been avoided.
Iâd recommend playing around with this to see for yourself since itâs great practice and should help you understand it better.
Anyway, I hope that answers you question. If youâd like me to clarify anything, just let me know.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.