Real easy math question...

Started by
8 comments, last by Tire 24 years, 5 months ago
If I remember my math lessons right there is something called 'cosinus regel' (maybe translated to cosine rule?), but unfortunately I've forgotten this (doh!).
Advertisement
It's either that or the law or sines...Here is the formula for the law of cosines to get angle a from entering all 3 sides:

A = side a
B = side b
C = side c

B² + C² - 2BC/A²

Hopefully that helped. You could just figure out the 3rd side or make one up until you get what you're wanting.

Actually, in triangle trigonometry you need to know THREE things; either three sides, two sides and the INCLUDED angle, or one side and the two adjacent angles. Just two sides will not give you anything.

Also, pretty sure the cosine rule is for SAS, not SSS, and it reads:

a^2 = b^2 + c^2 - 2bc cos A

That gets you the third side given two sides and the included angle.

- Splat

Maybe, I got mine out of a geometry book. But I might have looked at the wrong formula.
Linear algebra to the rescue!!

Let vA be one of your sides (tail at the origin) and vB be the other side (tail at the origin).

Then you can use this formula to find the angle between any two vectors (works in n-dimensions too :-)

angle = acos (vA . vB / (|vA| * |vB|))

Note that "vA . vB" is the inner (dot) product of vA and vB, and |vA| represents the magnitude of the vector vA.

I believe this formula is derived from the cosine rule which Splat stated.

Thanks for refreshing my memory. I think I got it. If c and b are my known sides and A is the desired angle between c and b (SAS) then I can figure out side a with the distance formula because I know the points that make up lines b and c. Now I can use the law pf cosines and solve for cos A:

cos A = (b^2 + c^2 - a^2) / 2bc

Then I can use the arc-cosine function to find the angle A:

acos(cos A) or
acos((b^2 + c^2 - a^2) / 2bc)

I think that will work.

I don't think you have got it. I mean, you don't have the a, so you can't use the cosine rule.

I think I will use my brains for a while to point out that it is hardly possible (with my undrstanding)

Since a traingle can be everything, you can use Pythagoras to solve this. So you need something else.

You only know two sides, and would like to knw the angle between them. This is NOT possible. If you just think about it. If the length of one side is 2 and the other is 3. Then the angle could be anything...let's just say 45. But the same angle could be with lengths of 1000 and 345. Tha \t doesn't matter.

You can only solve this equation if you know, for, instance the length of 3 sides.
This could be accomplished if you know both the starting position and end position of each line of the triangle. This would also make it much easier. You probably have those coordinates, because you write them (probably) to the screen, and you could just use those.

Now I am thinking about it. If you are absolutely sure that the angle is less than 90 degrees, then you might want to try to make a line right up to the other one, and see where that line will collide with again the second line
(ie. line a, b and c....line c, right at a, and see where c hits b)
Then you could use Pythagoras.

Enough brainstorming, wasn't f any help I think

------------------
Dance with me......

Basically, as I said above, you need to know THREE OR MORE things about a triangle to figure out the rest. With two sides you have an infinite number of possibilities. SAS, ASA, SSS, SAA contain enough knowledge to get you the rest of the triangle, but AAA and ASS don't.

- Splat

I want to find the angle between two sides of a triangle. Is it possible to find one of the angles of a non-right triangle if all I know are the lengths of 2 sides? If so, how?
Yes, in pure mathematics, this problem can not be solved (we do need to know three things), but since this most certanly will be plotted to the screen or something, we would know the coordinates! (strange thing would be if we din't!) So set up things like this:

We have two lines a and b. line a has the end coordinates (ax,ay) and the shared coordinate (abx,aby). Line b is (bx,by) to the shared (abx,aby). From the two "loose" endpoints we create a third line, c. The coordinates in wich this line exists is (ax,ay) and (bx,by).

The length of a and b is given. Length of c is sqr((ax-bx)^2+(ay-by)^2).

Geometric laws (Cosine rule): c^2 = a^2 + b^2 - 2abCos(C) // (C is the wanted angle)

wich means that Cos(C) = (c^2-a^2+b^2)/(-2ab)

I think that this would be the best way to deal with the situation.

This topic is closed to new replies.

Advertisement