mirror of
https://github.com/Wessel/Roommapper.git
synced 2026-07-25 01:07:11 +02:00
Fix divide by 0?
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user