Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**safra****Member**- Registered: 2005-12-03
- Posts: 41

Hi again,

I got a new problem based on this thread:

http://www.mathsisfun.com/forum/viewtopic.php?id=2094

Imagine for example a triangle with points A (20,19) and B(15,5) and point C(?,?). The angle at point B is 90 degrees and the distance between B and C is 5. What would be the fastest way to calculate point C?

Offline

**irspow****Member**- Registered: 2005-11-24
- Posts: 457

arctan slope of line AB = angle of the line AC from the vertical because of the 90 degree angle between AB and AC.

So x = 5 + 5 sin arctan (5/14) ≈ 6.68

y = 15 - 5 cos arctan (5/14) ≈ 10.29

*Last edited by irspow (2005-12-05 07:41:07)*

Offline

**John E. Franklin****Member**- Registered: 2005-08-29
- Posts: 3,588

Nice job, irspow! I like it!

slope is negative reciprocal of other slope.

And then you have to mentally know the... Uh oh,

there is one mistake, though, minor typo.

x is y and y is x for the final answer.

So it is (10.29,6.68) for C.

So anyway I was going to say you mentally have to see which way

the 90 degrees points the vector up and left, hence the subtract sign

for the cosine for x value, and the plus for sine, and they have to

be different signs because slope is negative now.

**igloo** **myrtilles** **fourmis**

Offline

**safra****Member**- Registered: 2005-12-03
- Posts: 41

Thanks both!

I will play with this and see if I can translate this to delphi pascal code. One thought (maybe I am misunderstanding your words), the 90 degree angle is at point B (AB and BC) not at point A (AB and AC). Anyway if this means your formula should look a bit different then I should be able to change this myself. I did think of the fact that I didn't mention to which side the 90 degree angle point, thanks for letting me know how to deal with that John.

Raoul

Offline

**irspow****Member**- Registered: 2005-11-24
- Posts: 457

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:

x = 15 + 5 sin arctan (14/5) = 19.708

y = 5 - 5 cos arctan (14/5) = 3.318

Thanks for catching the mistake though. (blush)

*Last edited by irspow (2005-12-05 09:12:32)*

Offline

**irspow****Member**- Registered: 2005-11-24
- Posts: 457

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.

Offline

**safra****Member**- Registered: 2005-12-03
- Posts: 41

Works great!

Although I had to deal with two issues (this is a directx 3d project) when the x value of B is higher then x of A then the point is flipped to the wrong side of B. When both x's are the same it also choses the wrong side by default.

Offline

**irspow****Member**- Registered: 2005-11-24
- Posts: 457

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.

The second problem I hadn't thought about at all. There is no slope in such a situation. This would also seem a good place for an "if" statement. Then you can just pick a location like half of delta y or whatever you feel is a good place for that instance.

Anyway, I hope your project is coming along now. Good luck.

Offline

**safra****Member**- Registered: 2005-12-03
- Posts: 41

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.

Offline

**John E. Franklin****Member**- Registered: 2005-08-29
- Posts: 3,588

Both answers are correct depending which direction you want to go.

I'm glad your computer program is working!!!! I love to program too.

See image below:

**igloo** **myrtilles** **fourmis**

Offline

**irspow****Member**- Registered: 2005-11-24
- Posts: 457

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.

Offline

**safra****Member**- Registered: 2005-12-03
- Posts: 41

Yes, it seems to be fine.

Well at least safra's program is working correctly now.

Still a long way to go though, but taking things step by step

Offline

Pages: **1**