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; } }
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++; } }
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)); } }
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); } } }