public MeteorologicalConditions GetConditionsForDay(int day) { var meteorologicalConditions = new MeteorologicalConditions { Planets = Planets }; var planetPositions = Planets.ToDictionary(p => p.Name, p => GetPlanetPosition(p, day)); meteorologicalConditions.PlanetPositions = planetPositions; Triangle triangle = new Triangle( planetPositions[Planets[0].Name], planetPositions[Planets[1].Name], planetPositions[Planets[2].Name] ); var triangleArea = triangle.GetArea(); // Is a Line if (triangleArea <= Constants.MaxDecimalTolerance) { WeatherType weather = LineTouchOrigin(triangle.PointA, triangle.PointB) ? WeatherType.Drought : WeatherType.Nice; meteorologicalConditions.Weather = weather.GetDescription(); } // Is a triangle else { WeatherType weather = triangle.ContainsPoint(new Point { X = 0, Y = 0 }) ? WeatherType.Rainy : WeatherType.Normal; meteorologicalConditions.TrianglePerimeter = triangle.GetPerimeter(); meteorologicalConditions.Weather = weather.GetDescription(); } return(meteorologicalConditions); }
public WeatherTypeWrapped(WeatherType type) { Type = type; DisplayName = type.GetDescription(); }