Jump to content
  • Advertisement

Archived

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

Sim

Calc the angles?

This topic is 6058 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


Link to post
Share on other sites
Advertisement
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 .

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!