Newer
Older
BlazorKafkaSignalR / save-points / 00-get-started / BlazingPizza.Shared / LatLong.cs
@Derek Comartin Derek Comartin on 1 Jun 2021 746 bytes Init
namespace BlazingPizza
{
    public class LatLong
    {
        public LatLong()
        {
        }

        public LatLong(double latitude, double longitude) : this()
        {
            Latitude = latitude;
            Longitude = longitude;
        }

        public double Latitude { get; set; }

        public double Longitude { get; set; }

        public static LatLong Interpolate(LatLong start, LatLong end, double proportion)
        {
            // The Earth is flat, right? So no need for spherical interpolation.
            return new LatLong(
                start.Latitude + (end.Latitude - start.Latitude) * proportion,
                start.Longitude + (end.Longitude - start.Longitude) * proportion);
        }
    }
}