static async void CalculatePoint(string newSystem, float distance) { SystemPoint system = await GetSystem(newSystem); float newDistance = Vector3.Distance(Constants.Col70.Coordinates, system.Coordinates); GetData(Constants.Col70, system, Vector3.Lerp(Constants.Col70.Coordinates, system.Coordinates, (distance / newDistance))); }
static async void GetData(SystemPoint origin, SystemPoint destination, Vector3 center) { string baseURL = $"https://www.edsm.net/api-v1/sphere-systems?x={center.X}&y={center.Y}&z={center.Z}&radius={storage.SphereRadius}&showCoordinates=1"; using (HttpClient client = new HttpClient()) using (HttpResponseMessage res = await client.GetAsync(baseURL)) using (HttpContent content = res.Content) { string data = await content.ReadAsStringAsync(); if (data != null) { var systems = JsonConvert.DeserializeObject <List <SystemPoint> >(data); Console.WriteLine($"-- Candidate systems at '{storage.DistanceWeight} Merope' through {destination.Name} in a {storage.SphereRadius}ly sphere --"); foreach (SystemPoint system in systems) { float distance = Vector3.Distance(origin.Coordinates, system.Coordinates); Console.WriteLine($"{system.Name} @ {system.Coordinates}: {distance}ly"); } } } }