public Location rhumbLocation(double azimuthDegrees,double distanceRadians,Location result){
  if (result == null) {
    throw new IllegalArgumentException(Logger.logMessage(Logger.ERROR,"Location","rhumbLocation","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 endLatRadians=latRadians + distanceRadians * Math.cos(azimuthRadians);
  double endLonRadians;
  double dLat=endLatRadians - latRadians;
  double q;
  if (Math.abs(dLat) < NEAR_ZERO_THRESHOLD) {
    q=Math.cos(latRadians);
  }
 else {
    double dPhi=Math.log(Math.tan(endLatRadians / 2 + Math.PI / 4) / Math.tan(latRadians / 2 + Math.PI / 4));
    q=dLat / dPhi;
  }
  double dLon=distanceRadians * Math.sin(azimuthRadians) / q;
  if (Math.abs(endLatRadians) > Math.PI / 2) {
    endLatRadians=endLatRadians > 0 ? Math.PI - endLatRadians : -Math.PI - endLatRadians;
  }
  endLonRadians=(lonRadians + dLon + Math.PI) % (2 * Math.PI) - Math.PI;
  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 rhumbLocation ( double azimuthDegrees , double distanceRadians , Location result ) { if ( result == null ) { throw new IllegalArgumentException ( Logger . logMessage ( Logger . ERROR , "Location" , "rhumbLocation" , "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 endLatRadians = latRadians + distanceRadians * Math . cos ( azimuthRadians ) ; double endLonRadians ; double dLat = endLatRadians - latRadians ; double q ; if ( Math . abs ( dLat ) < NEAR_ZERO_THRESHOLD ) { q = Math . cos ( latRadians ) ; } else { double dPhi = Math . log ( Math . tan ( endLatRadians / 2 + Math . PI / 4 ) / Math . tan ( latRadians / 2 + Math . PI / 4 ) ) ; q = dLat / dPhi ; } double dLon = distanceRadians * Math . sin ( azimuthRadians ) / q ; if ( Math . abs ( endLatRadians ) > Math . PI / 2 ) { endLatRadians = endLatRadians > 0 ? Math . PI - endLatRadians : - Math . PI - endLatRadians ; } endLonRadians = ( lonRadians + dLon + Math . PI ) % ( 2 * Math . PI ) - Math . PI ; 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 a rhumb path ( line of constant azimuth ) starting at this location and traversing with the specified azimuth and angular distance . this function uses a spherical model , not elliptical .
