Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Real easy math question...


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 Tire   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 November 1999 - 11:20 AM

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?

Sponsor:

#2 bosjoh   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 November 1999 - 09:27 AM

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!).

#3 Slayer-X   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 November 1999 - 09:36 AM

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.



#4 Splat   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 November 1999 - 10:13 AM

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


#5 Slayer-X   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 November 1999 - 10:17 AM

Maybe, I got mine out of a geometry book. But I might have looked at the wrong formula.

#6 Kyle Radue   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 November 1999 - 10:55 AM

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.


#7 Tire   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 November 1999 - 11:02 AM

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.


#8 CJ   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 November 1999 - 10:55 PM

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......


#9 Splat   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 November 1999 - 10:17 AM

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


#10 todderod   Members   -  Reputation: 152

Like
Likes
Like

Posted 08 November 1999 - 11:20 AM

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 is the wanted angle)

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

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





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS