void draw() { //Рисование double[] matrX = { A.GetX(), B.GetX(), C.GetX() }; double[] matrY = { A.GetY(), B.GetY(), C.GetY() }; XMax = matrX.Max(); XMin = matrX.Min(); YMax = matrY.Max(); YMin = matrY.Min(); try { Pen p = new Pen(Color.Blue, 5);// цвет линии и ширина gr.DrawLine(p, ToScreenX(0), ToScreenY(0), ToScreenX(4), ToScreenY(0)); p.Color = Color.Black; gr.DrawLine(p, ToScreenX(A.GetX()), ToScreenY(A.GetY()), ToScreenX(B.GetX()), ToScreenY(B.GetY())); gr.DrawLine(p, ToScreenX(A.GetX()), ToScreenY(A.GetY()), ToScreenX(C.GetX()), ToScreenY(C.GetY())); gr.DrawLine(p, ToScreenX(C.GetX()), ToScreenY(C.GetY()), ToScreenX(B.GetX()), ToScreenY(B.GetY())); gr.Dispose();// освобождаем все ресурсы, связанные с отрисовкой } catch { label2.Text = "Не удолось визуализировать"; } finally { } }
double dist(Polar f, Polar s) { var y0 = GetY(); var x0 = GetX(); var y1 = f.GetY(); var x1 = f.GetX(); var x2 = s.GetX(); var y2 = s.GetY(); return(Math.Abs((y2 - y1) * x0 - (x2 - x1) * y0 + x2 * y1 - y2 * x1) / Math.Sqrt((y2 - y1) * (y2 - y1) + (x2 - x1) * (x2 - x1))); }