1//============================================================================== 2function haversine(lat1, lon1, lat2, lon2){ 3 // generally used geo measurement function 4 5 var R = 6378.137; // Radius of earth in KM 6 7 var dLat = lat2 * Math.PI / 180 - lat1 * Math.PI / 180; 8 var dLon = lon2 * Math.PI / 180 - lon1 * Math.PI / 180; 9 10 var a = Math.sin(dLat/2) * Math.sin(dLat/2) + 11 Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * 12 Math.sin(dLon/2) * Math.sin(dLon/2); 13 14 var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 15 var d = R * c; 16 17 return d * 1000; // meters 18} 19//============================================================================== 20function minmax(aValue, aMin, aMax) { 21 if (aValue > aMax) 22 aValue = aMax ; 23 24 if (aValue < aMin) 25 aValue = aMin ; 26 27 return aValue ; 28} 29//==============================================================================
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.