AbstractedSheep.ShuttleTrackerWorld.Coordinate.BearingTowards C# (CSharp) Method

BearingTowards() public method

Calculates the bearing towards another Coordinate.
public BearingTowards ( Coordinate c ) : double
c Coordinate The Coordinate to get the bearing towards.
return double
        public double BearingTowards(Coordinate c)
        {
            double dlong = this.longitude - c.longitude;
            double y = Math.Sin(dlong) * Math.Cos(c.latitude);
            double x = Math.Cos(this.latitude) * Math.Sin(c.latitude) -
                Math.Sin(this.latitude) * Math.Cos(c.latitude) * Math.Cos(dlong);
            return RadToDeg(Math.Atan2(x, y));
        }