github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/geo/geographiclib/geographiclib.cc (about) 1 // Copyright 2020 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 #include "geodesic.h" 12 #include "geographiclib.h" 13 14 void CR_GEOGRAPHICLIB_InverseBatch( 15 struct geod_geodesic* spheroid, 16 double lats[], 17 double lngs[], 18 int len, 19 double *result 20 ) { 21 *result = 0; 22 for (int i = 0; i < len - 1; i++) { 23 double s12, az1, az2; 24 geod_inverse(spheroid, lats[i], lngs[i], lats[i+1], lngs[i+1], &s12, &az1, &az2); 25 *result += s12; 26 } 27 }