Beispiel #1
0
        void bezierControl1_UserPaint(object sender, UserPaintEventArgs e)
        {
            if (bezierControl1.Controller.BCPSCount >= 2)
            {
                BezierControlPoint[] bcps = bezierControl1.Controller.BCPS;
                var ba = new BezierAnalyzer(bcps);
                for (int i = 0; i < poses.Length; i++)
                {
                    ba.GetPoint(i * 99.9999f / 9, out PointF pos, out PointF dir);
                    poses[i] = pos;
                    dirs[i]  = dir;
                }
                ba.GetYFromX(this.Width / 2);
            }
#if DRAW
            foreach (PointF pos in poses)
            {
                e.Graphic.DrawEllipse(Pens.Black, pos.X - 5, pos.Y - 5, 10, 10);
            }
            for (int i = 0; i < dirs.Length; i++)
            {
                DrawAllow(poses[i], dirs[i], e.Graphic);
            }
        }
Beispiel #2
0
        private void CheckData()
        {
            if (WindowUtility.LayerManager == null)
            {
                return;
            }

            PPDSheet data = WindowUtility.LayerManager.SelectedPpdSheet;

            if (data == null)
            {
                poses = new Vector2[0];
                dirs  = new Vector2[0];
                return;
            }
            //areaselection
            var mks = data.GetAreaData();

            poses = new Vector2[mks.Length];
            dirs  = new Vector2[mks.Length];
            float[] ratios = new float[mks.Length];
            if (bezierControl1.Controller.BCPSCount >= 2 && poses.Length >= 2)
            {
                if (radioButton8.Checked)
                {
                    float all = mks[mks.Length - 1].Time - mks[0].Time;
                    if (all == 0)
                    {
                        poses = new Vector2[0];
                        dirs  = new Vector2[0];
                        return;
                    }
                    for (int i = 0; i < mks.Length; i++)
                    {
                        ratios[i] = 99.9999f * (mks[i].Time - mks[0].Time) / all;
                    }
                }
                BezierControlPoint[] bcps = bezierControl1.Controller.BCPS;
                var ba = new BezierAnalyzer(bcps);
                for (int i = 0; i < poses.Length; i++)
                {
                    PointF pos;
                    PointF dir;
                    if (radioButton8.Checked)
                    {
                        ba.GetPoint(ratios[i], out pos, out dir);
                    }
                    else if (radioButton9.Checked)
                    {
                        ba.GetPoint(i * 99.9999f / (poses.Length - 1), out pos, out dir);
                    }
                    else if (radioButton10.Checked)
                    {
                        ba.GetPoint(i * 99.9999f / poses.Length, out pos, out dir);
                    }
                    else
                    {
                        float num   = (float)60 / (WindowUtility.MainForm.BPM <= 10 ? 10 : WindowUtility.MainForm.BPM);
                        float ratio = ((mks[i].Time - mks[0].Time) / num * FixedDistance) / ba.Length * BezierCaliculator.BezierAnalyzer.MaxRatio;
                        ratio = ratio <= 0 ? 0 : ratio;
                        ba.GetPoint(ratio >= BezierCaliculator.BezierAnalyzer.MaxRatio ? BezierCaliculator.BezierAnalyzer.MaxRatio : ratio, out pos, out dir);
                    }
                    poses[i] = new Vector2(pos.X, pos.Y);
                    dirs[i]  = TransDirection(new Vector2(dir.X, dir.Y));
                }
            }
            if (checkBox4.Checked)
            {
                Apply();
            }
        }