public Location greatCircleLocation(double azimuthDegrees,double distanceRadians,Location result){
  if (result == null) {
    throw new IllegalArgumentException(Logger.logMessage(Logger.ERROR,"Location","greatCircleLocation","missingResult"));
  }
  if (distanceRadians == 0) {
    result.latitude=this.latitude;
    result.longitude=this.longitude;
    return result;
  }
  double latRadians=Math.toRadians(this.latitude);
  double lonRadians=Math.toRadians(this.longitude);
  double azimuthRadians=Math.toRadians(azimuthDegrees);
  double cosLat=Math.cos(latRadians);
  double sinLat=Math.sin(latRadians);
  double cosAzimuth=Math.cos(azimuthRadians);
  double sinAzimuth=Math.sin(azimuthRadians);
  double sinDistance=Math.sin(distanceRadians);
  double cosDistance=Math.cos(distanceRadians);
  double endLatRadians=Math.asin(sinLat * cosDistance + cosLat * sinDistance * cosAzimuth);
  double endLonRadians=lonRadians + Math.atan2(sinDistance * sinAzimuth,cosLat * cosDistance - sinLat * sinDistance * cosAzimuth);
  if (Double.isNaN(endLatRadians) || Double.isNaN(endLonRadians)) {
    result.latitude=this.latitude;
    result.longitude=this.longitude;
  }
 else {
    result.latitude=normalizeLatitude(Math.toDegrees(endLatRadians));
    result.longitude=normalizeLongitude(Math.toDegrees(endLonRadians));
  }
  return result;
}

public Location greatCircleLocation ( double azimuthDegrees , double distanceRadians , Location result ) { if ( result == null ) { throw new IllegalArgumentException ( Logger . logMessage ( Logger . ERROR , "Location" , "greatCircleLocation" , "missingResult" ) ) ; } if ( distanceRadians == 0 ) { result . latitude = this . latitude ; result . longitude = this . longitude ; return result ; } double latRadians = Math . toRadians ( this . latitude ) ; double lonRadians = Math . toRadians ( this . longitude ) ; double azimuthRadians = Math . toRadians ( azimuthDegrees ) ; double cosLat = Math . cos ( latRadians ) ; double sinLat = Math . sin ( latRadians ) ; double cosAzimuth = Math . cos ( azimuthRadians ) ; double sinAzimuth = Math . sin ( azimuthRadians ) ; double sinDistance = Math . sin ( distanceRadians ) ; double cosDistance = Math . cos ( distanceRadians ) ; double endLatRadians = Math . asin ( sinLat * cosDistance + cosLat * sinDistance * cosAzimuth ) ; double endLonRadians = lonRadians + Math . atan2 ( sinDistance * sinAzimuth , cosLat * cosDistance - sinLat * sinDistance * cosAzimuth ) ; if ( Double . isNaN ( endLatRadians ) || Double . isNaN ( endLonRadians ) ) { result . latitude = this . latitude ; result . longitude = this . longitude ; } else { result . latitude = normalizeLatitude ( Math . toDegrees ( endLatRadians ) ) ; result . longitude = normalizeLongitude ( Math . toDegrees ( endLonRadians ) ) ; } return result ; }
computes the location on the great circle path starting at this location and traversing with the specified azimuth and angular distance . this function uses a spherical model , not elliptical .
