Angle between two lines

Mikel

New member
Joined
Apr 8, 2022
Messages
3
I'm trying to solve a larger problem but first I decided to check I understood the basics, so I created a simple problem, as a launching point.

Unfortunately I can get the simple problem to work.

Let's start with a simple equilateral triangle with points A (0,0), B(100,0) and C (50,86.6).

The gradient of AB is 0, the gradient of BC is -1.732051, and the gradient of CA is 1.732051.

Now I know the formula for the angle between 2 lines is

1649427262825.png

When I plug in the numbers I should, given it's an equilateral triangle, get each angle being 60 degrees.

However, for the apex of the triangle (angle BCA) I must be doing something wrong as I don't get the correct answer.

The maths I have is:

tan⁡θ=(-1.73205-1.73205) / (1+173205⋅1⋅73205)

tan⁡θ=-3.4641 / (1+3)

tan⁡θ=-3.4641 / 4

tan⁡θ=-0.8660

And hence θ = 40.8934 degrees.

This is clearly wrong but I can't see where I've made my mistake.

Can anyone help and point out where I went wrong?

Thanks in appreciation.
 
Let's start with a simple equilateral triangle with points A (0,0), B(100,0) and C (50,86.6).

The gradient of AB is 0, the gradient of BC is -1.732051, and the gradient of CA is 1.732051.

Now I know the formula for the angle between 2 lines is

View attachment 32045

When I plug in the numbers I should, given it's an equilateral triangle, get each angle being 60 degrees.

However, for the apex of the triangle (angle BCA) I must be doing something wrong as I don't get the correct answer.

The maths I have is:

tan⁡θ=(-1.73205-1.73205) / (1+173205⋅1⋅73205)

tan⁡θ=-3.4641 / (1+3)

tan⁡θ=-3.4641 / 4

tan⁡θ=-0.8660

And hence θ = 40.8934 degrees.
Where did you get the formula? I searched for various versions of it, and didn't find any that use the absolute value, though some put an absolute value around the whole expression. A typical example is here.

It should be [math]\tan\theta=\left|\frac{m_2-m_1}{1+m_1m_2}\right|[/math]
And that formula works.
 
I'm trying to solve a larger problem but first I decided to check I understood the basics, so I created a simple problem, as a launching point.
Unfortunately I can get the simple problem to work.
Let's start with a simple equilateral triangle with points A (0,0), B(100,0) and C (50,86.6).
Lets don't have rounding errors. The third vertex of that equilateral triangle is [imath]C:~(50,50\sqrt{3})[/imath]
 
Lets don't have rounding errors. The third vertex of that equilateral triangle is [imath]C:~(50,50\sqrt{3})[/imath]
Exactly my point when I offered the 'hint': "use the gradients as √3 instead of 1⋅73205..." ?
 
Now I know the formula for the angle between 2 lines is

View attachment 32045
Where did you get the formula? I searched for various versions of it, and didn't find any that use the absolute value, though some put an absolute value around the whole expression. A typical example is here.
After some further consideration of what's been posted so far I felt I had to add just a little a bit more to this thread.

I think we can all agree that your "formula" (as shown in the link, above) is just plain wrong (as evidenced by the incorrect result it produced); did you, perhaps, just recall it incorrectly or have you actually seen it 'published' anywhere like that? (Please say if you have; we can perhaps alert them to their error.)

I felt the need to add further comment because, while the version that Dr.P. posted certainly works, ie: the formula may well be written as:-[math]\tan\theta=\left|\frac{m_1-m_2}{1+m_1m_2}\right|[/math]
this, however, has the effect of restricting the resulting value of θ to the first quadrant, ie: it will return (only) the acute angle between the two lines.

I would suggest, therefore, that it may be preferable to memorise/use the formula in the simpler form:-

[math]\tan\theta=\frac{m_1-m_2}{1+m_1m_2}[/math]
whilst bearing in mind that, if you get a negative result, the formula is just returning the tangent of the obtuse angle between the lines!

The only other thing to remember then is that, if m1 × m2 = -1, then the formula "fails" because the lines are perpendicular, ie: θ=90°, and you end up with a division by zero in the formula.

Hope that helps. ?
 
Where did you get the formula? I searched for various versions of it, and didn't find any that use the absolute value, though some put an absolute value around the whole expression. A typical example is here.

It should be [math]\tan\theta=\left|\frac{m_2-m_1}{1+m_1m_2}\right|[/math]
And that formula works.
Thanks for the response. Much appreciated. 50 websites to choose from and I took the one with the dude formula.
 
Indeed. Don't use absolute values in the denominator and the arithmetic leads straight to: tan-1(√3), hence 60º between the lines. ?

(Hint: use the gradients as √3 instead of 1⋅73205.....) ;)8-)
Thanks for the response. Much appreciated. 50 websites to choose from and I took the one with the dude formula.
 
Top