public void CalculateHeat() { if (HeatMap == null || HeatMap.GetLength(0) != SoilMap.GetLength(0) || HeatMap.GetLength(1) != SoilMap.GetLength(1)) { HeatMap = new float[SoilMap.GetLength(0), SoilMap.GetLength(1)]; } switch (Type) { case HeatTypes.SoilDepth: CalculateSoilDepth(); break; case HeatTypes.WaterDepth: CalculateWaterDepth(); break; case HeatTypes.SoilHumidity: CalculateSoilHumidity(); break; case HeatTypes.Inclination: CalculateInclination(); break; } }
private void updatePositionProbability(int x, int y) { if (x < ((HeatMap.GetLength(0) - 1) / 2) && y < ((HeatMap.GetLength(1) - 1) / 2)) { HeatMap[x + ((HeatMap.GetLength(0) - 1) / 2), y + ((HeatMap.GetLength(1) - 1) / 2)]++; IterationCount++; } }
private void NormalizeResult() { if (HeatMap != null) { for (int l = 0; l < HeatMap.GetLength(0); l++) { for (int r = 0; r < HeatMap.GetLength(1); r++) { HeatMap[l, r] = HeatMap[l, r] / IterationCount; } } } }
private void DisplayHeatMap() { if (HeatMap != null) { Console.WriteLine("{0}x{1}", HeatMap.GetLength(0), HeatMap.GetLength(1)); Console.WriteLine(""); for (int l = 0; l < HeatMap.GetLength(0); l++) { for (int r = HeatMap.GetLength(1) - 1; r >= 0; r--) { Console.Write("(" + HeatMap[l, r].ToString() + ") "); } Console.WriteLine(""); } } }
private int ConvertRowIndex(int y) { return(y + ((HeatMap.GetLength(1) - 1) / 2)); }
private int ConvertLineIndex(int x) { return(x + ((HeatMap.GetLength(0) - 1) / 2)); }