Beispiel #1
0
 /// <summary>
 /// Creates a mesh from the current grid and finds the path.
 /// </summary>
 private void FindPath()
 {
     Mesh mesh = new Mesh(pictureBox1.Width, pictureBox1.Height, gridSpacing, rects);
     // Generate the mesh and weigh the nodes
     nodes = mesh.WeighGraph(StartPoint, EndPoint);
     // If the mesh creation was succesful, find the path and add
     // it's point to the point list.
     if (nodes != null)
     {
         points.AddRange(mesh.FindPath());
     }
     // Redraw
     pictureBox1.Invalidate();
 }