Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °
You are not logged in.
Post a reply
Topic review (newest first)
Yes, it seems to be fine.
Still a long way to go though, but taking things step by step
Wow John, I never looked at it like that. Good observation. Now I suppose that this type of situation really demands vector notation to be truly correct. Well at least safra's program is working correctly now.
Both answers are correct depending which direction you want to go.
Thanks Irspow. Yes, I did the if statement as I couldn't think of a way to solve this in the function. I am not sure about your second problem with the slope. With that simple if statement of x1 and x2 it seems to work fine. I tried all sorts of possible situations and it does give the desired result. Or, maybe I didn't check on y1 = y2, will do that later when I am back home.
Your first problem was because of how I structured the equations. By definition point A will have a smaller x value then point B. A simple "if" statement can easily cure that.
That's not how I did it John. I just observed that if AB had an angle of arctan 14/5 above the horizontal then line C would have that same angle from the y axis or vertical because of the 90 degree angle between them. Constructing that triangle using C as the hypotenuse is how I used the trigonomic functions. Notice that the opposite side of this angle is horizontal and thus represents the change in x, hence the use of the sine function for the x position.
It is much worse than that! Because I flipped the x and y positions for the original points my slope was off also. In corrected form:
Nice job, irspow! I like it!
arctan slope of line AB = angle of the line AC from the vertical because of the 90 degree angle between AB and AC.