Exemplo n.º 1
0
        private static Vector GetClosestRoadPoint(Vector location)
        {
            var road = GPSSystem.GetRoad(location);

            if (road == null)
            {
                throw new ArgumentException("Location is not on a road!");
            }

            return(GPSSystem.CalculateDistance(location, road.Start) <
                   GPSSystem.CalculateDistance(location, road.End)
                ? road.Start
                : road.End);
        }