approxAngularDistance function

double approxAngularDistance(
  1. double lat1,
  2. double lon1,
  3. double lat2,
  4. double lon2,
)

Cosine of angular distance between two geographic points.

Implementation

double approxAngularDistance(double lat1, double lon1, double lat2, double lon2) {
  return math.sin(lat1) * math.sin(lat2) +
      math.cos(lat1) * math.cos(lat2) * math.cos(lon1 - lon2);
}