Fix divide by 0?

This commit is contained in:
zwarenelle
2024-06-24 20:57:59 +02:00
parent 07bbdc0083
commit f18f84b668
2 changed files with 2 additions and 2 deletions

View File

@@ -32,7 +32,7 @@ public class CoveragePathPlanner
public void AddObstacleCell(int x, int y)
{
_obstacles.Add(new Obstacle { X = x, Y = y, Width = 0, Height = 0, IsRectangle = false });
_obstacles.Add(new Obstacle { X = x, Y = y, Width = 1, Height = 1, IsRectangle = false });
}
public List<Point> PlanPath()

View File

@@ -27,7 +27,7 @@ public class RoutePlan: IRoute {
CoveragePathPlanner planner = new CoveragePathPlanner(500, 500);
// Add obstacles cell by cell
foreach (var obj in parsedBody?.objects)
foreach (var obj in $"[{parsedBody?.objects}]".FromJson<int[][]>())
{
planner.AddObstacleCell(obj[0], obj[1]); // Get x and y for every coordinate in the parsedbody array
}