Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 奇怪的数学价值观_C#_Trigonometry - Fatal编程技术网

C# 奇怪的数学价值观

C# 奇怪的数学价值观,c#,trigonometry,C#,Trigonometry,各位!! 我试图用c来绘制sin函数7sin3t PointF[] Points = new PointF[200]; int T = 20; //t Graphics gr; private void calculatePoints() { gr = CreateGraphics(); Brush brush = new SolidBrush(Color.Red); Pen pen = new Pen

各位!! 我试图用c来绘制sin函数7sin3t

PointF[] Points = new PointF[200];
int T = 20;   //t
Graphics gr;

private void calculatePoints()
        {
            gr = CreateGraphics();
            Brush brush = new SolidBrush(Color.Red);
            Pen pen = new Pen(brush, 3);
            float xk, yk;        

            //k for scaling
            yk = (float)((this.ClientRectangle.Height - 40)/2) / 7;  
            xk = (float)(this.ClientRectangle.Width - 40) / (Points.Length);

            for (int i = 0; i < Points.Length; i++)
            {    
                //here we go
                Points[i] = new PointF(20 + i * xk,
                                      this.ClientRectangle.Height/2 - (float) Math.Sin(3 * i * T) * 7 * yk);
            }
            gr.DrawCurve(pen, Points);
        }
所以我的曲线是这样的:

但若我把罪的论点乘以180,我会得到一个很好的情节。

你能帮我一下吗


Math.Sin参数必须以弧度为单位,而不是以度为单位。

Math.Sin采用。你可以用你的数字*Math.PI/180转换成弧度。

这是因为@Blorgbeard说得非常正确;小学以外的大多数实际几何数学都使用弧度,而不是度数。好消息是,您可以通过乘法在它们之间进行转换。对于说英语的人: