Skip to content

Commit c3f2d45

Browse files
author
Зелёный Андрей Сергеевич
committed
Изменен Main()
1 parent 493ad98 commit c3f2d45

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

Program.cs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,29 @@ class Program
99
{
1010
static void Main(string[] args)
1111
{
12-
GaussianParameter gaussianParameter1 = new GaussianParameter(1.5, 0.5, 0.5, 5.0, 2.5);
13-
14-
// Инициализируем граф
15-
Graph graph = new Graph(0.1, 0.1, 101, 51, 0.1, gaussianParameter1);
16-
17-
// Записываем получившуюся поверхность в файл
12+
// Создаем матрицу-препятствий из csv-файла
1813
string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
19-
graph.WriteSurfaceToFile(Path.Combine(docPath, "surface.txt"));
14+
int[,] obstacleMatrix = Obstacle.CreateObstacleMatrixFromCSVFile(Path.Combine(docPath, "obstacle1.csv"));
15+
16+
// Инициализируем граф с помощью этой матрицы
17+
Graph graph = new Graph(obstacleMatrix);
2018

2119
// Вычисляем кратчайший путь
2220
double shortestPathLength = 0.0;
2321

24-
Point2D startPoint = new Point2D(85, 25);
25-
Point2D goalPoint = new Point2D(15, 25);
22+
Point2D startPoint = new Point2D(3, 4);
23+
Point2D goalPoint = new Point2D(12, 4);
2624

2725
List<Point2D> shortestPath = graph.FindShortestPathAndLength(startPoint, goalPoint, out shortestPathLength);
2826

2927
// Записываем найденный путь в файл
30-
WriteShortestPathToFile(shortestPath, graph, Path.Combine(docPath, "shortestPath_max_slope_0_1_degrees.txt"));
28+
//WriteShortestPathToFile(shortestPath, Path.Combine(docPath, "shortestPath.txt"));
29+
30+
Console.WriteLine("Coordinates of shortest path: ");
31+
foreach (Point2D p in shortestPath)
32+
Console.WriteLine(string.Format("({0}, {1})", p.i, p.j));
33+
34+
Console.WriteLine(string.Format("Length of shortest path: {0}", shortestPathLength));
3135

3236
Console.ReadLine();
3337
}

0 commit comments

Comments
 (0)