如何使用 C# 转换弧度中的三角函数角?
要换算弧度中的三角函数角,乘以 Math.PI/180。这会转换度到弧度。
以下是代码:
例子
using System; class Program { static void Main() { Console.WriteLine(Math.Cos(45)); double res = Math.Cos(Math.PI * 45 / 180.0); Console.WriteLine(res); } }
在上面,我们使用下面这个公式换算:
Math.PI * angle / 180.0
广告