Jump to content
• Advertisement

#### Archived

This topic is now archived and is closed to further replies.

# Calc the angles?

This topic is 6147 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hi! How can I calc the angles in a normal triangle (it hasn''t to be a rectanglar), if I have got the lenght of all three sides? thx

#### Share this post

##### Share on other sites
Advertisement
a^2 = b^2 + c^2 - 2.b.c.cos A

from which you get the angle A.

Idem for B,C.

#### Share this post

##### Share on other sites
a triangle has 3 points(p1,p2,p3) and
3 edges(e1=p2-p1,e2=p3-p1,e3=p3-p3).
now the edges are vectors.
normalize them! e1.normalize() ...
then e.g. to calc the angle btw. e1 and e2 take the
float dot = dotproduct(e1,e2);
to get the angle in radians -> float angle = acos(dot).
if you want angle in degrees -> angle = (angle * PI) / 180;

hope that helps .

THX ALOT!!!

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
17
3. 3
4. 4
5. 5
• Advertisement

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633735
• Total Posts
3013596
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!