From 97a8c2ea6f83bd8c1f6831e9e212372548a0c879 Mon Sep 17 00:00:00 2001 From: glax Date: Sun, 23 Apr 2023 14:48:00 +0200 Subject: [PATCH] Maximum turn angle variable --- API/Program.cs | 4 ++-- Server/Server.cs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/API/Program.cs b/API/Program.cs index 6471c70..db8ba8f 100644 --- a/API/Program.cs +++ b/API/Program.cs @@ -16,7 +16,7 @@ var app = builder.Build(); app.MapGet("/getRoute", (float latStart, float lonStart, float latEnd, float lonEnd, Tag.SpeedType vehicle, double stayOnSameRoadPriority, double useHigherLevelRoadsPriority, double useRoadsWithLessJunctionsPriority, double angleFactor) => { Pathfinder result = new Pathfinder("D:/stuttgart-regbez-latest", useHigherLevelRoadsPriority, stayOnSameRoadPriority, - useRoadsWithLessJunctionsPriority, angleFactor).AStar(new Coordinates(latStart, lonStart), + useRoadsWithLessJunctionsPriority, angleFactor, 30).AStar(new Coordinates(latStart, lonStart), new Coordinates(latEnd, lonEnd), vehicle); return result.pathResult; } @@ -25,7 +25,7 @@ app.MapGet("/getRoute", (float latStart, float lonStart, float latEnd, float lon app.MapGet("/getShortestRoute", (float latStart, float lonStart, float latEnd, float lonEnd) => { Pathfinder result = new Pathfinder("D:/stuttgart-regbez-latest", 0, 0, - 0, 0).AStar(new Coordinates(latStart, lonStart), + 0, 0, 30).AStar(new Coordinates(latStart, lonStart), new Coordinates(latEnd, lonEnd), Tag.SpeedType.any); return result.pathResult; } diff --git a/Server/Server.cs b/Server/Server.cs index 121477c..e3383ef 100644 --- a/Server/Server.cs +++ b/Server/Server.cs @@ -18,7 +18,7 @@ public class Server Console.SetError(newConsole); string workingDir = "D:/stuttgart-regbez-latest"; - + //RegionConverter.ConvertXMLToRegions("D:/stuttgart-regbez-latest.osm", "D:/stuttgart-regbez-latest"); //RegionConverter.ConvertXMLToRegions("D:/map.osm", "D:/map"); //RegionConverter.ConvertXMLToRegions("D:/germany-latest.osm", "D:/germany-latest"); @@ -31,10 +31,10 @@ public class Server /* string parentFolder = new DirectoryInfo(workingDir).Parent!.FullName; - Pathfinder result = new Pathfinder(workingDir).AStar(start, - finish, Tag.SpeedType.car, 0.034, 0.012, - 0, 0.18); - + Pathfinder result = new Pathfinder(workingDir, 0.002, 0, + 0, 1, 30).AStar(start, + finish, Tag.SpeedType.car); + Console.WriteLine($"Calc-time {result.pathResult!.calcTime} Path-length: {result.pathResult.pathNodes.Count} Visited-nodes: {result.gScore!.Count}"); string fileName = DateTime.Now.ToFileTime().ToString(); @@ -88,9 +88,9 @@ public class Server double factor = angleWeightFactor; calcThreads.Enqueue(new Thread(() => { - Pathfinder testresult = new Pathfinder(rm).AStar(start, - finish, Tag.SpeedType.car, priority, roadPriority, - 0, factor); + Pathfinder testresult = new Pathfinder(rm, priority, roadPriority, + 0, factor, 30).AStar(start, + finish, Tag.SpeedType.car); string fileName = $"angle{factor:0.000}_level{priority:0.000}_same{roadPriority:0.000}.result"; testresult.SaveResult(Path.Join(parentFolder, fileName));