cdm/src/main/java/ucar/unidata/geoloc/projection/proj4/MapMath.java
public static double greatCircleDistance(double lon1, double lat1, double lon2, double lat2 ) {
		double dlat = Math.sin((lat2-lat1)/2);
		double dlon = Math.sin((lon2-lon1)/2);
		double r = Math.sqrt(dlat*dlat + Math.cos(lat1)*Math.cos(lat2)*dlon*dlon);
		return 2.0 * Math.asin(r);
	}
public static double greatCircleDistance(double lon1, double lat1, double lon2, double lat2 ) {
		double dlat = Math.sin((lat2-lat1)/2);
		double dlon = Math.sin((lon2-lon1)/2);
		double r = Math.sqrt(dlat*dlat + Math.cos(lat1)*Math.cos(lat2)*dlon*dlon);
		return 2.0 * Math.asin(r);
	}
public static double greatCircleDistance ( double lon1 , double lat1 , double lon2 , double lat2 ) { double dlat = Math . sin ( ( lat2 - lat1 ) / 2 ) ; double dlon = Math . sin ( ( lon2 - lon1 ) / 2 ) ; double r = Math . sqrt ( dlat * dlat + Math . cos ( lat1 ) * Math . cos ( lat2 ) * dlon * dlon ) ; return 2.0 * Math . asin ( r ) ; }
/*
public static void latLongToXYZ(ProjectionPoint ll, Point3D xyz) {
double c = Math.cos(ll.y);
xyz.x = c * Math.cos(ll.x);
xyz.y = c * Math.sin(ll.x);
xyz.z = Math.sin(ll.y);
}

public static void xyzToLatLong(Point3D xyz, ProjectionPoint ll) {
ll.y = MapMath.asin(xyz.z);
ll.x = MapMath.atan2(xyz.y, xyz.x);
}
/ * public static void latLongToXYZ ( ProjectionPoint ll Point3D xyz ) { double c = Math . cos ( ll . y ) ; xyz . x = c * Math . cos ( ll . x ) ; xyz . y = c * Math . sin ( ll . x ) ; xyz . z = Math . sin ( ll . y ) ; }