Hi,
I have written a method which calculates the angle between 3 nodes.
The problem is: it returns only 0-180 angle so i cant know the direction.
I need to add something that will return -180 - 180 or 0 - 360.
here's the method:
///
{
double result; // calculating the 3 distances double ab = GetDistance(a, b); double bc = GetDistance(b, c); double ac = GetDistance(a, c); double cosB = Math.Pow(ac, 2) - Math.Pow(ab, 2) - Math.Pow(bc, 2);cosB = cosB / (2 * ab * bc);
result = 180 - (
Math.Acos(cosB) * 180 / Math.PI); return result;}
Replies
Know the answer? Post it — somebody with the same question will find it here.