Ejemplo n.º 1
0
        public void DrawSplines(Bitmap bmp, TransCoord TC, List <Points> list)
        {
            int   j    = 0;
            float step = 0.01f;

            List <PointF> result = new List <PointF>();

            for (float t = 0; t < 1; t += step)
            {
                float ytmp = 0;
                float xtmp = 0;
                for (int i = 0; i < list.Count; i++)
                {
                    float b = polinom(i, list.Count - 1, t);
                    xtmp += list[i].X * b;
                    ytmp += list[i].Y * b;
                }
                result.Add(new PointF(xtmp, ytmp));
                if (j > 0)
                {
                    LowLogic.DrawLine(bmp, TC.II(result[j - 1].X), TC.JJ(result[j - 1].Y), TC.II(result[j].X), TC.JJ(result[j].Y), color);
                }
                j++;
            }
        }
Ejemplo n.º 2
0
 public static void Point(Bitmap bmp, TransCoord TC, Color color, List <Points> p)
 {
     for (int i = 0; i < p.Count; i++)
     {
         LowLogic.DrawPoint(bmp, p[i].Clr, TC.II(p[i].X), TC.JJ(p[i].Y));
     }
 }
Ejemplo n.º 3
0
        private static void drawSpline(Bitmap bmp, TransCoord TC, float x1, float y1, float x2,
                                       float y2, float x3, float y3, float x4, float y4, Color color)
        {
            float a0 = countSplineCoefficient(0, x1, x2, x3, x4);
            float a1 = countSplineCoefficient(1, x1, x2, x3, x4);
            float a2 = countSplineCoefficient(2, x1, x2, x3, x4);
            float a3 = countSplineCoefficient(3, x1, x2, x3, x4);

            float b0 = countSplineCoefficient(0, y1, y2, y3, y4);
            float b1 = countSplineCoefficient(1, y1, y2, y3, y4);
            float b2 = countSplineCoefficient(2, y1, y2, y3, y4);
            float b3 = countSplineCoefficient(3, y1, y2, y3, y4);

            float xPrev = a0, yPrev = b0;

            for (int i = 1; i <= 20; i++)
            {
                float t = i / 20.0f;
                float x = ((a3 * t + a2) * t + a1) * t + a0;
                float y = ((b3 * t + b2) * t + b1) * t + b0;

                LowLogic.DrawLine(bmp, TC.II(xPrev), TC.JJ(yPrev), TC.II(x), TC.JJ(y), color);
                xPrev = x;
                yPrev = y;
            }
        }
Ejemplo n.º 4
0
 public LR6()
 {
     InitializeComponent();
     splines      = new List <ISplines>();
     Line         = new Line();
     CB_Betta.Tag = new Betta_spline();
     CB_Bezie.Tag = new Bezie();
     TC           = new TransCoord(0, Width, Height, 0, -50, -50, 50, 50);
 }
Ejemplo n.º 5
0
        public static void OY(Bitmap bmp, TransCoord TC)
        {
            LowLogic.DrawLine(bmp, TC.II(0), TC.JJ(TC.Y1), TC.II(0), TC.JJ(TC.Y2), Color.Black);
            double h1     = HH(TC.Y1, TC.Y2);
            int    k1     = (int)Math.Round(TC.Y1 / h1) - 1;
            int    k2     = (int)Math.Round(TC.Y2 / h1);
            int    Digits = GetDigits(Math.Abs(TC.Y2 - TC.Y1));

            for (int i = k1; i <= k2; i++)
            {
                LowLogic.DrawLine(bmp, TC.II(0) - 7, TC.JJ(i * h1), TC.II(0) + 7, TC.JJ(i * h1), Color.Black);
                for (int j = 1; j <= 9; j++)
                {
                    LowLogic.DrawLine(bmp, TC.II(0) - 3, TC.JJ(i * h1 + j * h1 / 10), TC.II(0) + 3, TC.JJ(i * h1 + j * h1 / 10), Color.Black);
                }
            }
        }
Ejemplo n.º 6
0
 public static void Draw(Bitmap bmp, TransCoord TC, List <ISplines> splines, Line p)
 {
     try
     {
         Random rnd = new Random();
         DrawOXOY.Draw(bmp, TC);
         Point(bmp, TC, Color.Black, p.Points);
         if (splines != null)
         {
             for (int i = 0; i < splines.Count; i++)
             {
                 splines[i].SetColor();
                 splines[i].DrawSplines(bmp, TC, p.Points);
             }
         }
     }
     finally
     { }
 }
Ejemplo n.º 7
0
        public void DrawSplines(Bitmap bmp, TransCoord TC, List <Points> points)
        {
            if (points.Count % 2 == 1 || points.Count < 8)
            {
                return;
            }

            drawSpline(bmp, TC, points[0].X, points[1].Y, points[0].X, points[1].Y, points[2].X, points[3].Y, points[4].X,
                       points[5].Y, color);

            for (int i = 8; i <= points.Count; i += 2)
            {
                drawSpline(bmp, TC, points[i - 8].X, points[i - 7].Y, points[i - 6].X, points[i - 5].Y, points[i - 4].X,
                           points[i - 3].Y, points[i - 2].X, points[i - 1].Y, color);
            }

            int j = points.Count - 6;

            drawSpline(bmp, TC, points[j].X, points[j + 1].Y, points[j + 2].X, points[j + 3].Y, points[j + 4].X,
                       points[j + 5].Y, points[j + 4].X, points[j + 5].Y, color);
        }
Ejemplo n.º 8
0
 public static Bitmap Draw(Bitmap bmp, TransCoord TC)
 {
     OX(bmp, TC); OY(bmp, TC);
     return(bmp);
 }