The angle sin returns a negative result for the acute angle

Math.Sin operates on radians. You need to convert degrees into radians.

To convert degrees to radians multiply the angle by /180:

var sin = Math.Sin(4.45*Math.PI/180);
// output 0.07758909147106598

And the rest of your code should remain the same.

Note: if you just want to convert an angle in degrees to angle in radians you can use the formula above:

var degrees = 4.45;
var radians = degrees * Math.PI/180;

Let's compute angles of the triangle with a help of Law of cosines:

a**2 + b**2 - 2 * a * b * cos(gamma) == c**2

so

gamma = acos((a * a + b * b - c * c) / (2 * a * b))   
beta  = acos((a * a + c * c - b * b) / (2 * a * c))   
alpha = acos((c * c + b * b - a * a) / (2 * c * b))   

now put triangle lengths

a = 6.22
b = 6.07
c = 1.40

into formulae above and you'll get angles (in radians, if you use c# Math.Acos)

 alpha = 1.5639 =  89.6 degrees
  beta = 1.3506 =  77.4 degrees
 gamma = 0.2270 =  13.0 degrees
 ------------------------------
                  180.0 degrees (let's check ourselves)

Another check is Law of sines

 a / sin(alpha) == b / sin(beta) == c / sin(gamma) == 6.2201

Tags:

C#

Math