public bool UpdateCenter(Point Center) { this.center = Center; if (this.Last_NotS_Triangle != null) { if (A.X != 0 && A.Y != 0) { this.a = Graphs.RotatePoint(Center, Last_NotS_Triangle.A, 180); } if (B.X != 0 && B.Y != 0) { this.b = Graphs.RotatePoint(Center, Last_NotS_Triangle.B, 180); } if (C.X != 0 && C.Y != 0) { this.c = Graphs.RotatePoint(Center, Last_NotS_Triangle.C, 180); } return(true); } else if (this.Last_S_Triangle != null && this.Last_S_Triangle.Last_NotS_Triangle != null) { if (A.X != 0 && A.Y != 0) { this.a = Graphs.RotatePoint(Last_S_Triangle.Last_NotS_Triangle.A, Last_S_Triangle.A, 180); } if (B.X != 0 && B.Y != 0) { this.b = Graphs.RotatePoint(Last_S_Triangle.Last_NotS_Triangle.B, Last_S_Triangle.B, 180); } if (C.X != 0 && C.Y != 0) { this.c = Graphs.RotatePoint(Last_S_Triangle.Last_NotS_Triangle.C, Last_S_Triangle.C, 180); } return(true); } else if (this.Last_S_Triangle != null && this.Last_S_Triangle.Last_S_Triangle != null) { if (A.X != 0 && A.Y != 0) { this.a = Graphs.RotatePoint(Last_S_Triangle.Last_S_Triangle.A, Last_S_Triangle.A, 180); } if (B.X != 0 && B.Y != 0) { this.b = Graphs.RotatePoint(Last_S_Triangle.Last_S_Triangle.B, Last_S_Triangle.B, 180); } if (C.X != 0 && C.Y != 0) { this.c = Graphs.RotatePoint(Last_S_Triangle.Last_S_Triangle.C, Last_S_Triangle.C, 180); } return(true); } else { return(false); } }
public bool UpdateCenter(Point Center, int RndX, int RndY) { this.center = Center; this.a = new Point(Center.X - RndX, Center.Y - RndY); this.b = Graphs.RotatePoint(A, Center, 120); this.c = Graphs.RotatePoint(A, Center, -120); if (this.Center == Center) { return(true); } else { return(false); } }
private void pictureBox_Paint(object sender, PaintEventArgs e) { if (checkBox1.Checked || checkBox2.Checked || checkBox3.Checked) { Point A = new Point(Center.X - rnd.Next(pictureBox1.Size.Width / 20, pictureBox1.Size.Width / 9), Center.Y + rnd.Next(pictureBox1.Size.Height / 20, pictureBox1.Size.Height / 10)); Point B = Graphs.RotatePoint(A, Center, 120); Point C = Graphs.RotatePoint(B, Center, 120); e.Graphics.DrawLine(Pens.Black, A, B); e.Graphics.DrawLine(Pens.Black, B, C); e.Graphics.DrawLine(Pens.Black, C, A); e.Graphics.DrawLine(Pens.White, Center, A); e.Graphics.DrawLine(Pens.White, Center, B); e.Graphics.DrawLine(Pens.White, Center, C); BonusLines(A, B, C, e); } }
private void BonusLines(Point A, Point B, Point C, PaintEventArgs e) { int w = rnd.Next(1, 4); if (checkBox1.Checked) { int procent = rnd.Next(1, 21); if (w == 1) { Point T = Graphs.RotatePoint(Center, A, 180); e.Graphics.DrawLine(Pens.Black, A, T); e.Graphics.DrawLine(Pens.Black, B, T); e.Graphics.DrawLine(Pens.Black, C, T); } else if (w == 2) { Point T = Graphs.RotatePoint(Center, B, 180); e.Graphics.DrawLine(Pens.Black, A, T); e.Graphics.DrawLine(Pens.Black, B, T); e.Graphics.DrawLine(Pens.Black, C, T); } else if (w == 3) { Point T = Graphs.RotatePoint(Center, C, 180); e.Graphics.DrawLine(Pens.Black, A, T); e.Graphics.DrawLine(Pens.Black, B, T); e.Graphics.DrawLine(Pens.Black, C, T); } } else if (checkBox2.Checked) { if (w == 1) { Point T = Graphs.RotatePoint(Center, A, 180); e.Graphics.DrawLine(Pens.Black, A, T); e.Graphics.DrawLine(Pens.Black, B, T); e.Graphics.DrawLine(Pens.Black, C, T); Point R = Graphs.RotatePoint(Center, B, 180); e.Graphics.DrawLine(Pens.Black, A, R); e.Graphics.DrawLine(Pens.Black, B, R); e.Graphics.DrawLine(Pens.Black, C, R); e.Graphics.DrawLine(Pens.Black, T, R); } else if (w == 2) { Point T = Graphs.RotatePoint(Center, B, 180); e.Graphics.DrawLine(Pens.Black, A, T); e.Graphics.DrawLine(Pens.Black, B, T); e.Graphics.DrawLine(Pens.Black, C, T); Point R = Graphs.RotatePoint(Center, C, 180); e.Graphics.DrawLine(Pens.Black, A, R); e.Graphics.DrawLine(Pens.Black, B, R); e.Graphics.DrawLine(Pens.Black, C, R); e.Graphics.DrawLine(Pens.Black, T, R); } else if (w == 3) { Point T = Graphs.RotatePoint(Center, C, 180); e.Graphics.DrawLine(Pens.Black, A, T); e.Graphics.DrawLine(Pens.Black, B, T); e.Graphics.DrawLine(Pens.Black, C, T); Point R = Graphs.RotatePoint(Center, A, 180); e.Graphics.DrawLine(Pens.Black, A, R); e.Graphics.DrawLine(Pens.Black, B, R); e.Graphics.DrawLine(Pens.Black, C, R); e.Graphics.DrawLine(Pens.Black, T, R); } } else if (checkBox3.Checked) { Point T = Graphs.RotatePoint(Center, A, 180); e.Graphics.DrawLine(Pens.Black, A, T); e.Graphics.DrawLine(Pens.Black, B, T); e.Graphics.DrawLine(Pens.Black, C, T); Point R = Graphs.RotatePoint(Center, B, 180); e.Graphics.DrawLine(Pens.Black, A, R); e.Graphics.DrawLine(Pens.Black, B, R); e.Graphics.DrawLine(Pens.Black, C, R); Point U = Graphs.RotatePoint(Center, C, 180); e.Graphics.DrawLine(Pens.Black, A, U); e.Graphics.DrawLine(Pens.Black, B, U); e.Graphics.DrawLine(Pens.Black, C, U); e.Graphics.DrawLine(Pens.Black, T, R); e.Graphics.DrawLine(Pens.Black, U, R); e.Graphics.DrawLine(Pens.Black, T, U); } }