本函数旨在实现图像中求两点之间的距离
function [dist,phaseangle] = distance(lat,lon,units)
% SW_DIST Distance between two lat,lon coordinates
%===================================================================
% SW_DIST $Revision: 1.4 $ $Date: 1994/10/10 04:55:23 $
% Copyright (C) CSIRO, Phil Morgan & Steve Rintoul 1992.
%
% USAGE: [dist,phaseangle] = distance(lat,lon {,units} )
%
% DESCRIPTION:
% Calculate distance between two positions on glode using the "Plane
% Sailing" method. Also uses simple geometry to calculate the bearing of
% the path between position pairs.
%
% INPUT:
% lat = decimal degrees (+ve N, -ve S) [- 90.. +90]
% lon = decimal degrees (+ve E, -ve W) [-180..+180]
% units = optional string specifing units of distance
% 'nm' = nautical miles (default)
% 'km' = kilometres
%
% OUTPUT:
% dist = distance between positions in units
% phaseangle = angle of line between stations with x axis (East).
% Range of values are -180..+180. (E=0, N=90, S=-90)
%
% AUTHOR: Phil Morgan and Steve Rintoul 92-02-10
%
% DISCLAIMER:
% This software is provided "as is" without warranty of any kind.
% See the file sw_copy.m for conditions of use and licence.
%
% REFERENCE:
% The PLANE SAILING method as descriibed in "CELESTIAL NAVIGATION" 1989 by
% Dr. P. Gormley. The Australian Antartic Division.
1