@@ -9,25 +9,29 @@ class Program
9
9
{
10
10
static void Main ( string [ ] args )
11
11
{
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-файла
18
13
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 ) ;
20
18
21
19
// Вычисляем кратчайший путь
22
20
double shortestPathLength = 0.0 ;
23
21
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 ) ;
26
24
27
25
List < Point2D > shortestPath = graph . FindShortestPathAndLength ( startPoint , goalPoint , out shortestPathLength ) ;
28
26
29
27
// Записываем найденный путь в файл
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 ) ) ;
31
35
32
36
Console . ReadLine ( ) ;
33
37
}
0 commit comments