Archived

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

Calc the angles?

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