Calc the angles?
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
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 .
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 .
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement