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

You are not logged in.

#1 2005-12-04 21:27:01

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

more vectors, angles and vertices...

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

#2 2005-12-05 07:36:22

irspow
Member
Registered: 2005-11-24
Posts: 455

Re: more vectors, angles and vertices...

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

#3 2005-12-05 08:38:30

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

Re: more vectors, angles and vertices...

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

#4 2005-12-05 08:48:57

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

Re: more vectors, angles and vertices...

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

#5 2005-12-05 09:06:43

irspow
Member
Registered: 2005-11-24
Posts: 455

Re: more vectors, angles and vertices...

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

#6 2005-12-05 09:28:48

irspow
Member
Registered: 2005-11-24
Posts: 455

Re: more vectors, angles and vertices...

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

#7 2005-12-05 21:18:10

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

Re: more vectors, angles and vertices...

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

#8 2005-12-06 10:43:46

irspow
Member
Registered: 2005-11-24
Posts: 455

Re: more vectors, angles and vertices...

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

#9 2005-12-07 02:49:43

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

Re: more vectors, angles and vertices...

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

#10 2005-12-07 04:11:23

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

Re: more vectors, angles and vertices...

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:
mathisfun9sh.jpg


igloo myrtilles fourmis

Offline

#11 2005-12-07 08:39:30

irspow
Member
Registered: 2005-11-24
Posts: 455

Re: more vectors, angles and vertices...

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

#12 2005-12-08 07:52:37

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

Re: more vectors, angles and vertices...

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 wink

Offline

Board footer

Powered by FluxBB