public PathFinder(string fileName) { usingFile = true; validFile = true; closed = new List<coord>(); try { using (StreamReader SR = File.OpenText(fileName)) { length = Convert.ToInt32(SR.ReadLine()); width = Convert.ToInt32(SR.ReadLine()); metersPerCellX = Convert.ToDouble(SR.ReadLine()); metersPerCellY = Convert.ToDouble(SR.ReadLine()); heap = new minHeap(length, width); for (int index = 0; index < length * width; index++) { heap.coords[index / width][index % length] = heap.coords[index / width][index % length].setHeight(Convert.ToDouble(SR.ReadLine())); } setGrads(); setStartEnd(); SR.Close(); } } catch (IOException ex) { validFile = false; Console.WriteLine(ex.Message); } }
public PathFinder(int sX, int sY, int eX, int eY, double orientationAngle,bool[,] obstacles) { usingFile = true; validFile = true; closed = new List<coord>(); length = obstacles.GetLength(0); width = obstacles.GetLength(1); metersPerCellX = 0.20; metersPerCellY = 0.20; heap = new minHeap(length, width); for (int x = 0; x < length; x++) { for (int y = 0; y < width; y++) { if (obstacles[x,y]) heap.coords[x][y] = heap.coords[x][y].setChar('O'); } } setStartEnd(sX, sY, eX, eY, orientationAngle); }
public PathFinder(int x, int y) { usingFile = false; closed = new List<coord>(); length = x; width = y; metersPerCellX = metersPerCellY = 1; heap = new minHeap(length, width); makeGrid(); Console.WriteLine("Made grid"); }