public static void draw_line(d4 point1, d4 point2, PictureBox p, Graphics g) { point1.x = point1.X * E1[0] + point1.Y * E2[0] + point1.Z * E3[0] + point1.T * E4[0]; point1.y = point1.X * E1[1] + point1.Y * E2[1] + point1.Z * E3[1] + point1.T * E4[1]; point2.x = point2.X * E1[0] + point2.Y * E2[0] + point2.Z * E3[0] + point2.T * E4[0]; point2.y = point2.X * E1[1] + point2.Y * E2[1] + point2.Z * E3[1] + point2.T * E4[1]; g.DrawLine(Pens.Black, (float)point1.x + p.Width / 2, (float)point1.y + p.Height / 2, (float)point2.x + p.Width / 2, (float)point2.y + p.Height / 2); }
public static void draw_basis(PictureBox p, Graphics g) { d4 x = new d4(100 * E1[0], 100 * E1[1], 100 * E1[2], 100 * E1[3]); d4 y = new d4(100 * E2[0], 100 * E2[1], 100 * E2[2], 100 * E2[3]); d4 z = new d4(100 * E3[0], 100 * E3[1], 100 * E3[2], 100 * E3[3]); d4 t = new d4(100 * E4[0], 100 * E4[1], 100 * E4[2], 100 * E4[3]); d4 zero = new d4(0, 0, 0, 0); draw_line_color(zero, x, p, g, Color.Red); draw_line_color(zero, y, p, g, Color.Green); draw_line_color(zero, z, p, g, Color.Blue); draw_line_color(zero, t, p, g, Color.Gold); }
static void draw_line_color(d4 point1, d4 point2, PictureBox p, Graphics g, Color col) { Pen pn = new Pen(col); g.DrawLine(pn, (float)point1.X + p.Width / 2, (float)point1.Y + p.Height / 2, (float)point2.X + p.Width / 2, (float)point2.Y + p.Height / 2); }
public static void draw_point(d4 point, PictureBox p, Graphics g) { point.x = point.X * E1[0] + point.Y * E2[0] + point.Z * E3[0] + point.T * E4[0]; point.y = point.X * E1[1] + point.Y * E2[1] + point.Z * E3[1] + point.T * E4[1]; g.FillEllipse(Brushes.Black, (float)point.x + p.Width / 2, (float)point.y + p.Height / 2, 2, 2); }