private bool UpdateTriangles(Triangle tRight, Triangle tLeft, Section commonSection, List <Triangle> tmpResult, Graphics g = null, Pen linePen = null, Pen pointPen = null, Pen newLinePen = null, int formHeigth = 0, int delay = 0) { Point leftExcessPoint = Triangulation.getExcessPoint(tLeft, commonSection); Point rightExcessPoint = Triangulation.getExcessPoint(tRight, commonSection); if (commonSection.countAnglesSum(leftExcessPoint) + commonSection.countAnglesSum(rightExcessPoint) < 180) { Point up = commonSection.A; Point down = commonSection.B; if (new Vector(down, rightExcessPoint).getVectorMultiplication(new Vector(down, leftExcessPoint)) < 0) { up = commonSection.B; down = commonSection.A; } tmpResult.Remove(tLeft); tmpResult.Remove(tRight); Triangle toAddFirst = new Triangle(leftExcessPoint, down, rightExcessPoint); Triangle toAddSecond = new Triangle(rightExcessPoint, up, leftExcessPoint); tmpResult.Add(toAddFirst); tmpResult.Add(toAddSecond); if (g != null) { g.DrawLine(new Pen(Color.White, 2), (int)commonSection.A.X, formHeigth - (int)commonSection.A.Y, (int)commonSection.B.X, formHeigth - (int)commonSection.B.Y); g.DrawLine(newLinePen, (int)leftExcessPoint.X, formHeigth - (int)leftExcessPoint.Y, (int)rightExcessPoint.X, formHeigth - (int)rightExcessPoint.Y); Thread.Sleep(delay); g.DrawLine(new Pen(Color.White, 2), (int)leftExcessPoint.X, formHeigth - (int)leftExcessPoint.Y, (int)rightExcessPoint.X, formHeigth - (int)rightExcessPoint.Y); g.DrawLine(linePen, (int)leftExcessPoint.X, formHeigth - (int)leftExcessPoint.Y, (int)rightExcessPoint.X, formHeigth - (int)rightExcessPoint.Y); toAddFirst.Paint(g, linePen, pointPen, formHeigth); toAddSecond.Paint(g, linePen, pointPen, formHeigth); } return(true); } return(false); }