question: public static double distance ( CoordinateDD p1 , CoordinateDD p2 , UNITS units ) { final double latP1 = p1 . northSouth ; final double latP2 = p2 . northSouth ; final double lonP1 = p1 . eastWest ; final double lonP2 = p2 . eastWest ; if ( latP1 == latP2 && lonP1 == lonP2 ) return 0 ; double distRad = Math . acos ( Math . sin ( toRadians ( latP1 ) ) * Math . sin ( toRadians ( latP2 ) ) + Math . cos ( toRadians ( latP1 ) ) * Math . cos ( toRadians ( latP2 ) ) * Math . cos ( toRadians ( lonP1 - lonP2 ) ) ) ; final double distAsDegree = toDegrees ( distRad ) ; return metersToUnits ( distAsDegree * 60 * 1.1515 * 1609.344 , units ) ; }
target:  Computes the distance between two coordinates.