public Edge FindFirstEdge() { double max = 0; int j = 0; graph.vertex.Sort(); for (int i = 1; i < graph.vertex.Count; i++) { if (MathPro.CosBy2Points(graph.vertex[0], graph.vertex[i]) > max) { max = MathPro.CosBy2Points(graph.vertex[0], graph.vertex[i]); j = i; } } return(new Edge(graph.vertex[0], graph.vertex[j])); }
private void button_FirstEdge_Click(object sender, EventArgs e) { double max = 0; int j = 0; graph.vertex.Sort(); for (int i = 1; i < graph.vertex.Count; i++) { if (MathPro.CosBy2Points(graph.vertex[0], graph.vertex[i]) > max) { max = MathPro.CosBy2Points(graph.vertex[0], graph.vertex[i]); j = i; } } graph.edges.Add(new Edge(graph.vertex[0], graph.vertex[j])); G.drawEdge(graph.edges[0]); sheet.Image = G.GetBitmap(); }