Getting close

This commit is contained in:
2020-12-16 04:02:37 -07:00
parent cf432a348b
commit f8ce6d0c83
27 changed files with 587 additions and 163 deletions

View File

@@ -1,3 +1,5 @@
using System;
using System.Collections.Generic;
using ConsoleApp.Maps;
namespace ConsoleApp.Sim
@@ -6,12 +8,9 @@ namespace ConsoleApp.Sim
{
public int Length { get; }
public int Width { get; }
public int DetectorOffset { get;}
public int TurnRadius { get; }
public int DetectorRadius { get;}
public HexCore.Coordinate2D CurrentHexCell { get; set; }
public Heading HexHeading { get; set; }
public Heading SquareHeading { get; set; }
public ICell CurrentSquareCell { get; set; }
@@ -20,12 +19,17 @@ namespace ConsoleApp.Sim
public Vehicle(IJsonDeserializor jsonDeserializor)
{
var config = jsonDeserializor.DeserializeObject<VehicleConfiguration>("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Sim/VehicleConfiguration.json");
Length = config.Length;
Width = config.Width;
DetectorRadius = config.DetectorRadius;
DetectorOffset = config.DetectorOffset;
CurrentHexCell = default;
CurrentSquareCell = default;
var length = config.Length;
length *= 100;
Length = (int)Math.Ceiling((decimal)length/ 25);
var width = config.Width;
width *= 100;
Width = (int)Math.Ceiling((decimal)width/ 25);
DetectorRadius = (int)Math.Floor(((decimal)config.DetectorRadius * 100)/25)/2;
TurnRadius = (int)Math.Ceiling(Math.Sqrt(Math.Pow(config.Length, 2) * Math.Pow(config.Width, 2))/2);
// if (DetectorRadius <= TurnRadius)
// throw new ArgumentException("Detection radius must be larger than the vehicle turn radius");
}
}
}