我是用Graphics 在pictureBox中绘制一个圆,然后需要这个圆以正玄波的形式移动
在网上找了很久都没找到,如何计算正玄波的轨迹?并以X,Y坐标来表示
望知道的朋友讲一下,谢谢了

解决方案 »

  1.   

    结果公式为
    y=A·sin(ωt ± θ)
    A 為波幅(縱軸), ω 為(相位矢量)角速度, t 為時間(橫軸), θ 為相偏移(橫軸左右)。
      

  2.   

    using System;
    using System.Drawing;
    using System.Windows.Forms;class SineCurve : Form
    {
        public static void Main()
        {
            Application.Run(new SineCurve());
        }
        public SineCurve()
        {
            Text = "Sine Curve";
        }    protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Rectangle cr = this.ClientRectangle;
            PointF[] aptf = new PointF[cr.Width];        for (int i = 0; i < cr.Width; i++)
            {
                aptf[i].X = i;
                aptf[i].Y = cr.Height / 2 * (1 - (float)
                                    Math.Sin(i * 2 * Math.PI / (cr.Width - 1)));
            }
            e.Graphics.DrawLines(Pens.Red, aptf);
        }
    }
      

  3.   

    您好,Macosx!
    我看了你的东西,有几个地方还需要请教一下
    cr.Height / 2 * (1 - (float)Math.Sin(i * 2 * Math.PI / (cr.Width - 1)));
    这个地方,cr.Height/2是什么意思?能详细讲一下这个公式吗?
    我的确数学差得可以了,很久没接触过了,完全不知道
    谢谢了