Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: √ ∞ ≠ ≤ ≥ ≈ ⇒ ∈ Δ θ ∴ ∑ ∫ π -




Not registered yet?

Post a reply

Go back

Write your message and submit
:) :| :( :D :o ;) :/ :P :lol: :mad: :rolleyes: :cool: | :dizzy :eek :kiss :roflol :rolleyes :shame :down :up :touched :sleep :wave :swear :tongue :what :faint :dunno

Go back

Topic review (newest first)

2005-12-09 06:52:37

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

2005-12-08 07:39:30

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.

John E. Franklin
2005-12-08 03:11:23

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:

2005-12-08 01:49:43

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.

2005-12-07 09:43:46

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.

2005-12-06 20:18:10

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.

2005-12-06 08:28:48

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.

2005-12-06 08:06:43

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)

2005-12-06 07:48:57

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.


John E. Franklin
2005-12-06 07:38:30

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.

2005-12-06 06:36:22

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

2005-12-05 20:27:01

Hi again,

I got a new problem based on this thread:

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?

Board footer

Powered by FluxBB