From 14b68b27e127d7f50c95948b1f70eec057165645 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 19:30:50 -0700 Subject: [PATCH 01/74] H3_EXPORT(pointToCell) --- src/apps/benchmarks/benchmarkH3Api.c | 2 +- src/apps/filters/pointToCell.c | 2 +- src/apps/fuzzers/fuzzerPointToCell.c | 2 +- src/apps/testapps/mkRandGeo.c | 2 +- src/apps/testapps/mkRandGeoBoundary.c | 2 +- src/apps/testapps/testCellToCenterChild.c | 4 ++-- src/apps/testapps/testCellToParent.c | 6 +++--- src/apps/testapps/testCellToPoint.c | 2 +- src/apps/testapps/testDirectedEdge.c | 14 +++++++------- src/apps/testapps/testGridDisk.c | 2 +- src/apps/testapps/testGridDisksUnsafe.c | 2 +- src/apps/testapps/testGridRingUnsafe.c | 2 +- src/apps/testapps/testH3Api.c | 10 +++++----- src/apps/testapps/testH3CellArea.c | 2 +- src/apps/testapps/testH3Index.c | 12 ++++++------ src/apps/testapps/testPointToCell.c | 2 +- src/apps/testapps/testPolygonToCells.c | 2 +- src/apps/testapps/testVertexGraph.c | 2 +- src/h3lib/include/h3api.h.in | 2 +- src/h3lib/lib/algos.c | 2 +- src/h3lib/lib/h3Index.c | 2 +- 21 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/apps/benchmarks/benchmarkH3Api.c b/src/apps/benchmarks/benchmarkH3Api.c index 679a603f5..be5ab565d 100644 --- a/src/apps/benchmarks/benchmarkH3Api.c +++ b/src/apps/benchmarks/benchmarkH3Api.c @@ -27,7 +27,7 @@ GeoPoint outCoord; CellBoundary outBoundary; H3Index h; -BENCHMARK(pointToCell, 10000, { H3_EXPORT(pointToCell)(&coord, 9, &h); }); +BENCHMARK(pointToCell, 10000, { H3_EXPORT(latLngToCell)(&coord, 9, &h); }); BENCHMARK(cellToPoint, 10000, { H3_EXPORT(cellToPoint)(hex, &outCoord); }); diff --git a/src/apps/filters/pointToCell.c b/src/apps/filters/pointToCell.c index 28b127a32..d9fb4acfa 100644 --- a/src/apps/filters/pointToCell.c +++ b/src/apps/filters/pointToCell.c @@ -48,7 +48,7 @@ void doCoords(double lat, double lon, int res) { .lon = H3_EXPORT(degsToRads)(lon)}; H3Index h; - H3Error e = H3_EXPORT(pointToCell)(&g, res, &h); + H3Error e = H3_EXPORT(latLngToCell)(&g, res, &h); if (e == E_SUCCESS) { h3Println(h); diff --git a/src/apps/fuzzers/fuzzerPointToCell.c b/src/apps/fuzzers/fuzzerPointToCell.c index b4b2c0bf3..061536d19 100644 --- a/src/apps/fuzzers/fuzzerPointToCell.c +++ b/src/apps/fuzzers/fuzzerPointToCell.c @@ -38,7 +38,7 @@ int main(int argc, char* argv[]) { GeoPoint g = {.lat = args.lat, .lon = args.lon}; H3Index h; - H3Error e = H3_EXPORT(pointToCell)(&g, args.res, &h); + H3Error e = H3_EXPORT(latLngToCell)(&g, args.res, &h); h3Println(e); h3Println(h); diff --git a/src/apps/testapps/mkRandGeo.c b/src/apps/testapps/mkRandGeo.c index c8fe94125..eda37f075 100644 --- a/src/apps/testapps/mkRandGeo.c +++ b/src/apps/testapps/mkRandGeo.c @@ -69,7 +69,7 @@ int main(int argc, char* argv[]) { randomGeo(&g); H3Index h; - if (!H3_EXPORT(pointToCell)(&g, res, &h)) { + if (!H3_EXPORT(latLngToCell)(&g, res, &h)) { h3Print(h); printf(" "); geoPrintlnNoFmt(&g); diff --git a/src/apps/testapps/mkRandGeoBoundary.c b/src/apps/testapps/mkRandGeoBoundary.c index 055e0673a..14633c5c7 100644 --- a/src/apps/testapps/mkRandGeoBoundary.c +++ b/src/apps/testapps/mkRandGeoBoundary.c @@ -68,7 +68,7 @@ int main(int argc, char* argv[]) { randomGeo(&g); H3Index h; - if (!H3_EXPORT(pointToCell)(&g, res, &h)) { + if (!H3_EXPORT(latLngToCell)(&g, res, &h)) { CellBoundary b; H3_EXPORT(cellToBoundary)(h, &b); diff --git a/src/apps/testapps/testCellToCenterChild.c b/src/apps/testapps/testCellToCenterChild.c index e6f92c8bb..1d3ac252c 100644 --- a/src/apps/testapps/testCellToCenterChild.c +++ b/src/apps/testapps/testCellToCenterChild.c @@ -32,12 +32,12 @@ SUITE(cellToCenterChild) { GeoPoint centroid; H3Index h3Index; t_assertSuccess( - H3_EXPORT(pointToCell)(&baseCentroid, res, &h3Index)); + H3_EXPORT(latLngToCell)(&baseCentroid, res, &h3Index)); H3_EXPORT(cellToPoint)(h3Index, ¢roid); H3Index geoChild; t_assertSuccess( - H3_EXPORT(pointToCell)(¢roid, childRes, &geoChild)); + H3_EXPORT(latLngToCell)(¢roid, childRes, &geoChild)); H3Index centerChild = H3_EXPORT(cellToCenterChild)(h3Index, childRes); diff --git a/src/apps/testapps/testCellToParent.c b/src/apps/testapps/testCellToParent.c index 51663ce4b..56e2c8903 100644 --- a/src/apps/testapps/testCellToParent.c +++ b/src/apps/testapps/testCellToParent.c @@ -29,10 +29,10 @@ SUITE(cellToParent) { for (int res = 1; res < 15; res++) { for (int step = 0; step < res; step++) { - t_assertSuccess(H3_EXPORT(pointToCell)(&sf, res, &child)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&sf, res, &child)); parent = H3_EXPORT(cellToParent)(child, res - step); t_assertSuccess( - H3_EXPORT(pointToCell)(&sf, res - step, &comparisonParent)); + H3_EXPORT(latLngToCell)(&sf, res - step, &comparisonParent)); t_assert(parent == comparisonParent, "Got expected parent"); } @@ -41,7 +41,7 @@ SUITE(cellToParent) { TEST(invalidInputs) { H3Index child; - t_assertSuccess(H3_EXPORT(pointToCell)(&sf, 5, &child)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&sf, 5, &child)); t_assert(H3_EXPORT(cellToParent)(child, 6) == 0, "Higher resolution fails"); diff --git a/src/apps/testapps/testCellToPoint.c b/src/apps/testapps/testCellToPoint.c index 5d3cacd68..501d71b10 100644 --- a/src/apps/testapps/testCellToPoint.c +++ b/src/apps/testapps/testCellToPoint.c @@ -45,7 +45,7 @@ void assertExpected(H3Index h1, const GeoPoint* g1) { // Convert back to H3 to verify int res = H3_EXPORT(getResolution)(h1); H3Index h2; - t_assertSuccess(H3_EXPORT(pointToCell)(&g2, res, &h2)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&g2, res, &h2)); t_assert(h1 == h2, "got expected geoToH3 output"); } diff --git a/src/apps/testapps/testDirectedEdge.c b/src/apps/testapps/testDirectedEdge.c index 968611055..2b1422062 100644 --- a/src/apps/testapps/testDirectedEdge.c +++ b/src/apps/testapps/testDirectedEdge.c @@ -33,7 +33,7 @@ static GeoPoint sfGeo = {0.659966917655, -2.1364398519396}; SUITE(directedEdge) { TEST(areNeighborCells) { H3Index sf; - t_assertSuccess(H3_EXPORT(pointToCell)(&sfGeo, 9, &sf)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&sfGeo, 9, &sf)); H3Index ring[7] = {0}; H3_EXPORT(gridRingUnsafe)(sf, 1, ring); @@ -70,7 +70,7 @@ SUITE(directedEdge) { "broken H3Indexes can't be neighbors (reversed)"); H3Index sfBigger; - t_assertSuccess(H3_EXPORT(pointToCell)(&sfGeo, 7, &sfBigger)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&sfGeo, 7, &sfBigger)); t_assert(H3_EXPORT(areNeighborCells)(sf, sfBigger) == 0, "hexagons of different resolution can't be neighbors"); @@ -80,7 +80,7 @@ SUITE(directedEdge) { TEST(cellsToDirectedEdgeAndFriends) { H3Index sf; - t_assertSuccess(H3_EXPORT(pointToCell)(&sfGeo, 9, &sf)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&sfGeo, 9, &sf)); H3Index ring[7] = {0}; H3_EXPORT(gridRingUnsafe)(sf, 1, ring); H3Index sf2 = ring[0]; @@ -152,7 +152,7 @@ SUITE(directedEdge) { TEST(isValidDirectedEdge) { H3Index sf; - t_assertSuccess(H3_EXPORT(pointToCell)(&sfGeo, 9, &sf)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&sfGeo, 9, &sf)); H3Index ring[7] = {0}; H3_EXPORT(gridRingUnsafe)(sf, 1, ring); H3Index sf2 = ring[0]; @@ -193,7 +193,7 @@ SUITE(directedEdge) { TEST(originToDirectedEdges) { H3Index sf; - t_assertSuccess(H3_EXPORT(pointToCell)(&sfGeo, 9, &sf)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&sfGeo, 9, &sf)); H3Index edges[6] = {0}; H3_EXPORT(originToDirectedEdges)(sf, edges); @@ -240,7 +240,7 @@ SUITE(directedEdge) { {5, 0}, {4, 5}, {0, 1}}; for (int res = 0; res < MAX_H3_RES; res++) { - t_assertSuccess(H3_EXPORT(pointToCell)(&sfGeo, res, &sf)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&sfGeo, res, &sf)); H3_EXPORT(cellToBoundary)(sf, &boundary); H3_EXPORT(originToDirectedEdges)(sf, edges); @@ -340,7 +340,7 @@ SUITE(directedEdge) { "Invalid edge has zero length"); GeoPoint zero = {0, 0}; H3Index h3; - t_assertSuccess(H3_EXPORT(pointToCell)(&zero, 0, &h3)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&zero, 0, &h3)); t_assert(H3_EXPORT(exactEdgeLengthRads)(h3) == 0, "Non-edge (cell) has zero edge length"); } diff --git a/src/apps/testapps/testGridDisk.c b/src/apps/testapps/testGridDisk.c index 50acbee9a..d652e6c9a 100644 --- a/src/apps/testapps/testGridDisk.c +++ b/src/apps/testapps/testGridDisk.c @@ -77,7 +77,7 @@ SUITE(gridDisk) { TEST(gridDisk0) { GeoPoint sf = {0.659966917655, 2 * 3.14159 - 2.1364398519396}; H3Index sfHex0; - t_assertSuccess(H3_EXPORT(pointToCell)(&sf, 0, &sfHex0)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&sf, 0, &sfHex0)); H3Index k1[] = {0, 0, 0, 0, 0, 0, 0}; int k1Dist[] = {0, 0, 0, 0, 0, 0, 0}; diff --git a/src/apps/testapps/testGridDisksUnsafe.c b/src/apps/testapps/testGridDisksUnsafe.c index 762b97ec0..d1fb1c911 100644 --- a/src/apps/testapps/testGridDisksUnsafe.c +++ b/src/apps/testapps/testGridDisksUnsafe.c @@ -22,7 +22,7 @@ SUITE(gridDisksUnsafe) { GeoPoint sf = {0.659966917655, 2 * 3.14159 - 2.1364398519396}; H3Index sfHex; - t_assertSuccess(H3_EXPORT(pointToCell)(&sf, 9, &sfHex)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&sf, 9, &sfHex)); H3Index* sfHexPtr = &sfHex; H3Index k1[] = {0x89283080ddbffff, 0x89283080c37ffff, 0x89283080c27ffff, diff --git a/src/apps/testapps/testGridRingUnsafe.c b/src/apps/testapps/testGridRingUnsafe.c index 54e714d94..31d993c3c 100644 --- a/src/apps/testapps/testGridRingUnsafe.c +++ b/src/apps/testapps/testGridRingUnsafe.c @@ -24,7 +24,7 @@ SUITE(gridRingUnsafe) { GeoPoint sf = {0.659966917655, 2 * 3.14159 - 2.1364398519396}; H3Index sfHex; - t_assertSuccess(H3_EXPORT(pointToCell)(&sf, 9, &sfHex)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&sf, 9, &sfHex)); TEST(identityGridRing) { int err; diff --git a/src/apps/testapps/testH3Api.c b/src/apps/testapps/testH3Api.c index 8005f1af8..75090e3a4 100644 --- a/src/apps/testapps/testH3Api.c +++ b/src/apps/testapps/testH3Api.c @@ -32,9 +32,9 @@ SUITE(h3Api) { H3Index h; GeoPoint anywhere = {0, 0}; - t_assert(H3_EXPORT(pointToCell)(&anywhere, -1, &h) == E_RES_DOMAIN, + t_assert(H3_EXPORT(latLngToCell)(&anywhere, -1, &h) == E_RES_DOMAIN, "resolution below 0 is invalid"); - t_assert(H3_EXPORT(pointToCell)(&anywhere, 16, &h) == E_RES_DOMAIN, + t_assert(H3_EXPORT(latLngToCell)(&anywhere, 16, &h) == E_RES_DOMAIN, "resolution above 15 is invalid"); } @@ -44,12 +44,12 @@ SUITE(h3Api) { GeoPoint invalidLon = {0, NAN}; GeoPoint invalidLatLon = {INFINITY, -INFINITY}; - t_assert(H3_EXPORT(pointToCell)(&invalidLat, 1, &h) == E_LATLON_DOMAIN, + t_assert(H3_EXPORT(latLngToCell)(&invalidLat, 1, &h) == E_LATLON_DOMAIN, "invalid latitude is rejected"); - t_assert(H3_EXPORT(pointToCell)(&invalidLon, 1, &h) == E_LATLON_DOMAIN, + t_assert(H3_EXPORT(latLngToCell)(&invalidLon, 1, &h) == E_LATLON_DOMAIN, "invalid longitude is rejected"); t_assert( - H3_EXPORT(pointToCell)(&invalidLatLon, 1, &h) == E_LATLON_DOMAIN, + H3_EXPORT(latLngToCell)(&invalidLatLon, 1, &h) == E_LATLON_DOMAIN, "coordinates with infinity are rejected"); } diff --git a/src/apps/testapps/testH3CellArea.c b/src/apps/testapps/testH3CellArea.c index 3cfbf5fc1..00b5c3f19 100644 --- a/src/apps/testapps/testH3CellArea.c +++ b/src/apps/testapps/testH3CellArea.c @@ -38,7 +38,7 @@ SUITE(h3CellArea) { GeoPoint gc = {0.0, 0.0}; for (int res = 0; res <= MAX_H3_RES - 1; res++) { H3Index cell; - t_assertSuccess(H3_EXPORT(pointToCell)(&gc, res, &cell)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&gc, res, &cell)); double area = H3_EXPORT(cellAreaKm2)(cell); t_assert(fabs(area - areasKm2[res]) < 1e-8, diff --git a/src/apps/testapps/testH3Index.c b/src/apps/testapps/testH3Index.c index ba309a2bd..99852afe5 100644 --- a/src/apps/testapps/testH3Index.c +++ b/src/apps/testapps/testH3Index.c @@ -33,14 +33,14 @@ SUITE(h3Index) { H3Index h; // Check that none of these cause crashes. GeoPoint g = {0, 1E45}; - t_assertSuccess(H3_EXPORT(pointToCell)(&g, 14, &h)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&g, 14, &h)); GeoPoint g2 = {1E46, 1E45}; - t_assertSuccess(H3_EXPORT(pointToCell)(&g2, 15, &h)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&g2, 15, &h)); GeoPoint g4; setGeoDegs(&g4, 2, -3E39); - t_assertSuccess(H3_EXPORT(pointToCell)(&g4, 0, &h)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&g4, 0, &h)); } TEST(faceIjkToH3ExtremeCoordinates) { @@ -70,7 +70,7 @@ SUITE(h3Index) { for (int i = 0; i <= MAX_H3_RES; i++) { GeoPoint GeoPoint = {0, 0}; H3Index h3; - t_assertSuccess(H3_EXPORT(pointToCell)(&GeoPoint, i, &h3)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&GeoPoint, i, &h3)); char failureMessage[BUFF_SIZE]; sprintf(failureMessage, "isValidCell failed on resolution %d", i); t_assert(H3_EXPORT(isValidCell)(h3), failureMessage); @@ -80,7 +80,7 @@ SUITE(h3Index) { TEST(isValidCellDigits) { GeoPoint GeoPoint = {0, 0}; H3Index h3; - t_assertSuccess(H3_EXPORT(pointToCell)(&GeoPoint, 1, &h3)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&GeoPoint, 1, &h3)); // Set a bit for an unused digit to something else. h3 ^= 1; t_assert(!H3_EXPORT(isValidCell)(h3), @@ -208,7 +208,7 @@ SUITE(h3Index) { GeoPoint coord = {0, 0}; for (int i = 0; i <= MAX_H3_RES; i++) { H3Index h; - t_assertSuccess(H3_EXPORT(pointToCell)(&coord, i, &h)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&coord, i, &h)); t_assert(H3_EXPORT(isResClassIII)(h) == isResolutionClassIII(i), "matches existing definition"); } diff --git a/src/apps/testapps/testPointToCell.c b/src/apps/testapps/testPointToCell.c index ad7eee21f..726b7e970 100644 --- a/src/apps/testapps/testPointToCell.c +++ b/src/apps/testapps/testPointToCell.c @@ -36,7 +36,7 @@ static void assertExpected(H3Index h1, const GeoPoint* g1) { // convert lat/lon to H3 and verify int res = H3_EXPORT(getResolution)(h1); H3Index h2; - t_assertSuccess(H3_EXPORT(pointToCell)(g1, res, &h2)); + t_assertSuccess(H3_EXPORT(latLngToCell)(g1, res, &h2)); t_assert(h1 == h2, "got expected pointToCell output"); } diff --git a/src/apps/testapps/testPolygonToCells.c b/src/apps/testapps/testPolygonToCells.c index d90602d5c..fe9ee27de 100644 --- a/src/apps/testapps/testPolygonToCells.c +++ b/src/apps/testapps/testPolygonToCells.c @@ -174,7 +174,7 @@ SUITE(polygonToCells) { TEST(polygonToCellsExact) { GeoPoint somewhere = {1, 2}; H3Index origin; - t_assertSuccess(H3_EXPORT(pointToCell)(&somewhere, 9, &origin)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&somewhere, 9, &origin)); CellBoundary boundary; H3_EXPORT(cellToBoundary)(origin, &boundary); diff --git a/src/apps/testapps/testVertexGraph.c b/src/apps/testapps/testVertexGraph.c index ad7a4154e..4c817bfb2 100644 --- a/src/apps/testapps/testVertexGraph.c +++ b/src/apps/testapps/testVertexGraph.c @@ -56,7 +56,7 @@ SUITE(vertexGraph) { int numBuckets = 1000; for (int res = 0; res < 11; res++) { - t_assertSuccess(H3_EXPORT(pointToCell)(¢er, res, ¢erIndex)); + t_assertSuccess(H3_EXPORT(latLngToCell)(¢er, res, ¢erIndex)); H3_EXPORT(cellToBoundary)(centerIndex, &outline); for (int i = 0; i < outline.numVerts; i++) { hash1 = _hashVertex(&outline.verts[i], res, numBuckets); diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index a1edd64bb..5a856aaba 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -207,7 +207,7 @@ typedef struct { */ /** @brief find the H3 index of the resolution res cell containing the lat/lng */ -DECLSPEC H3Error H3_EXPORT(pointToCell)(const GeoPoint *g, int res, +DECLSPEC H3Error H3_EXPORT(latLngToCell)(const GeoPoint *g, int res, H3Index *out); /** @} */ diff --git a/src/h3lib/lib/algos.c b/src/h3lib/lib/algos.c index c4f1ae79e..17a729995 100644 --- a/src/h3lib/lib/algos.c +++ b/src/h3lib/lib/algos.c @@ -790,7 +790,7 @@ int _getEdgeHexagons(const GeoLoop* geoloop, int numHexagons, int res, (origin.lon * (numHexesEstimate - j) / numHexesEstimate) + (destination.lon * j / numHexesEstimate); H3Index pointHex; - H3Error e = H3_EXPORT(pointToCell)(&interpolate, res, &pointHex); + H3Error e = H3_EXPORT(latLngToCell)(&interpolate, res, &pointHex); if (e) { return e; } diff --git a/src/h3lib/lib/h3Index.c b/src/h3lib/lib/h3Index.c index 077851d0f..e634f47fa 100644 --- a/src/h3lib/lib/h3Index.c +++ b/src/h3lib/lib/h3Index.c @@ -723,7 +723,7 @@ H3Index _faceIjkToH3(const FaceIJK* fijk, int res) { * @param out The encoded H3Index. * @returns E_SUCCESS (0) on success, another value otherwise */ -H3Error H3_EXPORT(pointToCell)(const GeoPoint* g, int res, H3Index* out) { +H3Error H3_EXPORT(latLngToCell)(const GeoPoint* g, int res, H3Index* out) { if (res < 0 || res > MAX_H3_RES) { return E_RES_DOMAIN; } From 34a48b228b636a3bdfa6dee55973eaefa964503a Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 19:31:58 -0700 Subject: [PATCH 02/74] find: pointToCell --- examples/index.c | 2 +- src/apps/benchmarks/benchmarkH3Api.c | 2 +- src/apps/filters/pointToCell.c | 2 +- src/apps/fuzzers/fuzzerPointToCell.c | 2 +- src/apps/testapps/testH3Api.c | 4 ++-- src/apps/testapps/testH3Index.c | 2 +- src/apps/testapps/testPointToCell.c | 6 +++--- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/index.c b/examples/index.c index 407b02fca..aa8269392 100644 --- a/examples/index.c +++ b/examples/index.c @@ -29,7 +29,7 @@ int main(int argc, char *argv[]) { location.lon = degsToRads(-74.044444); int resolution = 10; H3Index indexed; - if (pointToCell(&location, resolution, &indexed) != E_SUCCESS) { + if (latLngToCell(&location, resolution, &indexed) != E_SUCCESS) { printf("Failed\n"); return 1; } diff --git a/src/apps/benchmarks/benchmarkH3Api.c b/src/apps/benchmarks/benchmarkH3Api.c index be5ab565d..89fec3f55 100644 --- a/src/apps/benchmarks/benchmarkH3Api.c +++ b/src/apps/benchmarks/benchmarkH3Api.c @@ -27,7 +27,7 @@ GeoPoint outCoord; CellBoundary outBoundary; H3Index h; -BENCHMARK(pointToCell, 10000, { H3_EXPORT(latLngToCell)(&coord, 9, &h); }); +BENCHMARK(latLngToCell, 10000, { H3_EXPORT(latLngToCell)(&coord, 9, &h); }); BENCHMARK(cellToPoint, 10000, { H3_EXPORT(cellToPoint)(hex, &outCoord); }); diff --git a/src/apps/filters/pointToCell.c b/src/apps/filters/pointToCell.c index d9fb4acfa..f1dd27a09 100644 --- a/src/apps/filters/pointToCell.c +++ b/src/apps/filters/pointToCell.c @@ -17,7 +17,7 @@ * @brief stdin/stdout filter that converts from lat/lon coordinates to integer * H3 indexes * - * See `pointToCell --help` for usage. + * See `latLngToCell --help` for usage. * * The program reads lat/lon pairs from stdin until EOF is encountered. For * each lat/lon the program outputs to stdout the integer H3 index of the diff --git a/src/apps/fuzzers/fuzzerPointToCell.c b/src/apps/fuzzers/fuzzerPointToCell.c index 061536d19..396affe32 100644 --- a/src/apps/fuzzers/fuzzerPointToCell.c +++ b/src/apps/fuzzers/fuzzerPointToCell.c @@ -14,7 +14,7 @@ * limitations under the License. */ /** @file - * @brief Fuzzer program for pointToCell + * @brief Fuzzer program for latLngToCell */ #include "h3api.h" diff --git a/src/apps/testapps/testH3Api.c b/src/apps/testapps/testH3Api.c index 75090e3a4..8c71e17c0 100644 --- a/src/apps/testapps/testH3Api.c +++ b/src/apps/testapps/testH3Api.c @@ -28,7 +28,7 @@ #include "utility.h" SUITE(h3Api) { - TEST(pointToCell_res) { + TEST(latLngToCell_res) { H3Index h; GeoPoint anywhere = {0, 0}; @@ -38,7 +38,7 @@ SUITE(h3Api) { "resolution above 15 is invalid"); } - TEST(pointToCell_coord) { + TEST(latLngToCell_coord) { H3Index h; GeoPoint invalidLat = {NAN, 0}; GeoPoint invalidLon = {0, NAN}; diff --git a/src/apps/testapps/testH3Index.c b/src/apps/testapps/testH3Index.c index 99852afe5..8cc158668 100644 --- a/src/apps/testapps/testH3Index.c +++ b/src/apps/testapps/testH3Index.c @@ -29,7 +29,7 @@ #include "utility.h" SUITE(h3Index) { - TEST(pointToCellExtremeCoordinates) { + TEST(latLngToCellExtremeCoordinates) { H3Index h; // Check that none of these cause crashes. GeoPoint g = {0, 1E45}; diff --git a/src/apps/testapps/testPointToCell.c b/src/apps/testapps/testPointToCell.c index 726b7e970..1c98ae57e 100644 --- a/src/apps/testapps/testPointToCell.c +++ b/src/apps/testapps/testPointToCell.c @@ -14,12 +14,12 @@ * limitations under the License. */ /** @file - * @brief tests H3 function `pointToCell` + * @brief tests H3 function `latLngToCell` * * usage: `testPointToCell` * * The program reads lines containing H3 indexes and lat/lon pairs from - * stdin until EOF is encountered. For each input line, it calls `pointToCell` + * stdin until EOF is encountered. For each input line, it calls `latLngToCell` * to convert the input lat/lon to an H3 index, and then validates the * index against the original input index. */ @@ -37,7 +37,7 @@ static void assertExpected(H3Index h1, const GeoPoint* g1) { int res = H3_EXPORT(getResolution)(h1); H3Index h2; t_assertSuccess(H3_EXPORT(latLngToCell)(g1, res, &h2)); - t_assert(h1 == h2, "got expected pointToCell output"); + t_assert(h1 == h2, "got expected latLngToCell output"); } int main(int argc, char* argv[]) { From 0cbe377ff455106727b559fa884b15048a974373 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 19:35:11 -0700 Subject: [PATCH 03/74] formatting --- src/apps/testapps/testCellToParent.c | 4 ++-- src/apps/testapps/testVertexGraph.c | 3 ++- src/h3lib/include/h3api.h.in | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/apps/testapps/testCellToParent.c b/src/apps/testapps/testCellToParent.c index 56e2c8903..5ca8e6554 100644 --- a/src/apps/testapps/testCellToParent.c +++ b/src/apps/testapps/testCellToParent.c @@ -31,8 +31,8 @@ SUITE(cellToParent) { for (int step = 0; step < res; step++) { t_assertSuccess(H3_EXPORT(latLngToCell)(&sf, res, &child)); parent = H3_EXPORT(cellToParent)(child, res - step); - t_assertSuccess( - H3_EXPORT(latLngToCell)(&sf, res - step, &comparisonParent)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&sf, res - step, + &comparisonParent)); t_assert(parent == comparisonParent, "Got expected parent"); } diff --git a/src/apps/testapps/testVertexGraph.c b/src/apps/testapps/testVertexGraph.c index 4c817bfb2..fca6008b3 100644 --- a/src/apps/testapps/testVertexGraph.c +++ b/src/apps/testapps/testVertexGraph.c @@ -56,7 +56,8 @@ SUITE(vertexGraph) { int numBuckets = 1000; for (int res = 0; res < 11; res++) { - t_assertSuccess(H3_EXPORT(latLngToCell)(¢er, res, ¢erIndex)); + t_assertSuccess( + H3_EXPORT(latLngToCell)(¢er, res, ¢erIndex)); H3_EXPORT(cellToBoundary)(centerIndex, &outline); for (int i = 0; i < outline.numVerts; i++) { hash1 = _hashVertex(&outline.verts[i], res, numBuckets); diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index 5a856aaba..6c3b546ad 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -208,7 +208,7 @@ typedef struct { /** @brief find the H3 index of the resolution res cell containing the lat/lng */ DECLSPEC H3Error H3_EXPORT(latLngToCell)(const GeoPoint *g, int res, - H3Index *out); + H3Index *out); /** @} */ /** @defgroup cellToPoint cellToPoint From ca144fd8d1b703df458fde1f9bc0b7b640646435 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 19:40:18 -0700 Subject: [PATCH 04/74] find pointToCell in .md, .h.in, .txt --- CMakeLists.txt | 4 ++-- .../v4.0.0/names_for_concepts_types_functions.md | 4 ++-- src/h3lib/include/h3api.h.in | 4 ++-- website/docs/api/indexing.mdx | 12 ++++++------ website/docs/library/migration-3.x/functions.md | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index acf64c2d6..b9cc74d45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,7 +158,7 @@ set(OTHER_SOURCE_FILES src/apps/filters/h3ToLocalIj.c src/apps/filters/localIjToH3.c src/apps/filters/h3ToComponents.c - src/apps/filters/pointToCell.c + src/apps/filters/latLngToCell.c src/apps/filters/cellToBoundary.c src/apps/filters/gridDisk.c src/apps/filters/gridDiskUnsafe.c @@ -378,7 +378,7 @@ if(BUILD_FILTERS) list(APPEND INSTALL_TARGETS ${name}) endmacro() - add_h3_filter(pointToCell src/apps/filters/pointToCell.c ${APP_SOURCE_FILES}) + add_h3_filter(latLngToCell src/apps/filters/latLngToCell.c ${APP_SOURCE_FILES}) add_h3_filter(h3ToComponents src/apps/filters/h3ToComponents.c ${APP_SOURCE_FILES}) add_h3_filter(cellToPoint src/apps/filters/cellToPoint.c ${APP_SOURCE_FILES}) add_h3_filter(h3ToLocalIj src/apps/filters/h3ToLocalIj.c ${APP_SOURCE_FILES}) diff --git a/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md b/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md index 058c2242d..8fdc172af 100644 --- a/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md +++ b/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md @@ -100,7 +100,7 @@ The proposed prefix is `h3_`. + object properties (`getResolution`, `getBaseCellNumber`) - use `to` to denote transforms + different representations of the same object - + when doing a lossy transformation to a new object (`cellToParent`, `pointToCell`, `polygonToCells`) + + when doing a lossy transformation to a new object (`cellToParent`, `latLngToCell`, `polygonToCells`) - do not use `get` or `to` for *computations* + e.g., `compactCells`, `cellAreaKm2` @@ -139,7 +139,7 @@ There is some ambiguity between property, transform, and computation, so use you | `h3GetResolution` | `getResolution` | | *DNE* | `getMode` | | `h3GetFaces` | `getIcosahedronFaces` | -| `geoToH3` | `pointToCell` | +| `geoToH3` | `latLngToCell` | | `h3ToGeo` | `cellToPoint` | | `compact` | `compactCells` | | `uncompact` | `uncompactCells` | diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index 6c3b546ad..401d3bbe4 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -201,8 +201,8 @@ typedef struct { int j; ///< j component } CoordIJ; -/** @defgroup pointToCell pointToCell - * Functions for pointToCell +/** @defgroup latLngToCell latLngToCell + * Functions for latLngToCell * @{ */ /** @brief find the H3 index of the resolution res cell containing the lat/lng diff --git a/website/docs/api/indexing.mdx b/website/docs/api/indexing.mdx index 64c560e65..3fde48cbe 100644 --- a/website/docs/api/indexing.mdx +++ b/website/docs/api/indexing.mdx @@ -10,7 +10,7 @@ import TabItem from '@theme/TabItem'; These function are used for finding the H3 cell index containing coordinates, and for finding the center and boundary of H3 indexes. -## pointToCell +## latLngToCell ```c -H3Error pointToCell(const GeoPoint *g, int res, H3Index *out); +H3Error latLngToCell(const GeoPoint *g, int res, H3Index *out); ``` @@ -39,15 +39,15 @@ h3.point_to_cell(lat, lng, resolution) ```java -long pointToCell(double lat, double lng, int res); -String pointToCellAddress(double lat, double lng, int res); +long latLngToCell(double lat, double lng, int res); +String latLngToCellAddress(double lat, double lng, int res); ``` ```js -h3.pointToCell(lat, lng, res) +h3.latLngToCell(lat, lng, res) ``` ```js live @@ -55,7 +55,7 @@ function example() { const lat = 45; const lng = 40; const res = 2; - return h3.pointToCell(lat, lng, res); + return h3.latLngToCell(lat, lng, res); } ``` diff --git a/website/docs/library/migration-3.x/functions.md b/website/docs/library/migration-3.x/functions.md index 7ac666c67..252d5dd67 100644 --- a/website/docs/library/migration-3.x/functions.md +++ b/website/docs/library/migration-3.x/functions.md @@ -27,7 +27,7 @@ The following function and structure names changed from 3.x to 4.0.0: | `h3GetResolution` | `getResolution` | | *DNE* | `getMode` | | `h3GetFaces` | `getIcosahedronFaces` | -| `geoToH3` | `pointToCell` | +| `geoToH3` | `latLngToCell` | | `h3ToGeo` | `cellToPoint` | | `compact` | `compactCells` | | `uncompact` | `uncompactCells` | From bce94f25732cc0fe41b4ccf66d5010f674b10c9c Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 19:41:16 -0700 Subject: [PATCH 05/74] filename change --- src/apps/filters/{pointToCell.c => latLngToCell.c} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/apps/filters/{pointToCell.c => latLngToCell.c} (100%) diff --git a/src/apps/filters/pointToCell.c b/src/apps/filters/latLngToCell.c similarity index 100% rename from src/apps/filters/pointToCell.c rename to src/apps/filters/latLngToCell.c From 34041354ef2c4bf00d294c3af602ae30a7b228fa Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 19:50:41 -0700 Subject: [PATCH 06/74] find: H3_EXPORT(cellToPoint) --- src/apps/benchmarks/benchmarkH3Api.c | 2 +- src/apps/filters/cellToPoint.c | 2 +- src/apps/fuzzers/fuzzerCellToPoint.c | 2 +- src/apps/miscapps/cellToPointHier.c | 2 +- src/apps/testapps/testCellToCenterChild.c | 4 ++-- src/apps/testapps/testCellToPoint.c | 2 +- src/apps/testapps/testH3Api.c | 2 +- src/apps/testapps/testH3CellAreaExhaustive.c | 4 ++-- src/apps/testapps/testPolygonToCells.c | 2 +- src/h3lib/include/h3api.h.in | 2 +- src/h3lib/lib/algos.c | 2 +- src/h3lib/lib/bbox.c | 2 +- src/h3lib/lib/geoPoint.c | 2 +- src/h3lib/lib/h3Index.c | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/apps/benchmarks/benchmarkH3Api.c b/src/apps/benchmarks/benchmarkH3Api.c index 89fec3f55..413cfff60 100644 --- a/src/apps/benchmarks/benchmarkH3Api.c +++ b/src/apps/benchmarks/benchmarkH3Api.c @@ -29,7 +29,7 @@ H3Index h; BENCHMARK(latLngToCell, 10000, { H3_EXPORT(latLngToCell)(&coord, 9, &h); }); -BENCHMARK(cellToPoint, 10000, { H3_EXPORT(cellToPoint)(hex, &outCoord); }); +BENCHMARK(cellToPoint, 10000, { H3_EXPORT(cellToLatLng)(hex, &outCoord); }); BENCHMARK(cellToBoundary, 10000, { H3_EXPORT(cellToBoundary)(hex, &outBoundary); diff --git a/src/apps/filters/cellToPoint.c b/src/apps/filters/cellToPoint.c index de660c3e8..7db50be5e 100644 --- a/src/apps/filters/cellToPoint.c +++ b/src/apps/filters/cellToPoint.c @@ -49,7 +49,7 @@ void doCell(H3Index h, int isKmlOut) { GeoPoint g; - H3_EXPORT(cellToPoint)(h, &g); + H3_EXPORT(cellToLatLng)(h, &g); char label[BUFF_SIZE]; diff --git a/src/apps/fuzzers/fuzzerCellToPoint.c b/src/apps/fuzzers/fuzzerCellToPoint.c index 9c903e921..7f28aee57 100644 --- a/src/apps/fuzzers/fuzzerCellToPoint.c +++ b/src/apps/fuzzers/fuzzerCellToPoint.c @@ -33,7 +33,7 @@ int main(int argc, char* argv[]) { fclose(fp); GeoPoint geo; - H3_EXPORT(cellToPoint)(index, &geo); + H3_EXPORT(cellToLatLng)(index, &geo); printf("%lf %lf\n", geo.lat, geo.lon); CellBoundary cellBoundary; H3_EXPORT(cellToBoundary)(index, &cellBoundary); diff --git a/src/apps/miscapps/cellToPointHier.c b/src/apps/miscapps/cellToPointHier.c index 3a67ad303..ceb40e255 100644 --- a/src/apps/miscapps/cellToPointHier.c +++ b/src/apps/miscapps/cellToPointHier.c @@ -62,7 +62,7 @@ void doCell(H3Index h, int isKmlOut) { GeoPoint g; - H3_EXPORT(cellToPoint)(h, &g); + H3_EXPORT(cellToLatLng)(h, &g); char label[BUFF_SIZE]; H3_EXPORT(h3ToString)(h, label, BUFF_SIZE); diff --git a/src/apps/testapps/testCellToCenterChild.c b/src/apps/testapps/testCellToCenterChild.c index 1d3ac252c..428856455 100644 --- a/src/apps/testapps/testCellToCenterChild.c +++ b/src/apps/testapps/testCellToCenterChild.c @@ -24,7 +24,7 @@ SUITE(cellToCenterChild) { H3Index baseHex; GeoPoint baseCentroid; setH3Index(&baseHex, 8, 4, 2); - H3_EXPORT(cellToPoint)(baseHex, &baseCentroid); + H3_EXPORT(cellToLatLng)(baseHex, &baseCentroid); TEST(propertyTests) { for (int res = 0; res <= MAX_H3_RES - 1; res++) { @@ -33,7 +33,7 @@ SUITE(cellToCenterChild) { H3Index h3Index; t_assertSuccess( H3_EXPORT(latLngToCell)(&baseCentroid, res, &h3Index)); - H3_EXPORT(cellToPoint)(h3Index, ¢roid); + H3_EXPORT(cellToLatLng)(h3Index, ¢roid); H3Index geoChild; t_assertSuccess( diff --git a/src/apps/testapps/testCellToPoint.c b/src/apps/testapps/testCellToPoint.c index 501d71b10..b0ab13715 100644 --- a/src/apps/testapps/testCellToPoint.c +++ b/src/apps/testapps/testCellToPoint.c @@ -37,7 +37,7 @@ void assertExpected(H3Index h1, const GeoPoint* g1) { const double epsilon = 0.000001 * M_PI_180; // convert H3 to lat/lon and verify GeoPoint g2; - H3_EXPORT(cellToPoint)(h1, &g2); + H3_EXPORT(cellToLatLng)(h1, &g2); t_assert(geoAlmostEqualThreshold(&g2, g1, epsilon), "got expected cellToPoint output"); diff --git a/src/apps/testapps/testH3Api.c b/src/apps/testapps/testH3Api.c index 8c71e17c0..e90d42455 100644 --- a/src/apps/testapps/testH3Api.c +++ b/src/apps/testapps/testH3Api.c @@ -114,7 +114,7 @@ SUITE(h3Api) { TEST(h3ToGeoInvalid) { GeoPoint coord; - H3_EXPORT(cellToPoint)(0x7fffffffffffffff, &coord); + H3_EXPORT(cellToLatLng)(0x7fffffffffffffff, &coord); // Test is this should not crash (should return an error in the future) } diff --git a/src/apps/testapps/testH3CellAreaExhaustive.c b/src/apps/testapps/testH3CellAreaExhaustive.c index c0adbfc23..dcc73b374 100644 --- a/src/apps/testapps/testH3CellAreaExhaustive.c +++ b/src/apps/testapps/testH3CellAreaExhaustive.c @@ -45,10 +45,10 @@ static void haversine_assert(H3Index edge) { H3Index origin, destination; origin = H3_EXPORT(getDirectedEdgeOrigin)(edge); - H3_EXPORT(cellToPoint)(origin, &a); + H3_EXPORT(cellToLatLng)(origin, &a); destination = H3_EXPORT(getDirectedEdgeDestination)(edge); - H3_EXPORT(cellToPoint)(destination, &b); + H3_EXPORT(cellToLatLng)(destination, &b); char pos[] = "distance between cell centers should be positive"; char comm[] = "pairwise cell distances should be commutative"; diff --git a/src/apps/testapps/testPolygonToCells.c b/src/apps/testapps/testPolygonToCells.c index fe9ee27de..762671111 100644 --- a/src/apps/testapps/testPolygonToCells.c +++ b/src/apps/testapps/testPolygonToCells.c @@ -315,7 +315,7 @@ SUITE(polygonToCells) { H3Index pentagon; setH3Index(&pentagon, 9, 24, 0); GeoPoint coord; - H3_EXPORT(cellToPoint)(pentagon, &coord); + H3_EXPORT(cellToLatLng)(pentagon, &coord); // Length of half an edge of the polygon, in radians double edgeLength2 = H3_EXPORT(degsToRads)(0.001); diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index 401d3bbe4..14b413e77 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -216,7 +216,7 @@ DECLSPEC H3Error H3_EXPORT(latLngToCell)(const GeoPoint *g, int res, * @{ */ /** @brief find the lat/lon center point g of the cell h3 */ -DECLSPEC H3Error H3_EXPORT(cellToPoint)(H3Index h3, GeoPoint *g); +DECLSPEC H3Error H3_EXPORT(cellToLatLng)(H3Index h3, GeoPoint *g); /** @} */ /** @defgroup cellToBoundary cellToBoundary diff --git a/src/h3lib/lib/algos.c b/src/h3lib/lib/algos.c index 17a729995..8672772c5 100644 --- a/src/h3lib/lib/algos.c +++ b/src/h3lib/lib/algos.c @@ -960,7 +960,7 @@ int _polygonToCellsInternal(const GeoPolygon* geoPolygon, int res, // Check if the hexagon is in the polygon or not GeoPoint hexCenter; - H3_EXPORT(cellToPoint)(hex, &hexCenter); + H3_EXPORT(cellToLatLng)(hex, &hexCenter); // If not, skip if (!pointInsidePolygon(geoPolygon, bboxes, &hexCenter)) { diff --git a/src/h3lib/lib/bbox.c b/src/h3lib/lib/bbox.c index 4ea79014f..c8efec448 100644 --- a/src/h3lib/lib/bbox.c +++ b/src/h3lib/lib/bbox.c @@ -84,7 +84,7 @@ double _hexRadiusKm(H3Index h3Index) { // hexagon, but this way is conceptually simple GeoPoint h3Center; CellBoundary h3Boundary; - H3_EXPORT(cellToPoint)(h3Index, &h3Center); + H3_EXPORT(cellToLatLng)(h3Index, &h3Center); H3_EXPORT(cellToBoundary)(h3Index, &h3Boundary); return H3_EXPORT(pointDistKm)(&h3Center, h3Boundary.verts); } diff --git a/src/h3lib/lib/geoPoint.c b/src/h3lib/lib/geoPoint.c index f6ed207f5..29f60a6b3 100644 --- a/src/h3lib/lib/geoPoint.c +++ b/src/h3lib/lib/geoPoint.c @@ -351,7 +351,7 @@ double triangleArea(const GeoPoint *a, const GeoPoint *b, const GeoPoint *c) { double H3_EXPORT(cellAreaRads2)(H3Index cell) { GeoPoint c; CellBoundary cb; - H3_EXPORT(cellToPoint)(cell, &c); + H3_EXPORT(cellToLatLng)(cell, &c); H3_EXPORT(cellToBoundary)(cell, &cb); double area = 0.0; diff --git a/src/h3lib/lib/h3Index.c b/src/h3lib/lib/h3Index.c index e634f47fa..6e4da5ca9 100644 --- a/src/h3lib/lib/h3Index.c +++ b/src/h3lib/lib/h3Index.c @@ -836,7 +836,7 @@ H3Error _h3ToFaceIjk(H3Index h, FaceIJK* fijk) { * @param h3 The H3 index. * @param g The spherical coordinates of the H3 cell center. */ -H3Error H3_EXPORT(cellToPoint)(H3Index h3, GeoPoint* g) { +H3Error H3_EXPORT(cellToLatLng)(H3Index h3, GeoPoint* g) { FaceIJK fijk; H3Error e = _h3ToFaceIjk(h3, &fijk); if (e) { From 062c627a3a0256b09e3dff70bbc39dd3bba1f14a Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 19:53:32 -0700 Subject: [PATCH 07/74] find: cellToPoint in .c --- examples/distance.c | 4 ++-- examples/index.c | 2 +- src/apps/benchmarks/benchmarkH3Api.c | 2 +- src/apps/filters/cellToPoint.c | 10 +++++----- src/apps/fuzzers/fuzzerCellToPoint.c | 2 +- src/apps/miscapps/cellToPointHier.c | 10 +++++----- src/apps/testapps/testCellToPoint.c | 6 +++--- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/distance.c b/examples/distance.c index 33a27037d..d776651da 100644 --- a/examples/distance.c +++ b/examples/distance.c @@ -53,8 +53,8 @@ int main(int argc, char *argv[]) { H3Index h3HQ2 = stringToH3("8f283082a30e623"); GeoPoint geoHQ1, geoHQ2; - cellToPoint(h3HQ1, &geoHQ1); - cellToPoint(h3HQ2, &geoHQ2); + cellToLatLng(h3HQ1, &geoHQ1); + cellToLatLng(h3HQ2, &geoHQ2); printf( "origin: (%lf, %lf)\n" diff --git a/examples/index.c b/examples/index.c index aa8269392..61efbc0b4 100644 --- a/examples/index.c +++ b/examples/index.c @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) { // Get the center coordinates. GeoPoint center; - if (cellToPoint(indexed, ¢er) != E_SUCCESS) { + if (cellToLatLng(indexed, ¢er) != E_SUCCESS) { printf("Failed\n"); return 1; } diff --git a/src/apps/benchmarks/benchmarkH3Api.c b/src/apps/benchmarks/benchmarkH3Api.c index 413cfff60..f1130a410 100644 --- a/src/apps/benchmarks/benchmarkH3Api.c +++ b/src/apps/benchmarks/benchmarkH3Api.c @@ -29,7 +29,7 @@ H3Index h; BENCHMARK(latLngToCell, 10000, { H3_EXPORT(latLngToCell)(&coord, 9, &h); }); -BENCHMARK(cellToPoint, 10000, { H3_EXPORT(cellToLatLng)(hex, &outCoord); }); +BENCHMARK(cellToLatLng, 10000, { H3_EXPORT(cellToLatLng)(hex, &outCoord); }); BENCHMARK(cellToBoundary, 10000, { H3_EXPORT(cellToBoundary)(hex, &outBoundary); diff --git a/src/apps/filters/cellToPoint.c b/src/apps/filters/cellToPoint.c index 7db50be5e..4ad7b16f4 100644 --- a/src/apps/filters/cellToPoint.c +++ b/src/apps/filters/cellToPoint.c @@ -17,7 +17,7 @@ * @brief stdin/stdout filter that converts from integer H3 indexes to lat/lon * cell center point * - * See `cellToPoint --help` for usage. + * See `cellToLatLng --help` for usage. * * The program reads H3 indexes from stdin and outputs the corresponding * cell center points to stdout, until EOF is encountered. The H3 indexes @@ -25,16 +25,16 @@ * * `--kml` causes KML output to be printed. `--kml-name` and * `--kml-description` can be used to change the name and description in the - * KML header, which default to "H3 Geometry" and "Generated by cellToPoint" + * KML header, which default to "H3 Geometry" and "Generated by cellToLatLng" * respectively. * * Examples: * - * `cellToPoint < indexes.txt` + * `cellToLatLng < indexes.txt` * - outputs plain text cell center points for the H3 indexes contained * in the file `indexes.txt` * - * `cellToPoint --kml --kml-name "kml title" --kml-description "h3 cells" < + * `cellToLatLng --kml --kml-name "kml title" --kml-description "h3 cells" < * indexes.txt > cells.kml` * - creates the KML file `cells.kml` containing the cell center points * for all of the H3 indexes contained in the file `indexes.txt`. @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) { char *kmlName = "H3 Geometry"; if (kmlNameArg.found) kmlName = userKmlName; - char *kmlDesc = "Generated by cellToPoint"; + char *kmlDesc = "Generated by cellToLatLng"; if (kmlDescArg.found) kmlDesc = userKmlDesc; kmlPtsHeader(kmlName, kmlDesc); diff --git a/src/apps/fuzzers/fuzzerCellToPoint.c b/src/apps/fuzzers/fuzzerCellToPoint.c index 7f28aee57..e7f9bd849 100644 --- a/src/apps/fuzzers/fuzzerCellToPoint.c +++ b/src/apps/fuzzers/fuzzerCellToPoint.c @@ -14,7 +14,7 @@ * limitations under the License. */ /** @file - * @brief Fuzzer program for cellToPoint and cellToBoundary + * @brief Fuzzer program for cellToLatLng and cellToBoundary */ #include "h3api.h" diff --git a/src/apps/miscapps/cellToPointHier.c b/src/apps/miscapps/cellToPointHier.c index ceb40e255..f5911f6b6 100644 --- a/src/apps/miscapps/cellToPointHier.c +++ b/src/apps/miscapps/cellToPointHier.c @@ -17,7 +17,7 @@ * @brief takes an H3 index and generates cell center points for descendants a * specified resolution. * - * See `cellToPointHier --help` for usage. + * See `cellToLatLngHier --help` for usage. * * The program generates the cell center points in lat/lon coordinates for all * hierarchical children of H3Index at the specified resolution. If the @@ -33,16 +33,16 @@ * Examples: * --------- * - * `cellToPointHier --parent 836e9bfffffffff` + * `cellToLatLngHier --parent 836e9bfffffffff` * - outputs the cell center point in lat/lon for cell * `836e9bfffffffff` as plain text * - * `cellToPointHier --parent 820ceffffffffff --resolution 4 --kml > pts.kml` + * `cellToLatLngHier --parent 820ceffffffffff --resolution 4 --kml > pts.kml` * - outputs the cell center points of all of the resolution 4 * descendants of cell `820ceffffffffff` as a KML file (redirected to * `pts.kml`). * - * `cellToPointHier --parent 86283082fffffff --resolution 9 --kml > + * `cellToLatLngHier --parent 86283082fffffff --resolution 9 --kml > * uber9pts.kml` * - creates a KML file containing the cell center points of all of the * resolution 9 hexagons covering Uber HQ and the surrounding region of @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) { ((res <= rootRes) ? rootRes : res)); } - char *kmlDesc = "Generated by cellToPointHier"; + char *kmlDesc = "Generated by cellToLatLngHier"; if (kmlDescArg.found) kmlDesc = userKmlDesc; kmlBoundaryHeader(kmlName, kmlDesc); diff --git a/src/apps/testapps/testCellToPoint.c b/src/apps/testapps/testCellToPoint.c index b0ab13715..623c4167b 100644 --- a/src/apps/testapps/testCellToPoint.c +++ b/src/apps/testapps/testCellToPoint.c @@ -14,13 +14,13 @@ * limitations under the License. */ /** @file - * @brief tests H3 function `cellToPoint` + * @brief tests H3 function `cellToLatLng` * * usage: `testCellToPoint` * * The program reads lines containing H3 indexes and lat/lon center * point pairs from stdin until EOF is encountered. For each input line, - * the program calls `cellToPoint` to convert H3 index to a lat/lng, then + * the program calls `cellToLatLng` to convert H3 index to a lat/lng, then * validates against the input lat/lng within a given threshold */ @@ -40,7 +40,7 @@ void assertExpected(H3Index h1, const GeoPoint* g1) { H3_EXPORT(cellToLatLng)(h1, &g2); t_assert(geoAlmostEqualThreshold(&g2, g1, epsilon), - "got expected cellToPoint output"); + "got expected cellToLatLng output"); // Convert back to H3 to verify int res = H3_EXPORT(getResolution)(h1); From 12c583629f4f207846de639352b195c12cea971a Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 19:55:30 -0700 Subject: [PATCH 08/74] find cellToPoint in *.txt, *.md --- CMakeLists.txt | 10 +++++----- .../v4.0.0/names_for_concepts_types_functions.md | 2 +- src/h3lib/include/h3api.h.in | 4 ++-- website/docs/api/indexing.mdx | 12 ++++++------ website/docs/library/migration-3.x/functions.md | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9cc74d45..a8eec05b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,7 +154,7 @@ set(EXAMPLE_SOURCE_FILES examples/compactCells.c examples/edge.c) set(OTHER_SOURCE_FILES - src/apps/filters/cellToPoint.c + src/apps/filters/cellToLatLng.c src/apps/filters/h3ToLocalIj.c src/apps/filters/localIjToH3.c src/apps/filters/h3ToComponents.c @@ -208,7 +208,7 @@ set(OTHER_SOURCE_FILES src/apps/testapps/testH3Memory.c src/apps/testapps/testH3Iterators.c src/apps/miscapps/cellToBoundaryHier.c - src/apps/miscapps/cellToPointHier.c + src/apps/miscapps/cellToLatLngHier.c src/apps/miscapps/generateBaseCellNeighbors.c src/apps/miscapps/generatePentagonDirectionFaces.c src/apps/miscapps/generateFaceCenterPoint.c @@ -380,14 +380,14 @@ if(BUILD_FILTERS) add_h3_filter(latLngToCell src/apps/filters/latLngToCell.c ${APP_SOURCE_FILES}) add_h3_filter(h3ToComponents src/apps/filters/h3ToComponents.c ${APP_SOURCE_FILES}) - add_h3_filter(cellToPoint src/apps/filters/cellToPoint.c ${APP_SOURCE_FILES}) + add_h3_filter(cellToLatLng src/apps/filters/cellToLatLng.c ${APP_SOURCE_FILES}) add_h3_filter(h3ToLocalIj src/apps/filters/h3ToLocalIj.c ${APP_SOURCE_FILES}) add_h3_filter(localIjToH3 src/apps/filters/localIjToH3.c ${APP_SOURCE_FILES}) add_h3_filter(cellToBoundary src/apps/filters/cellToBoundary.c ${APP_SOURCE_FILES}) add_h3_filter(gridDiskUnsafe src/apps/filters/gridDiskUnsafe.c ${APP_SOURCE_FILES}) add_h3_filter(gridDisk src/apps/filters/gridDisk.c ${APP_SOURCE_FILES}) add_h3_filter(cellToBoundaryHier src/apps/miscapps/cellToBoundaryHier.c ${APP_SOURCE_FILES}) - add_h3_filter(cellToPointHier src/apps/miscapps/cellToPointHier.c ${APP_SOURCE_FILES}) + add_h3_filter(cellToLatLngHier src/apps/miscapps/cellToLatLngHier.c ${APP_SOURCE_FILES}) add_h3_filter(h3ToHier src/apps/miscapps/h3ToHier.c ${APP_SOURCE_FILES}) # Generate KML files for visualizing the H3 grid @@ -405,7 +405,7 @@ if(BUILD_FILTERS) VERBATIM DEPENDS create-kml-dir) add_custom_target(kml_centers_${resolution} - COMMAND ${SHELL} "$ -r ${resolution} | $ --kml --kml-name res${resolution}centers.kml --kml-description \"Res ${resolution} Centers\" > KML/res${resolution}centers.kml" + COMMAND ${SHELL} "$ -r ${resolution} | $ --kml --kml-name res${resolution}centers.kml --kml-description \"Res ${resolution} Centers\" > KML/res${resolution}centers.kml" VERBATIM DEPENDS create-kml-dir) add_dependencies(kml diff --git a/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md b/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md index 8fdc172af..fa8abdd60 100644 --- a/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md +++ b/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md @@ -140,7 +140,7 @@ There is some ambiguity between property, transform, and computation, so use you | *DNE* | `getMode` | | `h3GetFaces` | `getIcosahedronFaces` | | `geoToH3` | `latLngToCell` | -| `h3ToGeo` | `cellToPoint` | +| `h3ToGeo` | `cellToLatLng` | | `compact` | `compactCells` | | `uncompact` | `uncompactCells` | | `polyfill` | `polygonToCells` | diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index 14b413e77..0878176fd 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -211,8 +211,8 @@ DECLSPEC H3Error H3_EXPORT(latLngToCell)(const GeoPoint *g, int res, H3Index *out); /** @} */ -/** @defgroup cellToPoint cellToPoint - * Functions for cellToPoint +/** @defgroup cellToLatLng cellToLatLng + * Functions for cellToLatLng * @{ */ /** @brief find the lat/lon center point g of the cell h3 */ diff --git a/website/docs/api/indexing.mdx b/website/docs/api/indexing.mdx index 3fde48cbe..4df20591b 100644 --- a/website/docs/api/indexing.mdx +++ b/website/docs/api/indexing.mdx @@ -66,7 +66,7 @@ Indexes the location at the specified resolution, returning the index of the cel Returns 0 (`E_SUCCESS`) on success. -## cellToPoint +## cellToLatLng ```c -H3Error cellToPoint(H3Index cell, GeoPoint *g); +H3Error cellToLatLng(H3Index cell, GeoPoint *g); ``` @@ -95,21 +95,21 @@ h3.cell_to_point(cell) ```java -GeoPoint cellToPoint(long cell); -GeoPoint cellToPoint(String cellAddress); +GeoPoint cellToLatLng(long cell); +GeoPoint cellToLatLng(String cellAddress); ``` ```js -h3.cellToPoint(cell) +h3.cellToLatLng(cell) ``` ```js live function example() { const cell = '85283473fffffff'; - return h3.cellToPoint(cell); + return h3.cellToLatLng(cell); } ``` diff --git a/website/docs/library/migration-3.x/functions.md b/website/docs/library/migration-3.x/functions.md index 252d5dd67..3964cd797 100644 --- a/website/docs/library/migration-3.x/functions.md +++ b/website/docs/library/migration-3.x/functions.md @@ -28,7 +28,7 @@ The following function and structure names changed from 3.x to 4.0.0: | *DNE* | `getMode` | | `h3GetFaces` | `getIcosahedronFaces` | | `geoToH3` | `latLngToCell` | -| `h3ToGeo` | `cellToPoint` | +| `h3ToGeo` | `cellToLatLng` | | `compact` | `compactCells` | | `uncompact` | `uncompactCells` | | `polyfill` | `polygonToCells` | From 06329d28dfaab712437df8b67641330be9912403 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 19:57:52 -0700 Subject: [PATCH 09/74] filename changes --- src/apps/filters/{cellToPoint.c => cellToLatLng.c} | 0 src/apps/fuzzers/{fuzzerCellToPoint.c => fuzzerCellToLatLng.c} | 0 src/apps/miscapps/{cellToPointHier.c => cellToLatLngHier.c} | 0 src/apps/testapps/{testCellToPoint.c => testCellToLatLng.c} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename src/apps/filters/{cellToPoint.c => cellToLatLng.c} (100%) rename src/apps/fuzzers/{fuzzerCellToPoint.c => fuzzerCellToLatLng.c} (100%) rename src/apps/miscapps/{cellToPointHier.c => cellToLatLngHier.c} (100%) rename src/apps/testapps/{testCellToPoint.c => testCellToLatLng.c} (100%) diff --git a/src/apps/filters/cellToPoint.c b/src/apps/filters/cellToLatLng.c similarity index 100% rename from src/apps/filters/cellToPoint.c rename to src/apps/filters/cellToLatLng.c diff --git a/src/apps/fuzzers/fuzzerCellToPoint.c b/src/apps/fuzzers/fuzzerCellToLatLng.c similarity index 100% rename from src/apps/fuzzers/fuzzerCellToPoint.c rename to src/apps/fuzzers/fuzzerCellToLatLng.c diff --git a/src/apps/miscapps/cellToPointHier.c b/src/apps/miscapps/cellToLatLngHier.c similarity index 100% rename from src/apps/miscapps/cellToPointHier.c rename to src/apps/miscapps/cellToLatLngHier.c diff --git a/src/apps/testapps/testCellToPoint.c b/src/apps/testapps/testCellToLatLng.c similarity index 100% rename from src/apps/testapps/testCellToPoint.c rename to src/apps/testapps/testCellToLatLng.c From 20ecaec42ece15667e054013362a37f7c69d6673 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 19:59:12 -0700 Subject: [PATCH 10/74] cmake --- CMakeLists.txt | 8 ++++---- src/apps/testapps/testCellToLatLng.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8eec05b6..07e2acf93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,7 +176,7 @@ set(OTHER_SOURCE_FILES src/apps/testapps/testH3NeighborRotations.c src/apps/testapps/testCellToChildrenSize.c src/apps/testapps/testGridDisksUnsafe.c - src/apps/testapps/testCellToPoint.c + src/apps/testapps/testCellToLatLng.c src/apps/testapps/testCellToCenterChild.c src/apps/testapps/testCellToChildren.c src/apps/testapps/testGetIcosahedronFaces.c @@ -214,7 +214,7 @@ set(OTHER_SOURCE_FILES src/apps/miscapps/generateFaceCenterPoint.c src/apps/miscapps/h3ToHier.c src/apps/fuzzers/fuzzerPointToCell.c - src/apps/fuzzers/fuzzerCellToPoint.c + src/apps/fuzzers/fuzzerCellToLatLng.c src/apps/fuzzers/fuzzerGridDisk.c src/apps/benchmarks/benchmarkPolygonToCells.c src/apps/benchmarks/benchmarkPolygon.c @@ -555,7 +555,7 @@ if(H3_IS_ROOT_PROJECT AND BUILD_TESTING) file(GLOB all_ic_files tests/inputfiles/res*ic.txt) foreach(file ${all_ic_files}) - add_h3_test_with_file(testCellToPoint src/apps/testapps/testCellToPoint.c ${file}) + add_h3_test_with_file(testCellToLatLng src/apps/testapps/testCellToLatLng.c ${file}) endforeach() file(GLOB all_centers tests/inputfiles/rand*centers.txt) @@ -633,7 +633,7 @@ if(BUILD_FUZZERS) endmacro() add_h3_fuzzer(fuzzerPointToCell src/apps/fuzzers/fuzzerPointToCell.c) - add_h3_fuzzer(fuzzerCellToPoint src/apps/fuzzers/fuzzerCellToPoint.c) + add_h3_fuzzer(fuzzerCellToLatLng src/apps/fuzzers/fuzzerCellToLatLng.c) add_h3_fuzzer(fuzzerGridDisk src/apps/fuzzers/fuzzerGridDisk.c) endif() diff --git a/src/apps/testapps/testCellToLatLng.c b/src/apps/testapps/testCellToLatLng.c index 623c4167b..65bf46a38 100644 --- a/src/apps/testapps/testCellToLatLng.c +++ b/src/apps/testapps/testCellToLatLng.c @@ -16,7 +16,7 @@ /** @file * @brief tests H3 function `cellToLatLng` * - * usage: `testCellToPoint` + * usage: `testCellToLatLng` * * The program reads lines containing H3 indexes and lat/lon center * point pairs from stdin until EOF is encountered. For each input line, From 52966f07801bdd34b47dae46f8ff3f4fb3a9751e Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 20:03:32 -0700 Subject: [PATCH 11/74] formatting --- src/apps/miscapps/cellToLatLngHier.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/apps/miscapps/cellToLatLngHier.c b/src/apps/miscapps/cellToLatLngHier.c index f5911f6b6..23703da68 100644 --- a/src/apps/miscapps/cellToLatLngHier.c +++ b/src/apps/miscapps/cellToLatLngHier.c @@ -37,7 +37,8 @@ * - outputs the cell center point in lat/lon for cell * `836e9bfffffffff` as plain text * - * `cellToLatLngHier --parent 820ceffffffffff --resolution 4 --kml > pts.kml` + * `cellToLatLngHier --parent 820ceffffffffff --resolution 4 --kml > + * pts.kml` * - outputs the cell center points of all of the resolution 4 * descendants of cell `820ceffffffffff` as a KML file (redirected to * `pts.kml`). From 9c66737eee87a09679d2e086a57381c8b8269340 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 20:08:29 -0700 Subject: [PATCH 12/74] rename files --- CMakeLists.txt | 10 +++++----- .../{fuzzerPointToCell.c => fuzzerLatLngToCell.c} | 0 .../testapps/{testPointToCell.c => testLatLngToCell.c} | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) rename src/apps/fuzzers/{fuzzerPointToCell.c => fuzzerLatLngToCell.c} (100%) rename src/apps/testapps/{testPointToCell.c => testLatLngToCell.c} (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07e2acf93..76b2db426 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,7 +172,7 @@ set(OTHER_SOURCE_FILES src/apps/testapps/testCellToParent.c src/apps/testapps/testH3Index.c src/apps/testapps/mkRandGeoBoundary.c - src/apps/testapps/testPointToCell.c + src/apps/testapps/testLatLngToCell.c src/apps/testapps/testH3NeighborRotations.c src/apps/testapps/testCellToChildrenSize.c src/apps/testapps/testGridDisksUnsafe.c @@ -213,7 +213,7 @@ set(OTHER_SOURCE_FILES src/apps/miscapps/generatePentagonDirectionFaces.c src/apps/miscapps/generateFaceCenterPoint.c src/apps/miscapps/h3ToHier.c - src/apps/fuzzers/fuzzerPointToCell.c + src/apps/fuzzers/fuzzerLatLngToCell.c src/apps/fuzzers/fuzzerCellToLatLng.c src/apps/fuzzers/fuzzerGridDisk.c src/apps/benchmarks/benchmarkPolygonToCells.c @@ -550,7 +550,7 @@ if(H3_IS_ROOT_PROJECT AND BUILD_TESTING) # Add each individual test file(GLOB all_centers tests/inputfiles/bc*centers.txt) foreach(file ${all_centers}) - add_h3_test_with_file(testPointToCell src/apps/testapps/testPointToCell.c ${file}) + add_h3_test_with_file(testLatLngToCell src/apps/testapps/testLatLngToCell.c ${file}) endforeach() file(GLOB all_ic_files tests/inputfiles/res*ic.txt) @@ -560,7 +560,7 @@ if(H3_IS_ROOT_PROJECT AND BUILD_TESTING) file(GLOB all_centers tests/inputfiles/rand*centers.txt) foreach(file ${all_centers}) - add_h3_test_with_file(testPointToCell src/apps/testapps/testPointToCell.c ${file}) + add_h3_test_with_file(testLatLngToCell src/apps/testapps/testLatLngToCell.c ${file}) endforeach() file(GLOB all_cells tests/inputfiles/*cells.txt) @@ -632,7 +632,7 @@ if(BUILD_FUZZERS) add_dependencies(fuzzers ${name}) endmacro() - add_h3_fuzzer(fuzzerPointToCell src/apps/fuzzers/fuzzerPointToCell.c) + add_h3_fuzzer(fuzzerLatLngToCell src/apps/fuzzers/fuzzerLatLngToCell.c) add_h3_fuzzer(fuzzerCellToLatLng src/apps/fuzzers/fuzzerCellToLatLng.c) add_h3_fuzzer(fuzzerGridDisk src/apps/fuzzers/fuzzerGridDisk.c) endif() diff --git a/src/apps/fuzzers/fuzzerPointToCell.c b/src/apps/fuzzers/fuzzerLatLngToCell.c similarity index 100% rename from src/apps/fuzzers/fuzzerPointToCell.c rename to src/apps/fuzzers/fuzzerLatLngToCell.c diff --git a/src/apps/testapps/testPointToCell.c b/src/apps/testapps/testLatLngToCell.c similarity index 98% rename from src/apps/testapps/testPointToCell.c rename to src/apps/testapps/testLatLngToCell.c index 1c98ae57e..5831dcead 100644 --- a/src/apps/testapps/testPointToCell.c +++ b/src/apps/testapps/testLatLngToCell.c @@ -16,7 +16,7 @@ /** @file * @brief tests H3 function `latLngToCell` * - * usage: `testPointToCell` + * usage: `testLatLngToCell` * * The program reads lines containing H3 indexes and lat/lon pairs from * stdin until EOF is encountered. For each input line, it calls `latLngToCell` From 336eae49b13bd15c6591b0a41a284bf3ddc64b7e Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 20:15:42 -0700 Subject: [PATCH 13/74] vertexToPoint --- src/apps/testapps/testVertexExhaustive.c | 2 +- src/h3lib/include/h3api.h.in | 6 +++--- src/h3lib/lib/vertex.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apps/testapps/testVertexExhaustive.c b/src/apps/testapps/testVertexExhaustive.c index 22632dcab..ada7255f9 100644 --- a/src/apps/testapps/testVertexExhaustive.c +++ b/src/apps/testapps/testVertexExhaustive.c @@ -43,7 +43,7 @@ static void cellToVertex_point_assertions(H3Index h3) { GeoPoint coord; for (int i = 0; i < numVerts; i++) { H3Index vertex = H3_EXPORT(cellToVertex)(h3, i); - H3_EXPORT(vertexToPoint)(vertex, &coord); + H3_EXPORT(vertexToLatLng)(vertex, &coord); int almostEqual = geoAlmostEqualThreshold(&gb.verts[i], &coord, 0.000001); t_assert(almostEqual, "Vertex coordinates match boundary vertex"); diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index 0878176fd..eabc9b81d 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -675,12 +675,12 @@ DECLSPEC H3Index H3_EXPORT(cellToVertex)(H3Index origin, int vertexNum); DECLSPEC void H3_EXPORT(cellToVertexes)(H3Index origin, H3Index *vertexes); /** @} */ -/** @defgroup vertexToPoint vertexToPoint - * Functions for vertexToPoint +/** @defgroup vertexToLatLng vertexToLatLng + * Functions for vertexToLatLng * @{ */ /** @brief Returns a single vertex for a given cell, as an H3 index */ -DECLSPEC void H3_EXPORT(vertexToPoint)(H3Index vertex, GeoPoint *point); +DECLSPEC void H3_EXPORT(vertexToLatLng)(H3Index vertex, GeoPoint *point); /** @} */ /** @defgroup isValidVertex isValidVertex diff --git a/src/h3lib/lib/vertex.c b/src/h3lib/lib/vertex.c index 1718821fc..8486c64f4 100644 --- a/src/h3lib/lib/vertex.c +++ b/src/h3lib/lib/vertex.c @@ -285,7 +285,7 @@ void H3_EXPORT(cellToVertexes)(H3Index cell, H3Index* vertexes) { * @param vertex H3 index describing a vertex * @param coord Output geo coordinate */ -void H3_EXPORT(vertexToPoint)(H3Index vertex, GeoPoint* coord) { +void H3_EXPORT(vertexToLatLng)(H3Index vertex, GeoPoint* coord) { // Get the vertex number and owner from the vertex int vertexNum = H3_GET_RESERVED_BITS(vertex); H3Index owner = vertex; From 59537db254e731366122b6892da8e7317e2771d4 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 20:21:53 -0700 Subject: [PATCH 14/74] LinkedGeoPoint --- src/apps/testapps/testLinkedGeo.c | 2 +- src/h3lib/include/h3api.h.in | 12 ++++++------ src/h3lib/include/linkedGeo.h | 6 +++--- src/h3lib/lib/linkedGeo.c | 14 +++++++------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/apps/testapps/testLinkedGeo.c b/src/apps/testapps/testLinkedGeo.c index cfcc8f555..c94136cdc 100644 --- a/src/apps/testapps/testLinkedGeo.c +++ b/src/apps/testapps/testLinkedGeo.c @@ -37,7 +37,7 @@ SUITE(linkedGeo) { TEST(createLinkedGeo) { LinkedGeoPolygon* polygon = calloc(1, sizeof(LinkedGeoPolygon)); LinkedGeoLoop* loop; - LinkedGeoPoint* coord; + LinkedLatLng* coord; loop = addNewLinkedLoop(polygon); t_assert(loop != NULL, "Loop created"); diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index eabc9b81d..cfdb9c697 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -162,13 +162,13 @@ typedef struct { GeoPolygon *polygons; } GeoMultiPolygon; -/** @struct LinkedGeoPoint +/** @struct LinkedLatLng * @brief A coordinate node in a linked geo structure, part of a linked list */ -typedef struct LinkedGeoPoint LinkedGeoPoint; -struct LinkedGeoPoint { +typedef struct LinkedLatLng LinkedLatLng; +struct LinkedLatLng { GeoPoint vertex; - LinkedGeoPoint *next; + LinkedLatLng *next; }; /** @struct LinkedGeoLoop @@ -176,8 +176,8 @@ struct LinkedGeoPoint { */ typedef struct LinkedGeoLoop LinkedGeoLoop; struct LinkedGeoLoop { - LinkedGeoPoint *first; - LinkedGeoPoint *last; + LinkedLatLng *first; + LinkedLatLng *last; LinkedGeoLoop *next; }; diff --git a/src/h3lib/include/linkedGeo.h b/src/h3lib/include/linkedGeo.h index 5b1b89f2c..2904d3d2d 100644 --- a/src/h3lib/include/linkedGeo.h +++ b/src/h3lib/include/linkedGeo.h @@ -34,8 +34,8 @@ // Macros for use with polygonAlgos.h /** Macro: Init iteration vars for LinkedGeoLoop */ #define INIT_ITERATION_LINKED_LOOP \ - LinkedGeoPoint* currentCoord = NULL; \ - LinkedGeoPoint* nextCoord = NULL + LinkedLatLng* currentCoord = NULL; \ + LinkedLatLng* nextCoord = NULL /** Macro: Get the next coord in a linked loop, wrapping if needed */ #define GET_NEXT_COORD(loop, coordToCheck) \ @@ -56,7 +56,7 @@ int normalizeMultiPolygon(LinkedGeoPolygon* root); LinkedGeoPolygon* addNewLinkedPolygon(LinkedGeoPolygon* polygon); LinkedGeoLoop* addNewLinkedLoop(LinkedGeoPolygon* polygon); LinkedGeoLoop* addLinkedLoop(LinkedGeoPolygon* polygon, LinkedGeoLoop* loop); -LinkedGeoPoint* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint* vertex); +LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint* vertex); int countLinkedPolygons(LinkedGeoPolygon* polygon); int countLinkedLoops(LinkedGeoPolygon* polygon); int countLinkedCoords(LinkedGeoLoop* loop); diff --git a/src/h3lib/lib/linkedGeo.c b/src/h3lib/lib/linkedGeo.c index c0afed4fd..6870a69ef 100644 --- a/src/h3lib/lib/linkedGeo.c +++ b/src/h3lib/lib/linkedGeo.c @@ -73,11 +73,11 @@ LinkedGeoLoop* addLinkedLoop(LinkedGeoPolygon* polygon, LinkedGeoLoop* loop) { * @param vertex Coordinate to add * @return Pointer to the coordinate */ -LinkedGeoPoint* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint* vertex) { - LinkedGeoPoint* coord = H3_MEMORY(malloc)(sizeof(*coord)); +LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint* vertex) { + LinkedLatLng* coord = H3_MEMORY(malloc)(sizeof(*coord)); assert(coord != NULL); - *coord = (LinkedGeoPoint){.vertex = *vertex, .next = NULL}; - LinkedGeoPoint* last = loop->last; + *coord = (LinkedLatLng){.vertex = *vertex, .next = NULL}; + LinkedLatLng* last = loop->last; if (last == NULL) { assert(loop->first == NULL); loop->first = coord; @@ -94,8 +94,8 @@ LinkedGeoPoint* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint* vertex) { * @param loop Loop to free */ void destroyLinkedGeoLoop(LinkedGeoLoop* loop) { - LinkedGeoPoint* nextCoord; - for (LinkedGeoPoint* currentCoord = loop->first; currentCoord != NULL; + LinkedLatLng* nextCoord; + for (LinkedLatLng* currentCoord = loop->first; currentCoord != NULL; currentCoord = nextCoord) { nextCoord = currentCoord->next; H3_MEMORY(free)(currentCoord); @@ -165,7 +165,7 @@ int countLinkedLoops(LinkedGeoPolygon* polygon) { * @return Count */ int countLinkedCoords(LinkedGeoLoop* loop) { - LinkedGeoPoint* coord = loop->first; + LinkedLatLng* coord = loop->first; int count = 0; while (coord != NULL) { count++; From 4aad73dcd68f1f8808f7e5cfdd3b8e87be2933a5 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 20:30:00 -0700 Subject: [PATCH 15/74] formatting --- src/h3lib/include/linkedGeo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/h3lib/include/linkedGeo.h b/src/h3lib/include/linkedGeo.h index 2904d3d2d..cc5fffb6e 100644 --- a/src/h3lib/include/linkedGeo.h +++ b/src/h3lib/include/linkedGeo.h @@ -33,7 +33,7 @@ // Macros for use with polygonAlgos.h /** Macro: Init iteration vars for LinkedGeoLoop */ -#define INIT_ITERATION_LINKED_LOOP \ +#define INIT_ITERATION_LINKED_LOOP \ LinkedLatLng* currentCoord = NULL; \ LinkedLatLng* nextCoord = NULL From 1818f8d0ff7f7cfacece5119a38a2f15b4ed47c6 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 20:43:16 -0700 Subject: [PATCH 16/74] move `*` --- src/h3lib/include/geoPoint.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/h3lib/include/geoPoint.h b/src/h3lib/include/geoPoint.h index 2d278fe4c..2442f08a3 100644 --- a/src/h3lib/include/geoPoint.h +++ b/src/h3lib/include/geoPoint.h @@ -32,20 +32,20 @@ /** epsilon of ~0.1mm in radians */ #define EPSILON_RAD (EPSILON_DEG * M_PI_180) -void setGeoDegs(GeoPoint* p, double latDegs, double lonDegs); +void setGeoDegs(GeoPoint *p, double latDegs, double lonDegs); double constrainLat(double lat); double constrainLng(double lng); -bool geoAlmostEqual(const GeoPoint* p1, const GeoPoint* p2); -bool geoAlmostEqualThreshold(const GeoPoint* p1, const GeoPoint* p2, +bool geoAlmostEqual(const GeoPoint *p1, const GeoPoint *p2); +bool geoAlmostEqualThreshold(const GeoPoint *p1, const GeoPoint *p2, double threshold); // Internal functions double _posAngleRads(double rads); -void _setGeoRads(GeoPoint* p, double latRads, double lonRads); -double _geoAzimuthRads(const GeoPoint* p1, const GeoPoint* p2); -void _geoAzDistanceRads(const GeoPoint* p1, double az, double distance, - GeoPoint* p2); +void _setGeoRads(GeoPoint *p, double latRads, double lonRads); +double _geoAzimuthRads(const GeoPoint *p1, const GeoPoint *p2); +void _geoAzDistanceRads(const GeoPoint *p1, double az, double distance, + GeoPoint *p2); #endif From d9fc021b9af2e0bd67fb06fdce0b12559272c378 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 20:45:11 -0700 Subject: [PATCH 17/74] move `*` again --- src/apps/applib/include/kml.h | 6 +++--- src/apps/applib/include/utility.h | 18 +++++++++--------- src/apps/applib/lib/kml.c | 8 ++++---- src/apps/applib/lib/utility.c | 16 ++++++++-------- src/apps/testapps/testBBox.c | 2 +- src/apps/testapps/testCellToLatLng.c | 2 +- src/apps/testapps/testLatLngToCell.c | 2 +- src/apps/testapps/testPolygon.c | 2 +- src/apps/testapps/testPolygonToCells.c | 2 +- src/h3lib/include/bbox.h | 6 +++--- src/h3lib/include/faceijk.h | 8 ++++---- src/h3lib/include/linkedGeo.h | 4 ++-- src/h3lib/include/polygon.h | 4 ++-- src/h3lib/include/polygonAlgos.h | 2 +- src/h3lib/include/vec3d.h | 2 +- src/h3lib/include/vertexGraph.h | 16 ++++++++-------- src/h3lib/lib/algos.c | 4 ++-- src/h3lib/lib/bbox.c | 6 +++--- src/h3lib/lib/faceijk.c | 8 ++++---- src/h3lib/lib/h3Index.c | 4 ++-- src/h3lib/lib/linkedGeo.c | 2 +- src/h3lib/lib/polygon.c | 2 +- src/h3lib/lib/vec3d.c | 2 +- src/h3lib/lib/vertex.c | 2 +- src/h3lib/lib/vertexGraph.c | 16 ++++++++-------- 25 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/apps/applib/include/kml.h b/src/apps/applib/include/kml.h index ff093c3ab..6ca1b196e 100644 --- a/src/apps/applib/include/kml.h +++ b/src/apps/applib/include/kml.h @@ -31,9 +31,9 @@ void kmlPtsFooter(void); void kmlBoundaryFooter(void); // output KML individual points or polygons -void outputLatLonKML(const GeoPoint* g); -void outputPointKML(const GeoPoint* g, const char* name); -void outputTriKML(const GeoPoint* v1, const GeoPoint* v2, const GeoPoint* v3, +void outputLatLonKML(const GeoPoint *g); +void outputPointKML(const GeoPoint *g, const char* name); +void outputTriKML(const GeoPoint *v1, const GeoPoint *v2, const GeoPoint *v3, const char* name); void outputPolyKML(const GeoPoint geoVerts[], int numVerts, const char* name); void outputBoundaryKML(const CellBoundary* b, const char* name); diff --git a/src/apps/applib/include/utility.h b/src/apps/applib/include/utility.h index 480da30ce..8b5357cc8 100644 --- a/src/apps/applib/include/utility.h +++ b/src/apps/applib/include/utility.h @@ -36,18 +36,18 @@ void h3Println(H3Index h); // prints as integer void coordIjkPrint(const CoordIJK* c); -void geoToStringRads(const GeoPoint* p, char* str); -void geoToStringDegs(const GeoPoint* p, char* str); -void geoToStringDegsNoFmt(const GeoPoint* p, char* str); - -void geoPrint(const GeoPoint* p); -void geoPrintln(const GeoPoint* p); -void geoPrintNoFmt(const GeoPoint* p); -void geoPrintlnNoFmt(const GeoPoint* p); +void geoToStringRads(const GeoPoint *p, char* str); +void geoToStringDegs(const GeoPoint *p, char* str); +void geoToStringDegsNoFmt(const GeoPoint *p, char* str); + +void geoPrint(const GeoPoint *p); +void geoPrintln(const GeoPoint *p); +void geoPrintNoFmt(const GeoPoint *p); +void geoPrintlnNoFmt(const GeoPoint *p); void cellBoundaryPrint(const CellBoundary* b); void cellBoundaryPrintln(const CellBoundary* b); -void randomGeo(GeoPoint* p); +void randomGeo(GeoPoint *p); void iterateAllIndexesAtRes(int res, void (*callback)(H3Index)); void iterateAllIndexesAtResPartial(int res, void (*callback)(H3Index), diff --git a/src/apps/applib/lib/kml.c b/src/apps/applib/lib/kml.c index 84eebeed6..0902698d9 100644 --- a/src/apps/applib/lib/kml.c +++ b/src/apps/applib/lib/kml.c @@ -107,12 +107,12 @@ void kmlBoundaryFooter(void) { printf("\n"); } -void outputLatLonKML(const GeoPoint* g) { +void outputLatLonKML(const GeoPoint *g) { printf(" %8lf,%8lf,5.0\n", H3_EXPORT(radsToDegs)(g->lon), H3_EXPORT(radsToDegs)(g->lat)); } -void outputPointKML(const GeoPoint* g, const char* name) { +void outputPointKML(const GeoPoint *g, const char* name) { printf("\n"); printf(" %s\n", name); printf(" #m_ylw-pushpin\n"); @@ -125,7 +125,7 @@ void outputPointKML(const GeoPoint* g, const char* name) { printf("\n"); } -void outputTriKML(const GeoPoint* v1, const GeoPoint* v2, const GeoPoint* v3, +void outputTriKML(const GeoPoint *v1, const GeoPoint *v2, const GeoPoint *v3, const char* name) { printf("\n"); printf("%s\n", name); @@ -143,7 +143,7 @@ void outputTriKML(const GeoPoint* v1, const GeoPoint* v2, const GeoPoint* v3, } void outputBoundaryKML(const CellBoundary* b, const char* name) { - const GeoPoint* v = (const GeoPoint*)&(b->verts); + const GeoPoint *v = (const GeoPoint*)&(b->verts); outputPolyKML(v, b->numVerts, name); } diff --git a/src/apps/applib/lib/utility.c b/src/apps/applib/lib/utility.c index 1eb8cb6f5..cf3682050 100644 --- a/src/apps/applib/lib/utility.c +++ b/src/apps/applib/lib/utility.c @@ -56,14 +56,14 @@ void coordIjkPrint(const CoordIJK* c) { /** * Assumes `str` is big enough to hold the result. */ -void geoToStringRads(const GeoPoint* p, char* str) { +void geoToStringRads(const GeoPoint *p, char* str) { sprintf(str, "(%.4lf, %.4lf)", p->lat, p->lon); } /** * Assumes `str` is big enough to hold the result. */ -void geoToStringDegs(const GeoPoint* p, char* str) { +void geoToStringDegs(const GeoPoint *p, char* str) { sprintf(str, "(%.9lf, %.9lf)", H3_EXPORT(radsToDegs)(p->lat), H3_EXPORT(radsToDegs)(p->lon)); } @@ -71,29 +71,29 @@ void geoToStringDegs(const GeoPoint* p, char* str) { /** * Assumes `str` is big enough to hold the result. */ -void geoToStringDegsNoFmt(const GeoPoint* p, char* str) { +void geoToStringDegsNoFmt(const GeoPoint *p, char* str) { sprintf(str, "%.9lf %.9lf", H3_EXPORT(radsToDegs)(p->lat), H3_EXPORT(radsToDegs)(p->lon)); } -void geoPrint(const GeoPoint* p) { +void geoPrint(const GeoPoint *p) { char buff[BUFF_SIZE]; geoToStringDegs(p, buff); printf("%s", buff); } -void geoPrintln(const GeoPoint* p) { +void geoPrintln(const GeoPoint *p) { geoPrint(p); printf("\n"); } -void geoPrintNoFmt(const GeoPoint* p) { +void geoPrintNoFmt(const GeoPoint *p) { char buff[BUFF_SIZE]; geoToStringDegsNoFmt(p, buff); printf("%s", buff); } -void geoPrintlnNoFmt(const GeoPoint* p) { +void geoPrintlnNoFmt(const GeoPoint *p) { geoPrintNoFmt(p); printf("\n"); } @@ -171,7 +171,7 @@ void iterateBaseCellIndexesAtRes(int res, void (*callback)(H3Index), * * @param g Lat/lon will be placed here. */ -void randomGeo(GeoPoint* g) { +void randomGeo(GeoPoint *g) { static int init = 0; if (!init) { srand((unsigned int)time(0)); diff --git a/src/apps/testapps/testBBox.c b/src/apps/testapps/testBBox.c index 794fbfed8..9f052093e 100644 --- a/src/apps/testapps/testBBox.c +++ b/src/apps/testapps/testBBox.c @@ -24,7 +24,7 @@ #include "test.h" void assertBBox(const GeoLoop* geoloop, const BBox* expected, - const GeoPoint* inside, const GeoPoint* outside) { + const GeoPoint *inside, const GeoPoint *outside) { BBox result; bboxFromGeoLoop(geoloop, &result); diff --git a/src/apps/testapps/testCellToLatLng.c b/src/apps/testapps/testCellToLatLng.c index 65bf46a38..d0d2f290a 100644 --- a/src/apps/testapps/testCellToLatLng.c +++ b/src/apps/testapps/testCellToLatLng.c @@ -33,7 +33,7 @@ #include "test.h" #include "utility.h" -void assertExpected(H3Index h1, const GeoPoint* g1) { +void assertExpected(H3Index h1, const GeoPoint *g1) { const double epsilon = 0.000001 * M_PI_180; // convert H3 to lat/lon and verify GeoPoint g2; diff --git a/src/apps/testapps/testLatLngToCell.c b/src/apps/testapps/testLatLngToCell.c index 5831dcead..9e61bf8d3 100644 --- a/src/apps/testapps/testLatLngToCell.c +++ b/src/apps/testapps/testLatLngToCell.c @@ -32,7 +32,7 @@ #include "test.h" #include "utility.h" -static void assertExpected(H3Index h1, const GeoPoint* g1) { +static void assertExpected(H3Index h1, const GeoPoint *g1) { // convert lat/lon to H3 and verify int res = H3_EXPORT(getResolution)(h1); H3Index h2; diff --git a/src/apps/testapps/testPolygon.c b/src/apps/testapps/testPolygon.c index 0cf91e5ad..8fb51dbc5 100644 --- a/src/apps/testapps/testPolygon.c +++ b/src/apps/testapps/testPolygon.c @@ -31,7 +31,7 @@ static GeoPoint sfVerts[] = { {0.6583348114025, -2.1354884206045}, {0.6581220034068, -2.1382437718946}, {0.6594479998527, -2.1384597563896}, {0.6599990002976, -2.1376771158464}}; -static void createLinkedLoop(LinkedGeoLoop* loop, GeoPoint* verts, +static void createLinkedLoop(LinkedGeoLoop* loop, GeoPoint *verts, int numVerts) { *loop = (LinkedGeoLoop){0}; for (int i = 0; i < numVerts; i++) { diff --git a/src/apps/testapps/testPolygonToCells.c b/src/apps/testapps/testPolygonToCells.c index 762671111..6f7fa0270 100644 --- a/src/apps/testapps/testPolygonToCells.c +++ b/src/apps/testapps/testPolygonToCells.c @@ -178,7 +178,7 @@ SUITE(polygonToCells) { CellBoundary boundary; H3_EXPORT(cellToBoundary)(origin, &boundary); - GeoPoint* verts = calloc(boundary.numVerts + 1, sizeof(GeoPoint)); + GeoPoint *verts = calloc(boundary.numVerts + 1, sizeof(GeoPoint)); for (int i = 0; i < boundary.numVerts; i++) { verts[i] = boundary.verts[i]; } diff --git a/src/h3lib/include/bbox.h b/src/h3lib/include/bbox.h index b9d748677..41fd23d12 100644 --- a/src/h3lib/include/bbox.h +++ b/src/h3lib/include/bbox.h @@ -35,11 +35,11 @@ typedef struct { } BBox; bool bboxIsTransmeridian(const BBox* bbox); -void bboxCenter(const BBox* bbox, GeoPoint* center); -bool bboxContains(const BBox* bbox, const GeoPoint* point); +void bboxCenter(const BBox* bbox, GeoPoint *center); +bool bboxContains(const BBox* bbox, const GeoPoint *point); bool bboxEquals(const BBox* b1, const BBox* b2); int bboxHexEstimate(const BBox* bbox, int res); -int lineHexEstimate(const GeoPoint* origin, const GeoPoint* destination, +int lineHexEstimate(const GeoPoint *origin, const GeoPoint *destination, int res); #endif diff --git a/src/h3lib/include/faceijk.h b/src/h3lib/include/faceijk.h index f6b1da7fa..3aaf4fc35 100644 --- a/src/h3lib/include/faceijk.h +++ b/src/h3lib/include/faceijk.h @@ -72,16 +72,16 @@ typedef enum { // Internal functions -void _geoToFaceIjk(const GeoPoint* g, int res, FaceIJK* h); -void _geoToHex2d(const GeoPoint* g, int res, int* face, Vec2d* v); -void _faceIjkToGeo(const FaceIJK* h, int res, GeoPoint* g); +void _geoToFaceIjk(const GeoPoint *g, int res, FaceIJK* h); +void _geoToHex2d(const GeoPoint *g, int res, int* face, Vec2d* v); +void _faceIjkToGeo(const FaceIJK* h, int res, GeoPoint *g); void _faceIjkToCellBoundary(const FaceIJK* h, int res, int start, int length, CellBoundary* g); void _faceIjkPentToCellBoundary(const FaceIJK* h, int res, int start, int length, CellBoundary* g); void _faceIjkToVerts(FaceIJK* fijk, int* res, FaceIJK* fijkVerts); void _faceIjkPentToVerts(FaceIJK* fijk, int* res, FaceIJK* fijkVerts); -void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, GeoPoint* g); +void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, GeoPoint *g); Overage _adjustOverageClassII(FaceIJK* fijk, int res, int pentLeading4, int substrate); Overage _adjustPentVertOverage(FaceIJK* fijk, int res); diff --git a/src/h3lib/include/linkedGeo.h b/src/h3lib/include/linkedGeo.h index cc5fffb6e..fff1c4aec 100644 --- a/src/h3lib/include/linkedGeo.h +++ b/src/h3lib/include/linkedGeo.h @@ -56,7 +56,7 @@ int normalizeMultiPolygon(LinkedGeoPolygon* root); LinkedGeoPolygon* addNewLinkedPolygon(LinkedGeoPolygon* polygon); LinkedGeoLoop* addNewLinkedLoop(LinkedGeoPolygon* polygon); LinkedGeoLoop* addLinkedLoop(LinkedGeoPolygon* polygon, LinkedGeoLoop* loop); -LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint* vertex); +LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint *vertex); int countLinkedPolygons(LinkedGeoPolygon* polygon); int countLinkedLoops(LinkedGeoPolygon* polygon); int countLinkedCoords(LinkedGeoLoop* loop); @@ -81,7 +81,7 @@ void bboxFromLinkedGeoLoop(const LinkedGeoLoop* loop, BBox* bbox); * @return Whether the point is contained */ bool pointInsideLinkedGeoLoop(const LinkedGeoLoop* loop, const BBox* bbox, - const GeoPoint* coord); + const GeoPoint *coord); /** * Whether the winding order of a given LinkedGeoLoop is clockwise diff --git a/src/h3lib/include/polygon.h b/src/h3lib/include/polygon.h index a81a708c0..5a997d6c8 100644 --- a/src/h3lib/include/polygon.h +++ b/src/h3lib/include/polygon.h @@ -43,7 +43,7 @@ // Defined directly in polygon.c: void bboxesFromGeoPolygon(const GeoPolygon* polygon, BBox* bboxes); bool pointInsidePolygon(const GeoPolygon* geoPolygon, const BBox* bboxes, - const GeoPoint* coord); + const GeoPoint *coord); // The following functions are created via macro in polygonAlgos.h, // so their signatures are documented here: @@ -64,7 +64,7 @@ void bboxFromGeoLoop(const GeoLoop* loop, BBox* bbox); * @return Whether the point is contained */ bool pointInsideGeoLoop(const GeoLoop* loop, const BBox* bbox, - const GeoPoint* coord); + const GeoPoint *coord); /** * Whether the winding order of a given GeoLoop is clockwise diff --git a/src/h3lib/include/polygonAlgos.h b/src/h3lib/include/polygonAlgos.h index 0fc792b14..42f3051a7 100644 --- a/src/h3lib/include/polygonAlgos.h +++ b/src/h3lib/include/polygonAlgos.h @@ -65,7 +65,7 @@ * @return Whether the point is contained */ bool GENERIC_LOOP_ALGO(pointInside)(const TYPE* loop, const BBox* bbox, - const GeoPoint* coord) { + const GeoPoint *coord) { // fail fast if we're outside the bounding box if (!bboxContains(bbox, coord)) { return false; diff --git a/src/h3lib/include/vec3d.h b/src/h3lib/include/vec3d.h index bb765dd93..1a2b56afb 100644 --- a/src/h3lib/include/vec3d.h +++ b/src/h3lib/include/vec3d.h @@ -31,7 +31,7 @@ typedef struct { double z; ///< z component } Vec3d; -void _geoToVec3d(const GeoPoint* geo, Vec3d* point); +void _geoToVec3d(const GeoPoint *geo, Vec3d* point); double _pointSquareDist(const Vec3d* p1, const Vec3d* p2); #endif diff --git a/src/h3lib/include/vertexGraph.h b/src/h3lib/include/vertexGraph.h index 77558e192..86a2ab642 100644 --- a/src/h3lib/include/vertexGraph.h +++ b/src/h3lib/include/vertexGraph.h @@ -49,22 +49,22 @@ void initVertexGraph(VertexGraph* graph, int numBuckets, int res); void destroyVertexGraph(VertexGraph* graph); -VertexNode* addVertexNode(VertexGraph* graph, const GeoPoint* fromVtx, - const GeoPoint* toVtx); +VertexNode* addVertexNode(VertexGraph* graph, const GeoPoint *fromVtx, + const GeoPoint *toVtx); int removeVertexNode(VertexGraph* graph, VertexNode* node); -VertexNode* findNodeForEdge(const VertexGraph* graph, const GeoPoint* fromVtx, - const GeoPoint* toVtx); +VertexNode* findNodeForEdge(const VertexGraph* graph, const GeoPoint *fromVtx, + const GeoPoint *toVtx); VertexNode* findNodeForVertex(const VertexGraph* graph, - const GeoPoint* fromVtx); + const GeoPoint *fromVtx); VertexNode* firstVertexNode(const VertexGraph* graph); // Internal functions -uint32_t _hashVertex(const GeoPoint* vertex, int res, int numBuckets); -void _initVertexNode(VertexNode* node, const GeoPoint* fromVtx, - const GeoPoint* toVtx); +uint32_t _hashVertex(const GeoPoint *vertex, int res, int numBuckets); +void _initVertexNode(VertexNode* node, const GeoPoint *fromVtx, + const GeoPoint *toVtx); #endif diff --git a/src/h3lib/lib/algos.c b/src/h3lib/lib/algos.c index 8672772c5..0c0f8bd42 100644 --- a/src/h3lib/lib/algos.c +++ b/src/h3lib/lib/algos.c @@ -1007,8 +1007,8 @@ int _polygonToCellsInternal(const GeoPolygon* geoPolygon, int res, void h3SetToVertexGraph(const H3Index* h3Set, const int numHexes, VertexGraph* graph) { CellBoundary vertices; - GeoPoint* fromVtx; - GeoPoint* toVtx; + GeoPoint *fromVtx; + GeoPoint *toVtx; VertexNode* edge; if (numHexes < 1) { // We still need to init the graph, or calls to destroyVertexGraph will diff --git a/src/h3lib/lib/bbox.c b/src/h3lib/lib/bbox.c index c8efec448..8c998526b 100644 --- a/src/h3lib/lib/bbox.c +++ b/src/h3lib/lib/bbox.c @@ -39,7 +39,7 @@ bool bboxIsTransmeridian(const BBox* bbox) { return bbox->east < bbox->west; } * @param bbox Input bounding box * @param center Output center coordinate */ -void bboxCenter(const BBox* bbox, GeoPoint* center) { +void bboxCenter(const BBox* bbox, GeoPoint *center) { center->lat = (bbox->north + bbox->south) / 2.0; // If the bbox crosses the antimeridian, shift east 360 degrees double east = bboxIsTransmeridian(bbox) ? bbox->east + M_2PI : bbox->east; @@ -52,7 +52,7 @@ void bboxCenter(const BBox* bbox, GeoPoint* center) { * @param point Point to test * @return Whether the point is contained */ -bool bboxContains(const BBox* bbox, const GeoPoint* point) { +bool bboxContains(const BBox* bbox, const GeoPoint *point) { return point->lat >= bbox->south && point->lat <= bbox->north && (bboxIsTransmeridian(bbox) ? // transmeridian case @@ -136,7 +136,7 @@ int bboxHexEstimate(const BBox* bbox, int res) { * @param res the resolution of the H3 hexagons to trace the line * @return the estimated number of hexagons required to trace the line */ -int lineHexEstimate(const GeoPoint* origin, const GeoPoint* destination, +int lineHexEstimate(const GeoPoint *origin, const GeoPoint *destination, int res) { // Get the area of the pentagon as the maximally-distorted area possible H3Index pentagons[12] = {0}; diff --git a/src/h3lib/lib/faceijk.c b/src/h3lib/lib/faceijk.c index 799c3595d..6b66a1ba1 100644 --- a/src/h3lib/lib/faceijk.c +++ b/src/h3lib/lib/faceijk.c @@ -368,7 +368,7 @@ static const int unitScaleByCIIres[] = { * @param res The desired H3 resolution for the encoding. * @param h The FaceIJK address of the containing cell at resolution res. */ -void _geoToFaceIjk(const GeoPoint* g, int res, FaceIJK* h) { +void _geoToFaceIjk(const GeoPoint *g, int res, FaceIJK* h) { // first convert to hex2d Vec2d v; _geoToHex2d(g, res, &h->face, &v); @@ -386,7 +386,7 @@ void _geoToFaceIjk(const GeoPoint* g, int res, FaceIJK* h) { * @param face The icosahedral face containing the spherical coordinates. * @param v The 2D hex coordinates of the cell containing the point. */ -void _geoToHex2d(const GeoPoint* g, int res, int* face, Vec2d* v) { +void _geoToHex2d(const GeoPoint *g, int res, int* face, Vec2d* v) { Vec3d v3d; _geoToVec3d(g, &v3d); @@ -445,7 +445,7 @@ void _geoToHex2d(const GeoPoint* g, int res, int* face, Vec2d* v) { * @param g The spherical coordinates of the cell center point. */ void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, - GeoPoint* g) { + GeoPoint *g) { // calculate (r, theta) in hex2d double r = _v2dMag(v); @@ -490,7 +490,7 @@ void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, * @param res The H3 resolution of the cell. * @param g The spherical coordinates of the cell center point. */ -void _faceIjkToGeo(const FaceIJK* h, int res, GeoPoint* g) { +void _faceIjkToGeo(const FaceIJK* h, int res, GeoPoint *g) { Vec2d v; _ijkToHex2d(&h->coord, &v); _hex2dToGeo(&v, h->face, res, 0, g); diff --git a/src/h3lib/lib/h3Index.c b/src/h3lib/lib/h3Index.c index 6e4da5ca9..ebecc6a45 100644 --- a/src/h3lib/lib/h3Index.c +++ b/src/h3lib/lib/h3Index.c @@ -723,7 +723,7 @@ H3Index _faceIjkToH3(const FaceIJK* fijk, int res) { * @param out The encoded H3Index. * @returns E_SUCCESS (0) on success, another value otherwise */ -H3Error H3_EXPORT(latLngToCell)(const GeoPoint* g, int res, H3Index* out) { +H3Error H3_EXPORT(latLngToCell)(const GeoPoint *g, int res, H3Index* out) { if (res < 0 || res > MAX_H3_RES) { return E_RES_DOMAIN; } @@ -836,7 +836,7 @@ H3Error _h3ToFaceIjk(H3Index h, FaceIJK* fijk) { * @param h3 The H3 index. * @param g The spherical coordinates of the H3 cell center. */ -H3Error H3_EXPORT(cellToLatLng)(H3Index h3, GeoPoint* g) { +H3Error H3_EXPORT(cellToLatLng)(H3Index h3, GeoPoint *g) { FaceIJK fijk; H3Error e = _h3ToFaceIjk(h3, &fijk); if (e) { diff --git a/src/h3lib/lib/linkedGeo.c b/src/h3lib/lib/linkedGeo.c index 6870a69ef..7979132a1 100644 --- a/src/h3lib/lib/linkedGeo.c +++ b/src/h3lib/lib/linkedGeo.c @@ -73,7 +73,7 @@ LinkedGeoLoop* addLinkedLoop(LinkedGeoPolygon* polygon, LinkedGeoLoop* loop) { * @param vertex Coordinate to add * @return Pointer to the coordinate */ -LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint* vertex) { +LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint *vertex) { LinkedLatLng* coord = H3_MEMORY(malloc)(sizeof(*coord)); assert(coord != NULL); *coord = (LinkedLatLng){.vertex = *vertex, .next = NULL}; diff --git a/src/h3lib/lib/polygon.c b/src/h3lib/lib/polygon.c index 0a5cb845f..d4e1d6c1a 100644 --- a/src/h3lib/lib/polygon.c +++ b/src/h3lib/lib/polygon.c @@ -64,7 +64,7 @@ void bboxesFromGeoPolygon(const GeoPolygon* polygon, BBox* bboxes) { * @return Whether the point is contained */ bool pointInsidePolygon(const GeoPolygon* geoPolygon, const BBox* bboxes, - const GeoPoint* coord) { + const GeoPoint *coord) { // Start with contains state of primary geoloop bool contains = pointInsideGeoLoop(&(geoPolygon->geoloop), &bboxes[0], coord); diff --git a/src/h3lib/lib/vec3d.c b/src/h3lib/lib/vec3d.c index 989558c32..21085e568 100644 --- a/src/h3lib/lib/vec3d.c +++ b/src/h3lib/lib/vec3d.c @@ -47,7 +47,7 @@ double _pointSquareDist(const Vec3d* v1, const Vec3d* v2) { * @param geo The latitude and longitude of the point. * @param v The 3D coordinate of the point. */ -void _geoToVec3d(const GeoPoint* geo, Vec3d* v) { +void _geoToVec3d(const GeoPoint *geo, Vec3d* v) { double r = cos(geo->lat); v->z = sin(geo->lat); diff --git a/src/h3lib/lib/vertex.c b/src/h3lib/lib/vertex.c index 8486c64f4..d875d4dc3 100644 --- a/src/h3lib/lib/vertex.c +++ b/src/h3lib/lib/vertex.c @@ -285,7 +285,7 @@ void H3_EXPORT(cellToVertexes)(H3Index cell, H3Index* vertexes) { * @param vertex H3 index describing a vertex * @param coord Output geo coordinate */ -void H3_EXPORT(vertexToLatLng)(H3Index vertex, GeoPoint* coord) { +void H3_EXPORT(vertexToLatLng)(H3Index vertex, GeoPoint *coord) { // Get the vertex number and owner from the vertex int vertexNum = H3_GET_RESERVED_BITS(vertex); H3Index owner = vertex; diff --git a/src/h3lib/lib/vertexGraph.c b/src/h3lib/lib/vertexGraph.c index 49e6f57f7..10dad7110 100644 --- a/src/h3lib/lib/vertexGraph.c +++ b/src/h3lib/lib/vertexGraph.c @@ -70,15 +70,15 @@ void destroyVertexGraph(VertexGraph* graph) { * @param numBuckets Number of buckets in the graph * @return Integer hash */ -uint32_t _hashVertex(const GeoPoint* vertex, int res, int numBuckets) { +uint32_t _hashVertex(const GeoPoint *vertex, int res, int numBuckets) { // Simple hash: Take the sum of the lat and lon with a precision level // determined by the resolution, converted to int, modulo bucket count. return (uint32_t)fmod(fabs((vertex->lat + vertex->lon) * pow(10, 15 - res)), numBuckets); } -void _initVertexNode(VertexNode* node, const GeoPoint* fromVtx, - const GeoPoint* toVtx) { +void _initVertexNode(VertexNode* node, const GeoPoint *fromVtx, + const GeoPoint *toVtx) { node->from = *fromVtx; node->to = *toVtx; node->next = NULL; @@ -91,8 +91,8 @@ void _initVertexNode(VertexNode* node, const GeoPoint* fromVtx, * @param toVtx End vertex * @return Pointer to the new node */ -VertexNode* addVertexNode(VertexGraph* graph, const GeoPoint* fromVtx, - const GeoPoint* toVtx) { +VertexNode* addVertexNode(VertexGraph* graph, const GeoPoint *fromVtx, + const GeoPoint *toVtx) { // Make the new node VertexNode* node = H3_MEMORY(malloc)(sizeof(VertexNode)); assert(node != NULL); @@ -168,8 +168,8 @@ int removeVertexNode(VertexGraph* graph, VertexNode* node) { * @param toVtx End vertex, or NULL if we don't care * @return Pointer to the vertex node, if found */ -VertexNode* findNodeForEdge(const VertexGraph* graph, const GeoPoint* fromVtx, - const GeoPoint* toVtx) { +VertexNode* findNodeForEdge(const VertexGraph* graph, const GeoPoint *fromVtx, + const GeoPoint *toVtx) { // Determine location uint32_t index = _hashVertex(fromVtx, graph->res, graph->numBuckets); // Check whether there's an existing node in that spot @@ -195,7 +195,7 @@ VertexNode* findNodeForEdge(const VertexGraph* graph, const GeoPoint* fromVtx, * @return Pointer to the vertex node, if found */ VertexNode* findNodeForVertex(const VertexGraph* graph, - const GeoPoint* fromVtx) { + const GeoPoint *fromVtx) { return findNodeForEdge(graph, fromVtx, NULL); } From bb411d9ea1d64c8735e8ae6da09d933b1065b491 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 20:47:40 -0700 Subject: [PATCH 18/74] eh, whatever, formatter --- src/apps/applib/include/kml.h | 6 +++--- src/apps/applib/include/utility.h | 18 +++++++++--------- src/apps/applib/lib/kml.c | 8 ++++---- src/apps/applib/lib/utility.c | 16 ++++++++-------- src/apps/testapps/testBBox.c | 2 +- src/apps/testapps/testCellToLatLng.c | 2 +- src/apps/testapps/testLatLngToCell.c | 2 +- src/apps/testapps/testPolygon.c | 2 +- src/apps/testapps/testPolygonToCells.c | 2 +- src/h3lib/include/bbox.h | 6 +++--- src/h3lib/include/faceijk.h | 8 ++++---- src/h3lib/include/linkedGeo.h | 4 ++-- src/h3lib/include/polygon.h | 4 ++-- src/h3lib/include/polygonAlgos.h | 2 +- src/h3lib/include/vec3d.h | 2 +- src/h3lib/include/vertexGraph.h | 16 ++++++++-------- src/h3lib/lib/algos.c | 4 ++-- src/h3lib/lib/bbox.c | 6 +++--- src/h3lib/lib/faceijk.c | 8 ++++---- src/h3lib/lib/h3Index.c | 4 ++-- src/h3lib/lib/linkedGeo.c | 2 +- src/h3lib/lib/polygon.c | 2 +- src/h3lib/lib/vec3d.c | 2 +- src/h3lib/lib/vertex.c | 2 +- src/h3lib/lib/vertexGraph.c | 16 ++++++++-------- 25 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/apps/applib/include/kml.h b/src/apps/applib/include/kml.h index 6ca1b196e..ff093c3ab 100644 --- a/src/apps/applib/include/kml.h +++ b/src/apps/applib/include/kml.h @@ -31,9 +31,9 @@ void kmlPtsFooter(void); void kmlBoundaryFooter(void); // output KML individual points or polygons -void outputLatLonKML(const GeoPoint *g); -void outputPointKML(const GeoPoint *g, const char* name); -void outputTriKML(const GeoPoint *v1, const GeoPoint *v2, const GeoPoint *v3, +void outputLatLonKML(const GeoPoint* g); +void outputPointKML(const GeoPoint* g, const char* name); +void outputTriKML(const GeoPoint* v1, const GeoPoint* v2, const GeoPoint* v3, const char* name); void outputPolyKML(const GeoPoint geoVerts[], int numVerts, const char* name); void outputBoundaryKML(const CellBoundary* b, const char* name); diff --git a/src/apps/applib/include/utility.h b/src/apps/applib/include/utility.h index 8b5357cc8..480da30ce 100644 --- a/src/apps/applib/include/utility.h +++ b/src/apps/applib/include/utility.h @@ -36,18 +36,18 @@ void h3Println(H3Index h); // prints as integer void coordIjkPrint(const CoordIJK* c); -void geoToStringRads(const GeoPoint *p, char* str); -void geoToStringDegs(const GeoPoint *p, char* str); -void geoToStringDegsNoFmt(const GeoPoint *p, char* str); - -void geoPrint(const GeoPoint *p); -void geoPrintln(const GeoPoint *p); -void geoPrintNoFmt(const GeoPoint *p); -void geoPrintlnNoFmt(const GeoPoint *p); +void geoToStringRads(const GeoPoint* p, char* str); +void geoToStringDegs(const GeoPoint* p, char* str); +void geoToStringDegsNoFmt(const GeoPoint* p, char* str); + +void geoPrint(const GeoPoint* p); +void geoPrintln(const GeoPoint* p); +void geoPrintNoFmt(const GeoPoint* p); +void geoPrintlnNoFmt(const GeoPoint* p); void cellBoundaryPrint(const CellBoundary* b); void cellBoundaryPrintln(const CellBoundary* b); -void randomGeo(GeoPoint *p); +void randomGeo(GeoPoint* p); void iterateAllIndexesAtRes(int res, void (*callback)(H3Index)); void iterateAllIndexesAtResPartial(int res, void (*callback)(H3Index), diff --git a/src/apps/applib/lib/kml.c b/src/apps/applib/lib/kml.c index 0902698d9..84eebeed6 100644 --- a/src/apps/applib/lib/kml.c +++ b/src/apps/applib/lib/kml.c @@ -107,12 +107,12 @@ void kmlBoundaryFooter(void) { printf("\n"); } -void outputLatLonKML(const GeoPoint *g) { +void outputLatLonKML(const GeoPoint* g) { printf(" %8lf,%8lf,5.0\n", H3_EXPORT(radsToDegs)(g->lon), H3_EXPORT(radsToDegs)(g->lat)); } -void outputPointKML(const GeoPoint *g, const char* name) { +void outputPointKML(const GeoPoint* g, const char* name) { printf("\n"); printf(" %s\n", name); printf(" #m_ylw-pushpin\n"); @@ -125,7 +125,7 @@ void outputPointKML(const GeoPoint *g, const char* name) { printf("\n"); } -void outputTriKML(const GeoPoint *v1, const GeoPoint *v2, const GeoPoint *v3, +void outputTriKML(const GeoPoint* v1, const GeoPoint* v2, const GeoPoint* v3, const char* name) { printf("\n"); printf("%s\n", name); @@ -143,7 +143,7 @@ void outputTriKML(const GeoPoint *v1, const GeoPoint *v2, const GeoPoint *v3, } void outputBoundaryKML(const CellBoundary* b, const char* name) { - const GeoPoint *v = (const GeoPoint*)&(b->verts); + const GeoPoint* v = (const GeoPoint*)&(b->verts); outputPolyKML(v, b->numVerts, name); } diff --git a/src/apps/applib/lib/utility.c b/src/apps/applib/lib/utility.c index cf3682050..1eb8cb6f5 100644 --- a/src/apps/applib/lib/utility.c +++ b/src/apps/applib/lib/utility.c @@ -56,14 +56,14 @@ void coordIjkPrint(const CoordIJK* c) { /** * Assumes `str` is big enough to hold the result. */ -void geoToStringRads(const GeoPoint *p, char* str) { +void geoToStringRads(const GeoPoint* p, char* str) { sprintf(str, "(%.4lf, %.4lf)", p->lat, p->lon); } /** * Assumes `str` is big enough to hold the result. */ -void geoToStringDegs(const GeoPoint *p, char* str) { +void geoToStringDegs(const GeoPoint* p, char* str) { sprintf(str, "(%.9lf, %.9lf)", H3_EXPORT(radsToDegs)(p->lat), H3_EXPORT(radsToDegs)(p->lon)); } @@ -71,29 +71,29 @@ void geoToStringDegs(const GeoPoint *p, char* str) { /** * Assumes `str` is big enough to hold the result. */ -void geoToStringDegsNoFmt(const GeoPoint *p, char* str) { +void geoToStringDegsNoFmt(const GeoPoint* p, char* str) { sprintf(str, "%.9lf %.9lf", H3_EXPORT(radsToDegs)(p->lat), H3_EXPORT(radsToDegs)(p->lon)); } -void geoPrint(const GeoPoint *p) { +void geoPrint(const GeoPoint* p) { char buff[BUFF_SIZE]; geoToStringDegs(p, buff); printf("%s", buff); } -void geoPrintln(const GeoPoint *p) { +void geoPrintln(const GeoPoint* p) { geoPrint(p); printf("\n"); } -void geoPrintNoFmt(const GeoPoint *p) { +void geoPrintNoFmt(const GeoPoint* p) { char buff[BUFF_SIZE]; geoToStringDegsNoFmt(p, buff); printf("%s", buff); } -void geoPrintlnNoFmt(const GeoPoint *p) { +void geoPrintlnNoFmt(const GeoPoint* p) { geoPrintNoFmt(p); printf("\n"); } @@ -171,7 +171,7 @@ void iterateBaseCellIndexesAtRes(int res, void (*callback)(H3Index), * * @param g Lat/lon will be placed here. */ -void randomGeo(GeoPoint *g) { +void randomGeo(GeoPoint* g) { static int init = 0; if (!init) { srand((unsigned int)time(0)); diff --git a/src/apps/testapps/testBBox.c b/src/apps/testapps/testBBox.c index 9f052093e..794fbfed8 100644 --- a/src/apps/testapps/testBBox.c +++ b/src/apps/testapps/testBBox.c @@ -24,7 +24,7 @@ #include "test.h" void assertBBox(const GeoLoop* geoloop, const BBox* expected, - const GeoPoint *inside, const GeoPoint *outside) { + const GeoPoint* inside, const GeoPoint* outside) { BBox result; bboxFromGeoLoop(geoloop, &result); diff --git a/src/apps/testapps/testCellToLatLng.c b/src/apps/testapps/testCellToLatLng.c index d0d2f290a..65bf46a38 100644 --- a/src/apps/testapps/testCellToLatLng.c +++ b/src/apps/testapps/testCellToLatLng.c @@ -33,7 +33,7 @@ #include "test.h" #include "utility.h" -void assertExpected(H3Index h1, const GeoPoint *g1) { +void assertExpected(H3Index h1, const GeoPoint* g1) { const double epsilon = 0.000001 * M_PI_180; // convert H3 to lat/lon and verify GeoPoint g2; diff --git a/src/apps/testapps/testLatLngToCell.c b/src/apps/testapps/testLatLngToCell.c index 9e61bf8d3..5831dcead 100644 --- a/src/apps/testapps/testLatLngToCell.c +++ b/src/apps/testapps/testLatLngToCell.c @@ -32,7 +32,7 @@ #include "test.h" #include "utility.h" -static void assertExpected(H3Index h1, const GeoPoint *g1) { +static void assertExpected(H3Index h1, const GeoPoint* g1) { // convert lat/lon to H3 and verify int res = H3_EXPORT(getResolution)(h1); H3Index h2; diff --git a/src/apps/testapps/testPolygon.c b/src/apps/testapps/testPolygon.c index 8fb51dbc5..0cf91e5ad 100644 --- a/src/apps/testapps/testPolygon.c +++ b/src/apps/testapps/testPolygon.c @@ -31,7 +31,7 @@ static GeoPoint sfVerts[] = { {0.6583348114025, -2.1354884206045}, {0.6581220034068, -2.1382437718946}, {0.6594479998527, -2.1384597563896}, {0.6599990002976, -2.1376771158464}}; -static void createLinkedLoop(LinkedGeoLoop* loop, GeoPoint *verts, +static void createLinkedLoop(LinkedGeoLoop* loop, GeoPoint* verts, int numVerts) { *loop = (LinkedGeoLoop){0}; for (int i = 0; i < numVerts; i++) { diff --git a/src/apps/testapps/testPolygonToCells.c b/src/apps/testapps/testPolygonToCells.c index 6f7fa0270..762671111 100644 --- a/src/apps/testapps/testPolygonToCells.c +++ b/src/apps/testapps/testPolygonToCells.c @@ -178,7 +178,7 @@ SUITE(polygonToCells) { CellBoundary boundary; H3_EXPORT(cellToBoundary)(origin, &boundary); - GeoPoint *verts = calloc(boundary.numVerts + 1, sizeof(GeoPoint)); + GeoPoint* verts = calloc(boundary.numVerts + 1, sizeof(GeoPoint)); for (int i = 0; i < boundary.numVerts; i++) { verts[i] = boundary.verts[i]; } diff --git a/src/h3lib/include/bbox.h b/src/h3lib/include/bbox.h index 41fd23d12..b9d748677 100644 --- a/src/h3lib/include/bbox.h +++ b/src/h3lib/include/bbox.h @@ -35,11 +35,11 @@ typedef struct { } BBox; bool bboxIsTransmeridian(const BBox* bbox); -void bboxCenter(const BBox* bbox, GeoPoint *center); -bool bboxContains(const BBox* bbox, const GeoPoint *point); +void bboxCenter(const BBox* bbox, GeoPoint* center); +bool bboxContains(const BBox* bbox, const GeoPoint* point); bool bboxEquals(const BBox* b1, const BBox* b2); int bboxHexEstimate(const BBox* bbox, int res); -int lineHexEstimate(const GeoPoint *origin, const GeoPoint *destination, +int lineHexEstimate(const GeoPoint* origin, const GeoPoint* destination, int res); #endif diff --git a/src/h3lib/include/faceijk.h b/src/h3lib/include/faceijk.h index 3aaf4fc35..f6b1da7fa 100644 --- a/src/h3lib/include/faceijk.h +++ b/src/h3lib/include/faceijk.h @@ -72,16 +72,16 @@ typedef enum { // Internal functions -void _geoToFaceIjk(const GeoPoint *g, int res, FaceIJK* h); -void _geoToHex2d(const GeoPoint *g, int res, int* face, Vec2d* v); -void _faceIjkToGeo(const FaceIJK* h, int res, GeoPoint *g); +void _geoToFaceIjk(const GeoPoint* g, int res, FaceIJK* h); +void _geoToHex2d(const GeoPoint* g, int res, int* face, Vec2d* v); +void _faceIjkToGeo(const FaceIJK* h, int res, GeoPoint* g); void _faceIjkToCellBoundary(const FaceIJK* h, int res, int start, int length, CellBoundary* g); void _faceIjkPentToCellBoundary(const FaceIJK* h, int res, int start, int length, CellBoundary* g); void _faceIjkToVerts(FaceIJK* fijk, int* res, FaceIJK* fijkVerts); void _faceIjkPentToVerts(FaceIJK* fijk, int* res, FaceIJK* fijkVerts); -void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, GeoPoint *g); +void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, GeoPoint* g); Overage _adjustOverageClassII(FaceIJK* fijk, int res, int pentLeading4, int substrate); Overage _adjustPentVertOverage(FaceIJK* fijk, int res); diff --git a/src/h3lib/include/linkedGeo.h b/src/h3lib/include/linkedGeo.h index fff1c4aec..cc5fffb6e 100644 --- a/src/h3lib/include/linkedGeo.h +++ b/src/h3lib/include/linkedGeo.h @@ -56,7 +56,7 @@ int normalizeMultiPolygon(LinkedGeoPolygon* root); LinkedGeoPolygon* addNewLinkedPolygon(LinkedGeoPolygon* polygon); LinkedGeoLoop* addNewLinkedLoop(LinkedGeoPolygon* polygon); LinkedGeoLoop* addLinkedLoop(LinkedGeoPolygon* polygon, LinkedGeoLoop* loop); -LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint *vertex); +LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint* vertex); int countLinkedPolygons(LinkedGeoPolygon* polygon); int countLinkedLoops(LinkedGeoPolygon* polygon); int countLinkedCoords(LinkedGeoLoop* loop); @@ -81,7 +81,7 @@ void bboxFromLinkedGeoLoop(const LinkedGeoLoop* loop, BBox* bbox); * @return Whether the point is contained */ bool pointInsideLinkedGeoLoop(const LinkedGeoLoop* loop, const BBox* bbox, - const GeoPoint *coord); + const GeoPoint* coord); /** * Whether the winding order of a given LinkedGeoLoop is clockwise diff --git a/src/h3lib/include/polygon.h b/src/h3lib/include/polygon.h index 5a997d6c8..a81a708c0 100644 --- a/src/h3lib/include/polygon.h +++ b/src/h3lib/include/polygon.h @@ -43,7 +43,7 @@ // Defined directly in polygon.c: void bboxesFromGeoPolygon(const GeoPolygon* polygon, BBox* bboxes); bool pointInsidePolygon(const GeoPolygon* geoPolygon, const BBox* bboxes, - const GeoPoint *coord); + const GeoPoint* coord); // The following functions are created via macro in polygonAlgos.h, // so their signatures are documented here: @@ -64,7 +64,7 @@ void bboxFromGeoLoop(const GeoLoop* loop, BBox* bbox); * @return Whether the point is contained */ bool pointInsideGeoLoop(const GeoLoop* loop, const BBox* bbox, - const GeoPoint *coord); + const GeoPoint* coord); /** * Whether the winding order of a given GeoLoop is clockwise diff --git a/src/h3lib/include/polygonAlgos.h b/src/h3lib/include/polygonAlgos.h index 42f3051a7..0fc792b14 100644 --- a/src/h3lib/include/polygonAlgos.h +++ b/src/h3lib/include/polygonAlgos.h @@ -65,7 +65,7 @@ * @return Whether the point is contained */ bool GENERIC_LOOP_ALGO(pointInside)(const TYPE* loop, const BBox* bbox, - const GeoPoint *coord) { + const GeoPoint* coord) { // fail fast if we're outside the bounding box if (!bboxContains(bbox, coord)) { return false; diff --git a/src/h3lib/include/vec3d.h b/src/h3lib/include/vec3d.h index 1a2b56afb..bb765dd93 100644 --- a/src/h3lib/include/vec3d.h +++ b/src/h3lib/include/vec3d.h @@ -31,7 +31,7 @@ typedef struct { double z; ///< z component } Vec3d; -void _geoToVec3d(const GeoPoint *geo, Vec3d* point); +void _geoToVec3d(const GeoPoint* geo, Vec3d* point); double _pointSquareDist(const Vec3d* p1, const Vec3d* p2); #endif diff --git a/src/h3lib/include/vertexGraph.h b/src/h3lib/include/vertexGraph.h index 86a2ab642..77558e192 100644 --- a/src/h3lib/include/vertexGraph.h +++ b/src/h3lib/include/vertexGraph.h @@ -49,22 +49,22 @@ void initVertexGraph(VertexGraph* graph, int numBuckets, int res); void destroyVertexGraph(VertexGraph* graph); -VertexNode* addVertexNode(VertexGraph* graph, const GeoPoint *fromVtx, - const GeoPoint *toVtx); +VertexNode* addVertexNode(VertexGraph* graph, const GeoPoint* fromVtx, + const GeoPoint* toVtx); int removeVertexNode(VertexGraph* graph, VertexNode* node); -VertexNode* findNodeForEdge(const VertexGraph* graph, const GeoPoint *fromVtx, - const GeoPoint *toVtx); +VertexNode* findNodeForEdge(const VertexGraph* graph, const GeoPoint* fromVtx, + const GeoPoint* toVtx); VertexNode* findNodeForVertex(const VertexGraph* graph, - const GeoPoint *fromVtx); + const GeoPoint* fromVtx); VertexNode* firstVertexNode(const VertexGraph* graph); // Internal functions -uint32_t _hashVertex(const GeoPoint *vertex, int res, int numBuckets); -void _initVertexNode(VertexNode* node, const GeoPoint *fromVtx, - const GeoPoint *toVtx); +uint32_t _hashVertex(const GeoPoint* vertex, int res, int numBuckets); +void _initVertexNode(VertexNode* node, const GeoPoint* fromVtx, + const GeoPoint* toVtx); #endif diff --git a/src/h3lib/lib/algos.c b/src/h3lib/lib/algos.c index 0c0f8bd42..8672772c5 100644 --- a/src/h3lib/lib/algos.c +++ b/src/h3lib/lib/algos.c @@ -1007,8 +1007,8 @@ int _polygonToCellsInternal(const GeoPolygon* geoPolygon, int res, void h3SetToVertexGraph(const H3Index* h3Set, const int numHexes, VertexGraph* graph) { CellBoundary vertices; - GeoPoint *fromVtx; - GeoPoint *toVtx; + GeoPoint* fromVtx; + GeoPoint* toVtx; VertexNode* edge; if (numHexes < 1) { // We still need to init the graph, or calls to destroyVertexGraph will diff --git a/src/h3lib/lib/bbox.c b/src/h3lib/lib/bbox.c index 8c998526b..c8efec448 100644 --- a/src/h3lib/lib/bbox.c +++ b/src/h3lib/lib/bbox.c @@ -39,7 +39,7 @@ bool bboxIsTransmeridian(const BBox* bbox) { return bbox->east < bbox->west; } * @param bbox Input bounding box * @param center Output center coordinate */ -void bboxCenter(const BBox* bbox, GeoPoint *center) { +void bboxCenter(const BBox* bbox, GeoPoint* center) { center->lat = (bbox->north + bbox->south) / 2.0; // If the bbox crosses the antimeridian, shift east 360 degrees double east = bboxIsTransmeridian(bbox) ? bbox->east + M_2PI : bbox->east; @@ -52,7 +52,7 @@ void bboxCenter(const BBox* bbox, GeoPoint *center) { * @param point Point to test * @return Whether the point is contained */ -bool bboxContains(const BBox* bbox, const GeoPoint *point) { +bool bboxContains(const BBox* bbox, const GeoPoint* point) { return point->lat >= bbox->south && point->lat <= bbox->north && (bboxIsTransmeridian(bbox) ? // transmeridian case @@ -136,7 +136,7 @@ int bboxHexEstimate(const BBox* bbox, int res) { * @param res the resolution of the H3 hexagons to trace the line * @return the estimated number of hexagons required to trace the line */ -int lineHexEstimate(const GeoPoint *origin, const GeoPoint *destination, +int lineHexEstimate(const GeoPoint* origin, const GeoPoint* destination, int res) { // Get the area of the pentagon as the maximally-distorted area possible H3Index pentagons[12] = {0}; diff --git a/src/h3lib/lib/faceijk.c b/src/h3lib/lib/faceijk.c index 6b66a1ba1..799c3595d 100644 --- a/src/h3lib/lib/faceijk.c +++ b/src/h3lib/lib/faceijk.c @@ -368,7 +368,7 @@ static const int unitScaleByCIIres[] = { * @param res The desired H3 resolution for the encoding. * @param h The FaceIJK address of the containing cell at resolution res. */ -void _geoToFaceIjk(const GeoPoint *g, int res, FaceIJK* h) { +void _geoToFaceIjk(const GeoPoint* g, int res, FaceIJK* h) { // first convert to hex2d Vec2d v; _geoToHex2d(g, res, &h->face, &v); @@ -386,7 +386,7 @@ void _geoToFaceIjk(const GeoPoint *g, int res, FaceIJK* h) { * @param face The icosahedral face containing the spherical coordinates. * @param v The 2D hex coordinates of the cell containing the point. */ -void _geoToHex2d(const GeoPoint *g, int res, int* face, Vec2d* v) { +void _geoToHex2d(const GeoPoint* g, int res, int* face, Vec2d* v) { Vec3d v3d; _geoToVec3d(g, &v3d); @@ -445,7 +445,7 @@ void _geoToHex2d(const GeoPoint *g, int res, int* face, Vec2d* v) { * @param g The spherical coordinates of the cell center point. */ void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, - GeoPoint *g) { + GeoPoint* g) { // calculate (r, theta) in hex2d double r = _v2dMag(v); @@ -490,7 +490,7 @@ void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, * @param res The H3 resolution of the cell. * @param g The spherical coordinates of the cell center point. */ -void _faceIjkToGeo(const FaceIJK* h, int res, GeoPoint *g) { +void _faceIjkToGeo(const FaceIJK* h, int res, GeoPoint* g) { Vec2d v; _ijkToHex2d(&h->coord, &v); _hex2dToGeo(&v, h->face, res, 0, g); diff --git a/src/h3lib/lib/h3Index.c b/src/h3lib/lib/h3Index.c index ebecc6a45..6e4da5ca9 100644 --- a/src/h3lib/lib/h3Index.c +++ b/src/h3lib/lib/h3Index.c @@ -723,7 +723,7 @@ H3Index _faceIjkToH3(const FaceIJK* fijk, int res) { * @param out The encoded H3Index. * @returns E_SUCCESS (0) on success, another value otherwise */ -H3Error H3_EXPORT(latLngToCell)(const GeoPoint *g, int res, H3Index* out) { +H3Error H3_EXPORT(latLngToCell)(const GeoPoint* g, int res, H3Index* out) { if (res < 0 || res > MAX_H3_RES) { return E_RES_DOMAIN; } @@ -836,7 +836,7 @@ H3Error _h3ToFaceIjk(H3Index h, FaceIJK* fijk) { * @param h3 The H3 index. * @param g The spherical coordinates of the H3 cell center. */ -H3Error H3_EXPORT(cellToLatLng)(H3Index h3, GeoPoint *g) { +H3Error H3_EXPORT(cellToLatLng)(H3Index h3, GeoPoint* g) { FaceIJK fijk; H3Error e = _h3ToFaceIjk(h3, &fijk); if (e) { diff --git a/src/h3lib/lib/linkedGeo.c b/src/h3lib/lib/linkedGeo.c index 7979132a1..6870a69ef 100644 --- a/src/h3lib/lib/linkedGeo.c +++ b/src/h3lib/lib/linkedGeo.c @@ -73,7 +73,7 @@ LinkedGeoLoop* addLinkedLoop(LinkedGeoPolygon* polygon, LinkedGeoLoop* loop) { * @param vertex Coordinate to add * @return Pointer to the coordinate */ -LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint *vertex) { +LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint* vertex) { LinkedLatLng* coord = H3_MEMORY(malloc)(sizeof(*coord)); assert(coord != NULL); *coord = (LinkedLatLng){.vertex = *vertex, .next = NULL}; diff --git a/src/h3lib/lib/polygon.c b/src/h3lib/lib/polygon.c index d4e1d6c1a..0a5cb845f 100644 --- a/src/h3lib/lib/polygon.c +++ b/src/h3lib/lib/polygon.c @@ -64,7 +64,7 @@ void bboxesFromGeoPolygon(const GeoPolygon* polygon, BBox* bboxes) { * @return Whether the point is contained */ bool pointInsidePolygon(const GeoPolygon* geoPolygon, const BBox* bboxes, - const GeoPoint *coord) { + const GeoPoint* coord) { // Start with contains state of primary geoloop bool contains = pointInsideGeoLoop(&(geoPolygon->geoloop), &bboxes[0], coord); diff --git a/src/h3lib/lib/vec3d.c b/src/h3lib/lib/vec3d.c index 21085e568..989558c32 100644 --- a/src/h3lib/lib/vec3d.c +++ b/src/h3lib/lib/vec3d.c @@ -47,7 +47,7 @@ double _pointSquareDist(const Vec3d* v1, const Vec3d* v2) { * @param geo The latitude and longitude of the point. * @param v The 3D coordinate of the point. */ -void _geoToVec3d(const GeoPoint *geo, Vec3d* v) { +void _geoToVec3d(const GeoPoint* geo, Vec3d* v) { double r = cos(geo->lat); v->z = sin(geo->lat); diff --git a/src/h3lib/lib/vertex.c b/src/h3lib/lib/vertex.c index d875d4dc3..8486c64f4 100644 --- a/src/h3lib/lib/vertex.c +++ b/src/h3lib/lib/vertex.c @@ -285,7 +285,7 @@ void H3_EXPORT(cellToVertexes)(H3Index cell, H3Index* vertexes) { * @param vertex H3 index describing a vertex * @param coord Output geo coordinate */ -void H3_EXPORT(vertexToLatLng)(H3Index vertex, GeoPoint *coord) { +void H3_EXPORT(vertexToLatLng)(H3Index vertex, GeoPoint* coord) { // Get the vertex number and owner from the vertex int vertexNum = H3_GET_RESERVED_BITS(vertex); H3Index owner = vertex; diff --git a/src/h3lib/lib/vertexGraph.c b/src/h3lib/lib/vertexGraph.c index 10dad7110..49e6f57f7 100644 --- a/src/h3lib/lib/vertexGraph.c +++ b/src/h3lib/lib/vertexGraph.c @@ -70,15 +70,15 @@ void destroyVertexGraph(VertexGraph* graph) { * @param numBuckets Number of buckets in the graph * @return Integer hash */ -uint32_t _hashVertex(const GeoPoint *vertex, int res, int numBuckets) { +uint32_t _hashVertex(const GeoPoint* vertex, int res, int numBuckets) { // Simple hash: Take the sum of the lat and lon with a precision level // determined by the resolution, converted to int, modulo bucket count. return (uint32_t)fmod(fabs((vertex->lat + vertex->lon) * pow(10, 15 - res)), numBuckets); } -void _initVertexNode(VertexNode* node, const GeoPoint *fromVtx, - const GeoPoint *toVtx) { +void _initVertexNode(VertexNode* node, const GeoPoint* fromVtx, + const GeoPoint* toVtx) { node->from = *fromVtx; node->to = *toVtx; node->next = NULL; @@ -91,8 +91,8 @@ void _initVertexNode(VertexNode* node, const GeoPoint *fromVtx, * @param toVtx End vertex * @return Pointer to the new node */ -VertexNode* addVertexNode(VertexGraph* graph, const GeoPoint *fromVtx, - const GeoPoint *toVtx) { +VertexNode* addVertexNode(VertexGraph* graph, const GeoPoint* fromVtx, + const GeoPoint* toVtx) { // Make the new node VertexNode* node = H3_MEMORY(malloc)(sizeof(VertexNode)); assert(node != NULL); @@ -168,8 +168,8 @@ int removeVertexNode(VertexGraph* graph, VertexNode* node) { * @param toVtx End vertex, or NULL if we don't care * @return Pointer to the vertex node, if found */ -VertexNode* findNodeForEdge(const VertexGraph* graph, const GeoPoint *fromVtx, - const GeoPoint *toVtx) { +VertexNode* findNodeForEdge(const VertexGraph* graph, const GeoPoint* fromVtx, + const GeoPoint* toVtx) { // Determine location uint32_t index = _hashVertex(fromVtx, graph->res, graph->numBuckets); // Check whether there's an existing node in that spot @@ -195,7 +195,7 @@ VertexNode* findNodeForEdge(const VertexGraph* graph, const GeoPoint *fromVtx, * @return Pointer to the vertex node, if found */ VertexNode* findNodeForVertex(const VertexGraph* graph, - const GeoPoint *fromVtx) { + const GeoPoint* fromVtx) { return findNodeForEdge(graph, fromVtx, NULL); } From 130ac55fed6a653a261f575649580a793fce3c67 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:10:32 -0700 Subject: [PATCH 19/74] find: GeoPoint in *.c,*.h,*.h.in --- examples/distance.c | 2 +- examples/index.c | 4 +- src/apps/applib/include/kml.h | 8 +- src/apps/applib/include/utility.h | 18 ++-- src/apps/applib/lib/kml.c | 10 +-- src/apps/applib/lib/utility.c | 16 ++-- src/apps/benchmarks/benchmarkH3Api.c | 4 +- src/apps/benchmarks/benchmarkPolygon.c | 6 +- src/apps/benchmarks/benchmarkPolygonToCells.c | 6 +- src/apps/filters/cellToLatLng.c | 2 +- src/apps/filters/latLngToCell.c | 2 +- src/apps/fuzzers/fuzzerCellToLatLng.c | 2 +- src/apps/fuzzers/fuzzerLatLngToCell.c | 2 +- src/apps/miscapps/cellToLatLngHier.c | 2 +- src/apps/miscapps/generateFaceCenterPoint.c | 4 +- src/apps/testapps/mkRandGeo.c | 2 +- src/apps/testapps/mkRandGeoBoundary.c | 2 +- src/apps/testapps/testBBox.c | 82 ++++++++--------- src/apps/testapps/testCellToCenterChild.c | 4 +- src/apps/testapps/testCellToLatLng.c | 6 +- src/apps/testapps/testCellToParent.c | 2 +- src/apps/testapps/testDirectedEdge.c | 4 +- src/apps/testapps/testGeoPoint.c | 40 ++++----- src/apps/testapps/testGridDisk.c | 2 +- src/apps/testapps/testGridDisksUnsafe.c | 2 +- src/apps/testapps/testGridRingUnsafe.c | 2 +- src/apps/testapps/testH3Api.c | 10 +-- src/apps/testapps/testH3CellArea.c | 2 +- src/apps/testapps/testH3CellAreaExhaustive.c | 2 +- src/apps/testapps/testH3Index.c | 16 ++-- src/apps/testapps/testLatLngToCell.c | 4 +- src/apps/testapps/testLinkedGeo.c | 8 +- src/apps/testapps/testPolygon.c | 90 +++++++++---------- src/apps/testapps/testPolygonToCells.c | 30 +++---- .../testapps/testPolygonToCellsReported.c | 10 +-- src/apps/testapps/testVec3d.c | 6 +- src/apps/testapps/testVertexExhaustive.c | 2 +- src/apps/testapps/testVertexGraph.c | 14 +-- src/h3lib/include/bbox.h | 6 +- src/h3lib/include/faceijk.h | 10 +-- src/h3lib/include/geoPoint.h | 14 +-- src/h3lib/include/h3api.h.in | 28 +++--- src/h3lib/include/linkedGeo.h | 4 +- src/h3lib/include/polygon.h | 4 +- src/h3lib/include/polygonAlgos.h | 16 ++-- src/h3lib/include/vec3d.h | 2 +- src/h3lib/include/vertexGraph.h | 20 ++--- src/h3lib/lib/algos.c | 14 +-- src/h3lib/lib/bbox.c | 10 +-- src/h3lib/lib/faceijk.c | 10 +-- src/h3lib/lib/geoPoint.c | 24 ++--- src/h3lib/lib/h3Index.c | 4 +- src/h3lib/lib/linkedGeo.c | 2 +- src/h3lib/lib/polygon.c | 2 +- src/h3lib/lib/vec3d.c | 2 +- src/h3lib/lib/vertex.c | 2 +- src/h3lib/lib/vertexGraph.c | 16 ++-- 57 files changed, 310 insertions(+), 310 deletions(-) diff --git a/examples/distance.c b/examples/distance.c index d776651da..0ac04310e 100644 --- a/examples/distance.c +++ b/examples/distance.c @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) { // 555 Market St @ resolution 15 H3Index h3HQ2 = stringToH3("8f283082a30e623"); - GeoPoint geoHQ1, geoHQ2; + LatLng geoHQ1, geoHQ2; cellToLatLng(h3HQ1, &geoHQ1); cellToLatLng(h3HQ2, &geoHQ2); diff --git a/examples/index.c b/examples/index.c index 61efbc0b4..94e4f6ec5 100644 --- a/examples/index.c +++ b/examples/index.c @@ -24,7 +24,7 @@ int main(int argc, char *argv[]) { // Get the H3 index of some location and print it. - GeoPoint location; + LatLng location; location.lat = degsToRads(40.689167); location.lon = degsToRads(-74.044444); int resolution = 10; @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) { } // Get the center coordinates. - GeoPoint center; + LatLng center; if (cellToLatLng(indexed, ¢er) != E_SUCCESS) { printf("Failed\n"); return 1; diff --git a/src/apps/applib/include/kml.h b/src/apps/applib/include/kml.h index ff093c3ab..634a08632 100644 --- a/src/apps/applib/include/kml.h +++ b/src/apps/applib/include/kml.h @@ -31,11 +31,11 @@ void kmlPtsFooter(void); void kmlBoundaryFooter(void); // output KML individual points or polygons -void outputLatLonKML(const GeoPoint* g); -void outputPointKML(const GeoPoint* g, const char* name); -void outputTriKML(const GeoPoint* v1, const GeoPoint* v2, const GeoPoint* v3, +void outputLatLonKML(const LatLng* g); +void outputPointKML(const LatLng* g, const char* name); +void outputTriKML(const LatLng* v1, const LatLng* v2, const LatLng* v3, const char* name); -void outputPolyKML(const GeoPoint geoVerts[], int numVerts, const char* name); +void outputPolyKML(const LatLng geoVerts[], int numVerts, const char* name); void outputBoundaryKML(const CellBoundary* b, const char* name); #endif diff --git a/src/apps/applib/include/utility.h b/src/apps/applib/include/utility.h index 480da30ce..be3c839d1 100644 --- a/src/apps/applib/include/utility.h +++ b/src/apps/applib/include/utility.h @@ -36,18 +36,18 @@ void h3Println(H3Index h); // prints as integer void coordIjkPrint(const CoordIJK* c); -void geoToStringRads(const GeoPoint* p, char* str); -void geoToStringDegs(const GeoPoint* p, char* str); -void geoToStringDegsNoFmt(const GeoPoint* p, char* str); - -void geoPrint(const GeoPoint* p); -void geoPrintln(const GeoPoint* p); -void geoPrintNoFmt(const GeoPoint* p); -void geoPrintlnNoFmt(const GeoPoint* p); +void geoToStringRads(const LatLng* p, char* str); +void geoToStringDegs(const LatLng* p, char* str); +void geoToStringDegsNoFmt(const LatLng* p, char* str); + +void geoPrint(const LatLng* p); +void geoPrintln(const LatLng* p); +void geoPrintNoFmt(const LatLng* p); +void geoPrintlnNoFmt(const LatLng* p); void cellBoundaryPrint(const CellBoundary* b); void cellBoundaryPrintln(const CellBoundary* b); -void randomGeo(GeoPoint* p); +void randomGeo(LatLng* p); void iterateAllIndexesAtRes(int res, void (*callback)(H3Index)); void iterateAllIndexesAtResPartial(int res, void (*callback)(H3Index), diff --git a/src/apps/applib/lib/kml.c b/src/apps/applib/lib/kml.c index 84eebeed6..e61e0561b 100644 --- a/src/apps/applib/lib/kml.c +++ b/src/apps/applib/lib/kml.c @@ -107,12 +107,12 @@ void kmlBoundaryFooter(void) { printf("\n"); } -void outputLatLonKML(const GeoPoint* g) { +void outputLatLonKML(const LatLng* g) { printf(" %8lf,%8lf,5.0\n", H3_EXPORT(radsToDegs)(g->lon), H3_EXPORT(radsToDegs)(g->lat)); } -void outputPointKML(const GeoPoint* g, const char* name) { +void outputPointKML(const LatLng* g, const char* name) { printf("\n"); printf(" %s\n", name); printf(" #m_ylw-pushpin\n"); @@ -125,7 +125,7 @@ void outputPointKML(const GeoPoint* g, const char* name) { printf("\n"); } -void outputTriKML(const GeoPoint* v1, const GeoPoint* v2, const GeoPoint* v3, +void outputTriKML(const LatLng* v1, const LatLng* v2, const LatLng* v3, const char* name) { printf("\n"); printf("%s\n", name); @@ -143,11 +143,11 @@ void outputTriKML(const GeoPoint* v1, const GeoPoint* v2, const GeoPoint* v3, } void outputBoundaryKML(const CellBoundary* b, const char* name) { - const GeoPoint* v = (const GeoPoint*)&(b->verts); + const LatLng* v = (const LatLng*)&(b->verts); outputPolyKML(v, b->numVerts, name); } -void outputPolyKML(const GeoPoint geoVerts[], int numVerts, const char* name) { +void outputPolyKML(const LatLng geoVerts[], int numVerts, const char* name) { printf("\n"); printf("%s\n", name); printf(" #lineStyle1\n"); diff --git a/src/apps/applib/lib/utility.c b/src/apps/applib/lib/utility.c index 1eb8cb6f5..6e6b138f5 100644 --- a/src/apps/applib/lib/utility.c +++ b/src/apps/applib/lib/utility.c @@ -56,14 +56,14 @@ void coordIjkPrint(const CoordIJK* c) { /** * Assumes `str` is big enough to hold the result. */ -void geoToStringRads(const GeoPoint* p, char* str) { +void geoToStringRads(const LatLng* p, char* str) { sprintf(str, "(%.4lf, %.4lf)", p->lat, p->lon); } /** * Assumes `str` is big enough to hold the result. */ -void geoToStringDegs(const GeoPoint* p, char* str) { +void geoToStringDegs(const LatLng* p, char* str) { sprintf(str, "(%.9lf, %.9lf)", H3_EXPORT(radsToDegs)(p->lat), H3_EXPORT(radsToDegs)(p->lon)); } @@ -71,29 +71,29 @@ void geoToStringDegs(const GeoPoint* p, char* str) { /** * Assumes `str` is big enough to hold the result. */ -void geoToStringDegsNoFmt(const GeoPoint* p, char* str) { +void geoToStringDegsNoFmt(const LatLng* p, char* str) { sprintf(str, "%.9lf %.9lf", H3_EXPORT(radsToDegs)(p->lat), H3_EXPORT(radsToDegs)(p->lon)); } -void geoPrint(const GeoPoint* p) { +void geoPrint(const LatLng* p) { char buff[BUFF_SIZE]; geoToStringDegs(p, buff); printf("%s", buff); } -void geoPrintln(const GeoPoint* p) { +void geoPrintln(const LatLng* p) { geoPrint(p); printf("\n"); } -void geoPrintNoFmt(const GeoPoint* p) { +void geoPrintNoFmt(const LatLng* p) { char buff[BUFF_SIZE]; geoToStringDegsNoFmt(p, buff); printf("%s", buff); } -void geoPrintlnNoFmt(const GeoPoint* p) { +void geoPrintlnNoFmt(const LatLng* p) { geoPrintNoFmt(p); printf("\n"); } @@ -171,7 +171,7 @@ void iterateBaseCellIndexesAtRes(int res, void (*callback)(H3Index), * * @param g Lat/lon will be placed here. */ -void randomGeo(GeoPoint* g) { +void randomGeo(LatLng* g) { static int init = 0; if (!init) { srand((unsigned int)time(0)); diff --git a/src/apps/benchmarks/benchmarkH3Api.c b/src/apps/benchmarks/benchmarkH3Api.c index f1130a410..8c2e0f1f2 100644 --- a/src/apps/benchmarks/benchmarkH3Api.c +++ b/src/apps/benchmarks/benchmarkH3Api.c @@ -18,12 +18,12 @@ #include "h3api.h" // Fixtures (arbitrary res 9 hexagon) -GeoPoint coord = {0.659966917655, -2.1364398519396}; +LatLng coord = {0.659966917655, -2.1364398519396}; H3Index hex = 0x89283080ddbffff; BEGIN_BENCHMARKS(); -GeoPoint outCoord; +LatLng outCoord; CellBoundary outBoundary; H3Index h; diff --git a/src/apps/benchmarks/benchmarkPolygon.c b/src/apps/benchmarks/benchmarkPolygon.c index 80f67fabf..dfc19ae2c 100644 --- a/src/apps/benchmarks/benchmarkPolygon.c +++ b/src/apps/benchmarks/benchmarkPolygon.c @@ -19,9 +19,9 @@ #include "polygon.h" // Fixtures -GeoPoint coord = {0.6593020122281105, -2.136646587644049}; +LatLng coord = {0.6593020122281105, -2.136646587644049}; -GeoPoint smallVerts[] = {{0.6593216174404631, -2.136686544190228}, +LatLng smallVerts[] = {{0.6593216174404631, -2.136686544190228}, {0.6592922488566673, -2.1367052400423}, {0.6592659902057862, -2.136683255590617}, {0.6592690997315311, -2.136642575268508}, @@ -31,7 +31,7 @@ GeoPoint smallVerts[] = {{0.6593216174404631, -2.136686544190228}, GeoLoop smallGeoLoop; BBox smallBBox; -GeoPoint largeVerts[] = {{0.659094230575688, -2.1371021015485354}, +LatLng largeVerts[] = {{0.659094230575688, -2.1371021015485354}, {0.6590648582999955, -2.137120785446624}, {0.6590386025000088, -2.1370988011284138}, {0.6590417185683777, -2.1370581328924323}, diff --git a/src/apps/benchmarks/benchmarkPolygonToCells.c b/src/apps/benchmarks/benchmarkPolygonToCells.c index 32926fe8a..1fed2f0d3 100644 --- a/src/apps/benchmarks/benchmarkPolygonToCells.c +++ b/src/apps/benchmarks/benchmarkPolygonToCells.c @@ -18,14 +18,14 @@ #include "h3api.h" // Fixtures -GeoPoint sfVerts[] = { +LatLng sfVerts[] = { {0.659966917655, -2.1364398519396}, {0.6595011102219, -2.1359434279405}, {0.6583348114025, -2.1354884206045}, {0.6581220034068, -2.1382437718946}, {0.6594479998527, -2.1384597563896}, {0.6599990002976, -2.1376771158464}}; GeoLoop sfGeoLoop; GeoPolygon sfGeoPolygon; -GeoPoint alamedaVerts[] = {{0.6597959342671712, -2.133241848488897}, +LatLng alamedaVerts[] = {{0.6597959342671712, -2.133241848488897}, {0.6597959348850178, -2.133241848495878}, {0.6598352639563587, -2.1331688423977755}, {0.6601346536539207, -2.13270417124178}, @@ -78,7 +78,7 @@ GeoPoint alamedaVerts[] = {{0.6597959342671712, -2.133241848488897}, GeoLoop alamedaGeoLoop; GeoPolygon alamedaGeoPolygon; -GeoPoint southernVerts[] = {{0.6367481147484843, -2.1290865397798906}, +LatLng southernVerts[] = {{0.6367481147484843, -2.1290865397798906}, {0.6367481152301953, -2.129086539469222}, {0.6367550754426818, -2.128887436716856}, {0.6367816002113981, -2.1273204058681094}, diff --git a/src/apps/filters/cellToLatLng.c b/src/apps/filters/cellToLatLng.c index 4ad7b16f4..e6e654576 100644 --- a/src/apps/filters/cellToLatLng.c +++ b/src/apps/filters/cellToLatLng.c @@ -48,7 +48,7 @@ #include "utility.h" void doCell(H3Index h, int isKmlOut) { - GeoPoint g; + LatLng g; H3_EXPORT(cellToLatLng)(h, &g); char label[BUFF_SIZE]; diff --git a/src/apps/filters/latLngToCell.c b/src/apps/filters/latLngToCell.c index f1dd27a09..df26d7f9a 100644 --- a/src/apps/filters/latLngToCell.c +++ b/src/apps/filters/latLngToCell.c @@ -44,7 +44,7 @@ * @param res Resolution */ void doCoords(double lat, double lon, int res) { - GeoPoint g = {.lat = H3_EXPORT(degsToRads)(lat), + LatLng g = {.lat = H3_EXPORT(degsToRads)(lat), .lon = H3_EXPORT(degsToRads)(lon)}; H3Index h; diff --git a/src/apps/fuzzers/fuzzerCellToLatLng.c b/src/apps/fuzzers/fuzzerCellToLatLng.c index e7f9bd849..6eb6849f8 100644 --- a/src/apps/fuzzers/fuzzerCellToLatLng.c +++ b/src/apps/fuzzers/fuzzerCellToLatLng.c @@ -32,7 +32,7 @@ int main(int argc, char* argv[]) { } fclose(fp); - GeoPoint geo; + LatLng geo; H3_EXPORT(cellToLatLng)(index, &geo); printf("%lf %lf\n", geo.lat, geo.lon); CellBoundary cellBoundary; diff --git a/src/apps/fuzzers/fuzzerLatLngToCell.c b/src/apps/fuzzers/fuzzerLatLngToCell.c index 396affe32..34b6f24ad 100644 --- a/src/apps/fuzzers/fuzzerLatLngToCell.c +++ b/src/apps/fuzzers/fuzzerLatLngToCell.c @@ -36,7 +36,7 @@ int main(int argc, char* argv[]) { } fclose(fp); - GeoPoint g = {.lat = args.lat, .lon = args.lon}; + LatLng g = {.lat = args.lat, .lon = args.lon}; H3Index h; H3Error e = H3_EXPORT(latLngToCell)(&g, args.res, &h); diff --git a/src/apps/miscapps/cellToLatLngHier.c b/src/apps/miscapps/cellToLatLngHier.c index 23703da68..4856d93ef 100644 --- a/src/apps/miscapps/cellToLatLngHier.c +++ b/src/apps/miscapps/cellToLatLngHier.c @@ -62,7 +62,7 @@ #include "utility.h" void doCell(H3Index h, int isKmlOut) { - GeoPoint g; + LatLng g; H3_EXPORT(cellToLatLng)(h, &g); char label[BUFF_SIZE]; diff --git a/src/apps/miscapps/generateFaceCenterPoint.c b/src/apps/miscapps/generateFaceCenterPoint.c index 64aa40ad7..657bf21cc 100644 --- a/src/apps/miscapps/generateFaceCenterPoint.c +++ b/src/apps/miscapps/generateFaceCenterPoint.c @@ -26,7 +26,7 @@ /** @brief icosahedron face centers in lat/lon radians. Copied from faceijk.c. */ -const GeoPoint faceCenterGeoCopy[NUM_ICOSA_FACES] = { +const LatLng faceCenterGeoCopy[NUM_ICOSA_FACES] = { {0.803582649718989942, 1.248397419617396099}, // face 0 {1.307747883455638156, 2.536945009877921159}, // face 1 {1.054751253523952054, -1.347517358900396623}, // face 2 @@ -55,7 +55,7 @@ const GeoPoint faceCenterGeoCopy[NUM_ICOSA_FACES] = { static void generate() { printf("static const Vec3d faceCenterPoint[NUM_ICOSA_FACES] = {\n"); for (int i = 0; i < NUM_ICOSA_FACES; i++) { - GeoPoint centerCoords = faceCenterGeoCopy[i]; + LatLng centerCoords = faceCenterGeoCopy[i]; Vec3d centerPoint; _geoToVec3d(¢erCoords, ¢erPoint); printf(" {%.16f, %.16f, %.16f}, // face %2d\n", centerPoint.x, diff --git a/src/apps/testapps/mkRandGeo.c b/src/apps/testapps/mkRandGeo.c index eda37f075..bf9089d52 100644 --- a/src/apps/testapps/mkRandGeo.c +++ b/src/apps/testapps/mkRandGeo.c @@ -65,7 +65,7 @@ int main(int argc, char* argv[]) { } for (int i = 0; i < numPoints; i++) { - GeoPoint g; + LatLng g; randomGeo(&g); H3Index h; diff --git a/src/apps/testapps/mkRandGeoBoundary.c b/src/apps/testapps/mkRandGeoBoundary.c index 14633c5c7..5506fbf74 100644 --- a/src/apps/testapps/mkRandGeoBoundary.c +++ b/src/apps/testapps/mkRandGeoBoundary.c @@ -64,7 +64,7 @@ int main(int argc, char* argv[]) { } for (int i = 0; i < numPoints; i++) { - GeoPoint g; + LatLng g; randomGeo(&g); H3Index h; diff --git a/src/apps/testapps/testBBox.c b/src/apps/testapps/testBBox.c index 794fbfed8..b19e6e824 100644 --- a/src/apps/testapps/testBBox.c +++ b/src/apps/testapps/testBBox.c @@ -24,7 +24,7 @@ #include "test.h" void assertBBox(const GeoLoop* geoloop, const BBox* expected, - const GeoPoint* inside, const GeoPoint* outside) { + const LatLng* inside, const LatLng* outside) { BBox result; bboxFromGeoLoop(geoloop, &result); @@ -37,104 +37,104 @@ void assertBBox(const GeoLoop* geoloop, const BBox* expected, SUITE(BBox) { TEST(posLatPosLon) { - GeoPoint verts[] = {{0.8, 0.3}, {0.7, 0.6}, {1.1, 0.7}, {1.0, 0.2}}; + LatLng verts[] = {{0.8, 0.3}, {0.7, 0.6}, {1.1, 0.7}, {1.0, 0.2}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {1.1, 0.7, 0.7, 0.2}; - const GeoPoint inside = {0.9, 0.4}; - const GeoPoint outside = {0.0, 0.0}; + const LatLng inside = {0.9, 0.4}; + const LatLng outside = {0.0, 0.0}; assertBBox(&geoloop, &expected, &inside, &outside); } TEST(negLatPosLon) { - GeoPoint verts[] = {{-0.3, 0.6}, {-0.4, 0.9}, {-0.2, 0.8}, {-0.1, 0.6}}; + LatLng verts[] = {{-0.3, 0.6}, {-0.4, 0.9}, {-0.2, 0.8}, {-0.1, 0.6}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {-0.1, -0.4, 0.9, 0.6}; - const GeoPoint inside = {-0.3, 0.8}; - const GeoPoint outside = {0.0, 0.0}; + const LatLng inside = {-0.3, 0.8}; + const LatLng outside = {0.0, 0.0}; assertBBox(&geoloop, &expected, &inside, &outside); } TEST(posLatNegLon) { - GeoPoint verts[] = {{0.7, -1.4}, {0.8, -0.9}, {1.0, -0.8}, {1.1, -1.3}}; + LatLng verts[] = {{0.7, -1.4}, {0.8, -0.9}, {1.0, -0.8}, {1.1, -1.3}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {1.1, 0.7, -0.8, -1.4}; - const GeoPoint inside = {0.9, -1.0}; - const GeoPoint outside = {0.0, 0.0}; + const LatLng inside = {0.9, -1.0}; + const LatLng outside = {0.0, 0.0}; assertBBox(&geoloop, &expected, &inside, &outside); } TEST(negLatNegLon) { - GeoPoint verts[] = { + LatLng verts[] = { {-0.4, -1.4}, {-0.3, -1.1}, {-0.1, -1.2}, {-0.2, -1.4}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {-0.1, -0.4, -1.1, -1.4}; - const GeoPoint inside = {-0.3, -1.2}; - const GeoPoint outside = {0.0, 0.0}; + const LatLng inside = {-0.3, -1.2}; + const LatLng outside = {0.0, 0.0}; assertBBox(&geoloop, &expected, &inside, &outside); } TEST(aroundZeroZero) { - GeoPoint verts[] = {{0.4, -0.4}, {0.4, 0.4}, {-0.4, 0.4}, {-0.4, -0.4}}; + LatLng verts[] = {{0.4, -0.4}, {0.4, 0.4}, {-0.4, 0.4}, {-0.4, -0.4}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {0.4, -0.4, 0.4, -0.4}; - const GeoPoint inside = {-0.1, -0.1}; - const GeoPoint outside = {1.0, -1.0}; + const LatLng inside = {-0.1, -0.1}; + const LatLng outside = {1.0, -1.0}; assertBBox(&geoloop, &expected, &inside, &outside); } TEST(transmeridian) { - GeoPoint verts[] = {{0.4, M_PI - 0.1}, + LatLng verts[] = {{0.4, M_PI - 0.1}, {0.4, -M_PI + 0.1}, {-0.4, -M_PI + 0.1}, {-0.4, M_PI - 0.1}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {0.4, -0.4, -M_PI + 0.1, M_PI - 0.1}; - const GeoPoint insideOnMeridian = {-0.1, M_PI}; - const GeoPoint outside = {1.0, M_PI - 0.5}; + const LatLng insideOnMeridian = {-0.1, M_PI}; + const LatLng outside = {1.0, M_PI - 0.5}; assertBBox(&geoloop, &expected, &insideOnMeridian, &outside); - const GeoPoint westInside = {0.1, M_PI - 0.05}; + const LatLng westInside = {0.1, M_PI - 0.05}; t_assert(bboxContains(&expected, &westInside), "Contains expected west inside point"); - const GeoPoint eastInside = {0.1, -M_PI + 0.05}; + const LatLng eastInside = {0.1, -M_PI + 0.05}; t_assert(bboxContains(&expected, &eastInside), "Contains expected east outside point"); - const GeoPoint westOutside = {0.1, M_PI - 0.5}; + const LatLng westOutside = {0.1, M_PI - 0.5}; t_assert(!bboxContains(&expected, &westOutside), "Does not contain expected west outside point"); - const GeoPoint eastOutside = {0.1, -M_PI + 0.5}; + const LatLng eastOutside = {0.1, -M_PI + 0.5}; t_assert(!bboxContains(&expected, &eastOutside), "Does not contain expected east outside point"); } TEST(edgeOnNorthPole) { - GeoPoint verts[] = {{M_PI_2 - 0.1, 0.1}, + LatLng verts[] = {{M_PI_2 - 0.1, 0.1}, {M_PI_2 - 0.1, 0.8}, {M_PI_2, 0.8}, {M_PI_2, 0.1}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {M_PI_2, M_PI_2 - 0.1, 0.8, 0.1}; - const GeoPoint inside = {M_PI_2 - 0.01, 0.4}; - const GeoPoint outside = {M_PI_2, 0.9}; + const LatLng inside = {M_PI_2 - 0.01, 0.4}; + const LatLng outside = {M_PI_2, 0.9}; assertBBox(&geoloop, &expected, &inside, &outside); } TEST(edgeOnSouthPole) { - GeoPoint verts[] = {{-M_PI_2 + 0.1, 0.1}, + LatLng verts[] = {{-M_PI_2 + 0.1, 0.1}, {-M_PI_2 + 0.1, 0.8}, {-M_PI_2, 0.8}, {-M_PI_2, 0.1}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {-M_PI_2 + 0.1, -M_PI_2, 0.8, 0.1}; - const GeoPoint inside = {-M_PI_2 + 0.01, 0.4}; - const GeoPoint outside = {-M_PI_2, 0.9}; + const LatLng inside = {-M_PI_2 + 0.01, 0.4}; + const LatLng outside = {-M_PI_2, 0.9}; assertBBox(&geoloop, &expected, &inside, &outside); } TEST(containsEdges) { const BBox bbox = {0.1, -0.1, 0.2, -0.2}; - GeoPoint points[] = { + LatLng points[] = { {0.1, 0.2}, {0.1, 0.0}, {0.1, -0.2}, {0.0, 0.2}, {-0.1, 0.2}, {-0.1, 0.0}, {-0.1, -0.2}, {0.0, -0.2}, }; @@ -147,7 +147,7 @@ SUITE(BBox) { TEST(containsEdgesTransmeridian) { const BBox bbox = {0.1, -0.1, -M_PI + 0.2, M_PI - 0.2}; - GeoPoint points[] = { + LatLng points[] = { {0.1, -M_PI + 0.2}, {0.1, M_PI}, {0.1, M_PI - 0.2}, {0.0, -M_PI + 0.2}, {-0.1, -M_PI + 0.2}, {-0.1, M_PI}, {-0.1, M_PI - 0.2}, {0.0, M_PI - 0.2}, @@ -161,51 +161,51 @@ SUITE(BBox) { } TEST(bboxCenterBasicQuandrants) { - GeoPoint center; + LatLng center; BBox bbox1 = {1.0, 0.8, 1.0, 0.8}; - GeoPoint expected1 = {0.9, 0.9}; + LatLng expected1 = {0.9, 0.9}; bboxCenter(&bbox1, ¢er); t_assert(geoAlmostEqual(¢er, &expected1), "pos/pos as expected"); BBox bbox2 = {-0.8, -1.0, 1.0, 0.8}; - GeoPoint expected2 = {-0.9, 0.9}; + LatLng expected2 = {-0.9, 0.9}; bboxCenter(&bbox2, ¢er); t_assert(geoAlmostEqual(¢er, &expected2), "neg/pos as expected"); BBox bbox3 = {1.0, 0.8, -0.8, -1.0}; - GeoPoint expected3 = {0.9, -0.9}; + LatLng expected3 = {0.9, -0.9}; bboxCenter(&bbox3, ¢er); t_assert(geoAlmostEqual(¢er, &expected3), "pos/neg as expected"); BBox bbox4 = {-0.8, -1.0, -0.8, -1.0}; - GeoPoint expected4 = {-0.9, -0.9}; + LatLng expected4 = {-0.9, -0.9}; bboxCenter(&bbox4, ¢er); t_assert(geoAlmostEqual(¢er, &expected4), "neg/neg as expected"); BBox bbox5 = {0.8, -0.8, 1.0, -1.0}; - GeoPoint expected5 = {0.0, 0.0}; + LatLng expected5 = {0.0, 0.0}; bboxCenter(&bbox5, ¢er); t_assert(geoAlmostEqual(¢er, &expected5), "around origin as expected"); } TEST(bboxCenterTransmeridian) { - GeoPoint center; + LatLng center; BBox bbox1 = {1.0, 0.8, -M_PI + 0.3, M_PI - 0.1}; - GeoPoint expected1 = {0.9, -M_PI + 0.1}; + LatLng expected1 = {0.9, -M_PI + 0.1}; bboxCenter(&bbox1, ¢er); t_assert(geoAlmostEqual(¢er, &expected1), "skew east as expected"); BBox bbox2 = {1.0, 0.8, -M_PI + 0.1, M_PI - 0.3}; - GeoPoint expected2 = {0.9, M_PI - 0.1}; + LatLng expected2 = {0.9, M_PI - 0.1}; bboxCenter(&bbox2, ¢er); t_assert(geoAlmostEqual(¢er, &expected2), "skew west as expected"); BBox bbox3 = {1.0, 0.8, -M_PI + 0.1, M_PI - 0.1}; - GeoPoint expected3 = {0.9, M_PI}; + LatLng expected3 = {0.9, M_PI}; bboxCenter(&bbox3, ¢er); t_assert(geoAlmostEqual(¢er, &expected3), "on antimeridian as expected"); diff --git a/src/apps/testapps/testCellToCenterChild.c b/src/apps/testapps/testCellToCenterChild.c index 428856455..49a2bd11a 100644 --- a/src/apps/testapps/testCellToCenterChild.c +++ b/src/apps/testapps/testCellToCenterChild.c @@ -22,14 +22,14 @@ SUITE(cellToCenterChild) { H3Index baseHex; - GeoPoint baseCentroid; + LatLng baseCentroid; setH3Index(&baseHex, 8, 4, 2); H3_EXPORT(cellToLatLng)(baseHex, &baseCentroid); TEST(propertyTests) { for (int res = 0; res <= MAX_H3_RES - 1; res++) { for (int childRes = res + 1; childRes <= MAX_H3_RES; childRes++) { - GeoPoint centroid; + LatLng centroid; H3Index h3Index; t_assertSuccess( H3_EXPORT(latLngToCell)(&baseCentroid, res, &h3Index)); diff --git a/src/apps/testapps/testCellToLatLng.c b/src/apps/testapps/testCellToLatLng.c index 65bf46a38..30193a03b 100644 --- a/src/apps/testapps/testCellToLatLng.c +++ b/src/apps/testapps/testCellToLatLng.c @@ -33,10 +33,10 @@ #include "test.h" #include "utility.h" -void assertExpected(H3Index h1, const GeoPoint* g1) { +void assertExpected(H3Index h1, const LatLng* g1) { const double epsilon = 0.000001 * M_PI_180; // convert H3 to lat/lon and verify - GeoPoint g2; + LatLng g2; H3_EXPORT(cellToLatLng)(h1, &g2); t_assert(geoAlmostEqualThreshold(&g2, g1, epsilon), @@ -75,7 +75,7 @@ int main(int argc, char* argv[]) { H3Index h3; h3 = H3_EXPORT(stringToH3)(h3Str); - GeoPoint coord; + LatLng coord; setGeoDegs(&coord, latDegs, lonDegs); assertExpected(h3, &coord); diff --git a/src/apps/testapps/testCellToParent.c b/src/apps/testapps/testCellToParent.c index 5ca8e6554..774b0ad4f 100644 --- a/src/apps/testapps/testCellToParent.c +++ b/src/apps/testapps/testCellToParent.c @@ -20,7 +20,7 @@ #include "test.h" SUITE(cellToParent) { - GeoPoint sf = {0.659966917655, 2 * 3.14159 - 2.1364398519396}; + LatLng sf = {0.659966917655, 2 * 3.14159 - 2.1364398519396}; TEST(ancestorsForEachRes) { H3Index child; diff --git a/src/apps/testapps/testDirectedEdge.c b/src/apps/testapps/testDirectedEdge.c index 2b1422062..9844e2f8f 100644 --- a/src/apps/testapps/testDirectedEdge.c +++ b/src/apps/testapps/testDirectedEdge.c @@ -28,7 +28,7 @@ #include "utility.h" // Fixtures -static GeoPoint sfGeo = {0.659966917655, -2.1364398519396}; +static LatLng sfGeo = {0.659966917655, -2.1364398519396}; SUITE(directedEdge) { TEST(areNeighborCells) { @@ -338,7 +338,7 @@ SUITE(directedEdge) { // Test that invalid inputs do not cause crashes. t_assert(H3_EXPORT(exactEdgeLengthRads)(0) == 0, "Invalid edge has zero length"); - GeoPoint zero = {0, 0}; + LatLng zero = {0, 0}; H3Index h3; t_assertSuccess(H3_EXPORT(latLngToCell)(&zero, 0, &h3)); t_assert(H3_EXPORT(exactEdgeLengthRads)(h3) == 0, diff --git a/src/apps/testapps/testGeoPoint.c b/src/apps/testapps/testGeoPoint.c index c7890d793..f5bf1c467 100644 --- a/src/apps/testapps/testGeoPoint.c +++ b/src/apps/testapps/testGeoPoint.c @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** @file testGeoPoint.c +/** @file testLatLng.c * @brief Tests geographic coordinate functions * - * usage: `testGeoPoint` + * usage: `testLatLng` */ #include @@ -56,9 +56,9 @@ SUITE(geoPoint) { } TEST(pointDistRads) { - GeoPoint p1; + LatLng p1; setGeoDegs(&p1, 10, 10); - GeoPoint p2; + LatLng p2; setGeoDegs(&p2, 0, 10); // TODO: Epsilon is relatively large @@ -70,8 +70,8 @@ SUITE(geoPoint) { } TEST(geoAlmostEqualThreshold) { - GeoPoint a = {15, 10}; - GeoPoint b = {15, 10}; + LatLng a = {15, 10}; + LatLng b = {15, 10}; t_assert(geoAlmostEqualThreshold(&a, &b, DBL_EPSILON), "same point"); b.lat = 15.00001; @@ -107,9 +107,9 @@ SUITE(geoPoint) { } TEST(_geoAzDistanceRads_noop) { - GeoPoint start = {15, 10}; - GeoPoint out; - GeoPoint expected = {15, 10}; + LatLng start = {15, 10}; + LatLng out; + LatLng expected = {15, 10}; _geoAzDistanceRads(&start, 0, 0, &out); t_assert(geoAlmostEqual(&expected, &out), @@ -117,9 +117,9 @@ SUITE(geoPoint) { } TEST(_geoAzDistanceRads_dueNorthSouth) { - GeoPoint start; - GeoPoint out; - GeoPoint expected; + LatLng start; + LatLng out; + LatLng expected; // Due north to north pole setGeoDegs(&start, 45, 1); @@ -152,9 +152,9 @@ SUITE(geoPoint) { } TEST(_geoAzDistanceRads_poleToPole) { - GeoPoint start; - GeoPoint out; - GeoPoint expected; + LatLng start; + LatLng out; + LatLng expected; // Azimuth doesn't really matter in this case. Any azimuth from the // north pole is south, any azimuth from the south pole is north. @@ -175,9 +175,9 @@ SUITE(geoPoint) { } TEST(_geoAzDistanceRads_invertible) { - GeoPoint start; + LatLng start; setGeoDegs(&start, 15, 10); - GeoPoint out; + LatLng out; double azimuth = H3_EXPORT(degsToRads)(20); double degrees180 = H3_EXPORT(degsToRads)(180); @@ -188,7 +188,7 @@ SUITE(geoPoint) { EPSILON_RAD, "moved distance is as expected"); - GeoPoint start2 = out; + LatLng start2 = out; _geoAzDistanceRads(&start2, azimuth + degrees180, distance, &out); // TODO: Epsilon is relatively large t_assert(H3_EXPORT(pointDistRads)(&start, &out) < 0.01, @@ -196,8 +196,8 @@ SUITE(geoPoint) { } TEST(pointDistRads_wrappedLongitude) { - const GeoPoint negativeLongitude = {.lat = 0, .lon = -(M_PI + M_PI_2)}; - const GeoPoint zero = {.lat = 0, .lon = 0}; + const LatLng negativeLongitude = {.lat = 0, .lon = -(M_PI + M_PI_2)}; + const LatLng zero = {.lat = 0, .lon = 0}; t_assert(fabs(M_PI_2 - H3_EXPORT(pointDistRads)(&negativeLongitude, &zero)) < EPSILON_RAD, diff --git a/src/apps/testapps/testGridDisk.c b/src/apps/testapps/testGridDisk.c index d652e6c9a..29880a28a 100644 --- a/src/apps/testapps/testGridDisk.c +++ b/src/apps/testapps/testGridDisk.c @@ -75,7 +75,7 @@ static void gridDisk_equals_gridDiskDistancesSafe_assertions(H3Index h3) { SUITE(gridDisk) { TEST(gridDisk0) { - GeoPoint sf = {0.659966917655, 2 * 3.14159 - 2.1364398519396}; + LatLng sf = {0.659966917655, 2 * 3.14159 - 2.1364398519396}; H3Index sfHex0; t_assertSuccess(H3_EXPORT(latLngToCell)(&sf, 0, &sfHex0)); diff --git a/src/apps/testapps/testGridDisksUnsafe.c b/src/apps/testapps/testGridDisksUnsafe.c index d1fb1c911..9ac2fdbc8 100644 --- a/src/apps/testapps/testGridDisksUnsafe.c +++ b/src/apps/testapps/testGridDisksUnsafe.c @@ -20,7 +20,7 @@ #include "test.h" SUITE(gridDisksUnsafe) { - GeoPoint sf = {0.659966917655, 2 * 3.14159 - 2.1364398519396}; + LatLng sf = {0.659966917655, 2 * 3.14159 - 2.1364398519396}; H3Index sfHex; t_assertSuccess(H3_EXPORT(latLngToCell)(&sf, 9, &sfHex)); H3Index* sfHexPtr = &sfHex; diff --git a/src/apps/testapps/testGridRingUnsafe.c b/src/apps/testapps/testGridRingUnsafe.c index 31d993c3c..d4462e410 100644 --- a/src/apps/testapps/testGridRingUnsafe.c +++ b/src/apps/testapps/testGridRingUnsafe.c @@ -22,7 +22,7 @@ #include "test.h" SUITE(gridRingUnsafe) { - GeoPoint sf = {0.659966917655, 2 * 3.14159 - 2.1364398519396}; + LatLng sf = {0.659966917655, 2 * 3.14159 - 2.1364398519396}; H3Index sfHex; t_assertSuccess(H3_EXPORT(latLngToCell)(&sf, 9, &sfHex)); diff --git a/src/apps/testapps/testH3Api.c b/src/apps/testapps/testH3Api.c index e90d42455..7064dbcfd 100644 --- a/src/apps/testapps/testH3Api.c +++ b/src/apps/testapps/testH3Api.c @@ -30,7 +30,7 @@ SUITE(h3Api) { TEST(latLngToCell_res) { H3Index h; - GeoPoint anywhere = {0, 0}; + LatLng anywhere = {0, 0}; t_assert(H3_EXPORT(latLngToCell)(&anywhere, -1, &h) == E_RES_DOMAIN, "resolution below 0 is invalid"); @@ -40,9 +40,9 @@ SUITE(h3Api) { TEST(latLngToCell_coord) { H3Index h; - GeoPoint invalidLat = {NAN, 0}; - GeoPoint invalidLon = {0, NAN}; - GeoPoint invalidLatLon = {INFINITY, -INFINITY}; + LatLng invalidLat = {NAN, 0}; + LatLng invalidLon = {0, NAN}; + LatLng invalidLatLon = {INFINITY, -INFINITY}; t_assert(H3_EXPORT(latLngToCell)(&invalidLat, 1, &h) == E_LATLON_DOMAIN, "invalid latitude is rejected"); @@ -113,7 +113,7 @@ SUITE(h3Api) { } TEST(h3ToGeoInvalid) { - GeoPoint coord; + LatLng coord; H3_EXPORT(cellToLatLng)(0x7fffffffffffffff, &coord); // Test is this should not crash (should return an error in the future) } diff --git a/src/apps/testapps/testH3CellArea.c b/src/apps/testapps/testH3CellArea.c index 00b5c3f19..cd774a4b6 100644 --- a/src/apps/testapps/testH3CellArea.c +++ b/src/apps/testapps/testH3CellArea.c @@ -35,7 +35,7 @@ static const double areasKm2[] = { SUITE(h3CellArea) { TEST(specific_cell_area) { - GeoPoint gc = {0.0, 0.0}; + LatLng gc = {0.0, 0.0}; for (int res = 0; res <= MAX_H3_RES - 1; res++) { H3Index cell; t_assertSuccess(H3_EXPORT(latLngToCell)(&gc, res, &cell)); diff --git a/src/apps/testapps/testH3CellAreaExhaustive.c b/src/apps/testapps/testH3CellAreaExhaustive.c index dcc73b374..7b51c3b69 100644 --- a/src/apps/testapps/testH3CellAreaExhaustive.c +++ b/src/apps/testapps/testH3CellAreaExhaustive.c @@ -41,7 +41,7 @@ * @param edge H3 directed edge denoting neighboring cells */ static void haversine_assert(H3Index edge) { - GeoPoint a, b; + LatLng a, b; H3Index origin, destination; origin = H3_EXPORT(getDirectedEdgeOrigin)(edge); diff --git a/src/apps/testapps/testH3Index.c b/src/apps/testapps/testH3Index.c index 8cc158668..18a43efc1 100644 --- a/src/apps/testapps/testH3Index.c +++ b/src/apps/testapps/testH3Index.c @@ -32,13 +32,13 @@ SUITE(h3Index) { TEST(latLngToCellExtremeCoordinates) { H3Index h; // Check that none of these cause crashes. - GeoPoint g = {0, 1E45}; + LatLng g = {0, 1E45}; t_assertSuccess(H3_EXPORT(latLngToCell)(&g, 14, &h)); - GeoPoint g2 = {1E46, 1E45}; + LatLng g2 = {1E46, 1E45}; t_assertSuccess(H3_EXPORT(latLngToCell)(&g2, 15, &h)); - GeoPoint g4; + LatLng g4; setGeoDegs(&g4, 2, -3E39); t_assertSuccess(H3_EXPORT(latLngToCell)(&g4, 0, &h)); } @@ -68,9 +68,9 @@ SUITE(h3Index) { TEST(isValidCellAtResolution) { for (int i = 0; i <= MAX_H3_RES; i++) { - GeoPoint GeoPoint = {0, 0}; + LatLng LatLng = {0, 0}; H3Index h3; - t_assertSuccess(H3_EXPORT(latLngToCell)(&GeoPoint, i, &h3)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&LatLng, i, &h3)); char failureMessage[BUFF_SIZE]; sprintf(failureMessage, "isValidCell failed on resolution %d", i); t_assert(H3_EXPORT(isValidCell)(h3), failureMessage); @@ -78,9 +78,9 @@ SUITE(h3Index) { } TEST(isValidCellDigits) { - GeoPoint GeoPoint = {0, 0}; + LatLng LatLng = {0, 0}; H3Index h3; - t_assertSuccess(H3_EXPORT(latLngToCell)(&GeoPoint, 1, &h3)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&LatLng, 1, &h3)); // Set a bit for an unused digit to something else. h3 ^= 1; t_assert(!H3_EXPORT(isValidCell)(h3), @@ -205,7 +205,7 @@ SUITE(h3Index) { } TEST(isResClassIII) { - GeoPoint coord = {0, 0}; + LatLng coord = {0, 0}; for (int i = 0; i <= MAX_H3_RES; i++) { H3Index h; t_assertSuccess(H3_EXPORT(latLngToCell)(&coord, i, &h)); diff --git a/src/apps/testapps/testLatLngToCell.c b/src/apps/testapps/testLatLngToCell.c index 5831dcead..458602e34 100644 --- a/src/apps/testapps/testLatLngToCell.c +++ b/src/apps/testapps/testLatLngToCell.c @@ -32,7 +32,7 @@ #include "test.h" #include "utility.h" -static void assertExpected(H3Index h1, const GeoPoint* g1) { +static void assertExpected(H3Index h1, const LatLng* g1) { // convert lat/lon to H3 and verify int res = H3_EXPORT(getResolution)(h1); H3Index h2; @@ -66,7 +66,7 @@ int main(int argc, char* argv[]) { H3Index h3; h3 = H3_EXPORT(stringToH3)(h3Str); - GeoPoint coord; + LatLng coord; setGeoDegs(&coord, latDegs, lonDegs); assertExpected(h3, &coord); diff --git a/src/apps/testapps/testLinkedGeo.c b/src/apps/testapps/testLinkedGeo.c index c94136cdc..fed9203fc 100644 --- a/src/apps/testapps/testLinkedGeo.c +++ b/src/apps/testapps/testLinkedGeo.c @@ -23,10 +23,10 @@ #include "test.h" // Fixtures -static GeoPoint vertex1; -static GeoPoint vertex2; -static GeoPoint vertex3; -static GeoPoint vertex4; +static LatLng vertex1; +static LatLng vertex2; +static LatLng vertex3; +static LatLng vertex4; SUITE(linkedGeo) { setGeoDegs(&vertex1, 87.372002166, 166.160981117); diff --git a/src/apps/testapps/testPolygon.c b/src/apps/testapps/testPolygon.c index 0cf91e5ad..bd8a2739a 100644 --- a/src/apps/testapps/testPolygon.c +++ b/src/apps/testapps/testPolygon.c @@ -26,12 +26,12 @@ #include "test.h" // Fixtures -static GeoPoint sfVerts[] = { +static LatLng sfVerts[] = { {0.659966917655, -2.1364398519396}, {0.6595011102219, -2.1359434279405}, {0.6583348114025, -2.1354884206045}, {0.6581220034068, -2.1382437718946}, {0.6594479998527, -2.1384597563896}, {0.6599990002976, -2.1376771158464}}; -static void createLinkedLoop(LinkedGeoLoop* loop, GeoPoint* verts, +static void createLinkedLoop(LinkedGeoLoop* loop, LatLng* verts, int numVerts) { *loop = (LinkedGeoLoop){0}; for (int i = 0; i < numVerts; i++) { @@ -43,8 +43,8 @@ SUITE(polygon) { TEST(pointInsideGeoLoop) { GeoLoop geoloop = {.numVerts = 6, .verts = sfVerts}; - GeoPoint inside = {0.659, -2.136}; - GeoPoint somewhere = {1, 2}; + LatLng inside = {0.659, -2.136}; + LatLng somewhere = {1, 2}; BBox bbox; bboxFromGeoLoop(&geoloop, &bbox); @@ -60,16 +60,16 @@ SUITE(polygon) { } TEST(pointInsideGeoLoopTransmeridian) { - GeoPoint verts[] = {{0.01, -M_PI + 0.01}, + LatLng verts[] = {{0.01, -M_PI + 0.01}, {0.01, M_PI - 0.01}, {-0.01, M_PI - 0.01}, {-0.01, -M_PI + 0.01}}; GeoLoop transMeridianGeoLoop = {.numVerts = 4, .verts = verts}; - GeoPoint eastPoint = {0.001, -M_PI + 0.001}; - GeoPoint eastPointOutside = {0.001, -M_PI + 0.1}; - GeoPoint westPoint = {0.001, M_PI - 0.001}; - GeoPoint westPointOutside = {0.001, M_PI - 0.1}; + LatLng eastPoint = {0.001, -M_PI + 0.001}; + LatLng eastPointOutside = {0.001, -M_PI + 0.1}; + LatLng westPoint = {0.001, M_PI - 0.001}; + LatLng westPointOutside = {0.001, M_PI - 0.1}; BBox bbox; bboxFromGeoLoop(&transMeridianGeoLoop, &bbox); @@ -89,8 +89,8 @@ SUITE(polygon) { } TEST(pointInsideLinkedGeoLoop) { - GeoPoint somewhere = {1, 2}; - GeoPoint inside = {0.659, -2.136}; + LatLng somewhere = {1, 2}; + LatLng inside = {0.659, -2.136}; LinkedGeoLoop loop; createLinkedLoop(&loop, &sfVerts[0], 6); @@ -107,7 +107,7 @@ SUITE(polygon) { } TEST(bboxFromGeoLoop) { - GeoPoint verts[] = {{0.8, 0.3}, {0.7, 0.6}, {1.1, 0.7}, {1.0, 0.2}}; + LatLng verts[] = {{0.8, 0.3}, {0.7, 0.6}, {1.1, 0.7}, {1.0, 0.2}}; GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {1.1, 0.7, 0.7, 0.2}; @@ -118,7 +118,7 @@ SUITE(polygon) { } TEST(bboxFromGeoLoopTransmeridian) { - GeoPoint verts[] = {{0.1, -M_PI + 0.1}, {0.1, M_PI - 0.1}, + LatLng verts[] = {{0.1, -M_PI + 0.1}, {0.1, M_PI - 0.1}, {0.05, M_PI - 0.2}, {-0.1, M_PI - 0.1}, {-0.1, -M_PI + 0.1}, {-0.05, -M_PI + 0.2}}; GeoLoop geoloop = {.numVerts = 6, .verts = verts}; @@ -145,7 +145,7 @@ SUITE(polygon) { } TEST(bboxesFromGeoPolygon) { - GeoPoint verts[] = {{0.8, 0.3}, {0.7, 0.6}, {1.1, 0.7}, {1.0, 0.2}}; + LatLng verts[] = {{0.8, 0.3}, {0.7, 0.6}, {1.1, 0.7}, {1.0, 0.2}}; GeoLoop geoloop = {.numVerts = 4, .verts = verts}; GeoPolygon polygon = {.geoloop = geoloop, .numHoles = 0}; @@ -159,11 +159,11 @@ SUITE(polygon) { } TEST(bboxesFromGeoPolygonHole) { - GeoPoint verts[] = {{0.8, 0.3}, {0.7, 0.6}, {1.1, 0.7}, {1.0, 0.2}}; + LatLng verts[] = {{0.8, 0.3}, {0.7, 0.6}, {1.1, 0.7}, {1.0, 0.2}}; GeoLoop geoloop = {.numVerts = 4, .verts = verts}; // not a real hole, but doesn't matter for the test - GeoPoint holeVerts[] = {{0.9, 0.3}, {0.9, 0.5}, {1.0, 0.7}, {0.9, 0.3}}; + LatLng holeVerts[] = {{0.9, 0.3}, {0.9, 0.5}, {1.0, 0.7}, {0.9, 0.3}}; GeoLoop holeGeoLoop = {.numVerts = 4, .verts = holeVerts}; GeoPolygon polygon = { @@ -182,7 +182,7 @@ SUITE(polygon) { } TEST(bboxFromLinkedGeoLoop) { - GeoPoint verts[] = {{0.8, 0.3}, {0.7, 0.6}, {1.1, 0.7}, {1.0, 0.2}}; + LatLng verts[] = {{0.8, 0.3}, {0.7, 0.6}, {1.1, 0.7}, {1.0, 0.2}}; LinkedGeoLoop loop; createLinkedLoop(&loop, &verts[0], 4); @@ -210,7 +210,7 @@ SUITE(polygon) { } TEST(isClockwiseGeoLoop) { - GeoPoint verts[] = {{0, 0}, {0.1, 0.1}, {0, 0.1}}; + LatLng verts[] = {{0, 0}, {0.1, 0.1}, {0, 0.1}}; GeoLoop geoloop = {.numVerts = 3, .verts = verts}; t_assert(isClockwiseGeoLoop(&geoloop), @@ -218,7 +218,7 @@ SUITE(polygon) { } TEST(isClockwiseLinkedGeoLoop) { - GeoPoint verts[] = {{0.1, 0.1}, {0.2, 0.2}, {0.1, 0.2}}; + LatLng verts[] = {{0.1, 0.1}, {0.2, 0.2}, {0.1, 0.2}}; LinkedGeoLoop loop; createLinkedLoop(&loop, &verts[0], 3); @@ -229,7 +229,7 @@ SUITE(polygon) { } TEST(isNotClockwiseLinkedGeoLoop) { - GeoPoint verts[] = {{0, 0}, {0, 0.4}, {0.4, 0.4}, {0.4, 0}}; + LatLng verts[] = {{0, 0}, {0, 0.4}, {0.4, 0.4}, {0.4, 0}}; LinkedGeoLoop loop; createLinkedLoop(&loop, &verts[0], 4); @@ -240,7 +240,7 @@ SUITE(polygon) { } TEST(isClockwiseGeoLoopTransmeridian) { - GeoPoint verts[] = {{0.4, M_PI - 0.1}, + LatLng verts[] = {{0.4, M_PI - 0.1}, {0.4, -M_PI + 0.1}, {-0.4, -M_PI + 0.1}, {-0.4, M_PI - 0.1}}; @@ -251,7 +251,7 @@ SUITE(polygon) { } TEST(isClockwiseLinkedGeoLoopTransmeridian) { - GeoPoint verts[] = {{0.4, M_PI - 0.1}, + LatLng verts[] = {{0.4, M_PI - 0.1}, {0.4, -M_PI + 0.1}, {-0.4, -M_PI + 0.1}, {-0.4, M_PI - 0.1}}; @@ -265,7 +265,7 @@ SUITE(polygon) { } TEST(isNotClockwiseLinkedGeoLoopTransmeridian) { - GeoPoint verts[] = {{0.4, M_PI - 0.1}, + LatLng verts[] = {{0.4, M_PI - 0.1}, {-0.4, M_PI - 0.1}, {-0.4, -M_PI + 0.1}, {0.4, -M_PI + 0.1}}; @@ -279,7 +279,7 @@ SUITE(polygon) { } TEST(normalizeMultiPolygonSingle) { - GeoPoint verts[] = {{0, 0}, {0, 1}, {1, 1}}; + LatLng verts[] = {{0, 0}, {0, 1}, {1, 1}}; LinkedGeoLoop* outer = malloc(sizeof(*outer)); assert(outer != NULL); @@ -300,13 +300,13 @@ SUITE(polygon) { } TEST(normalizeMultiPolygonTwoOuterLoops) { - GeoPoint verts1[] = {{0, 0}, {0, 1}, {1, 1}}; + LatLng verts1[] = {{0, 0}, {0, 1}, {1, 1}}; LinkedGeoLoop* outer1 = malloc(sizeof(*outer1)); assert(outer1 != NULL); createLinkedLoop(outer1, &verts1[0], 3); - GeoPoint verts2[] = {{2, 2}, {2, 3}, {3, 3}}; + LatLng verts2[] = {{2, 2}, {2, 3}, {3, 3}}; LinkedGeoLoop* outer2 = malloc(sizeof(*outer2)); assert(outer2 != NULL); @@ -330,13 +330,13 @@ SUITE(polygon) { } TEST(normalizeMultiPolygonOneHole) { - GeoPoint verts[] = {{0, 0}, {0, 3}, {3, 3}, {3, 0}}; + LatLng verts[] = {{0, 0}, {0, 3}, {3, 3}, {3, 0}}; LinkedGeoLoop* outer = malloc(sizeof(*outer)); assert(outer != NULL); createLinkedLoop(outer, &verts[0], 4); - GeoPoint verts2[] = {{1, 1}, {2, 2}, {1, 2}}; + LatLng verts2[] = {{1, 1}, {2, 2}, {1, 2}}; LinkedGeoLoop* inner = malloc(sizeof(*inner)); assert(inner != NULL); @@ -360,19 +360,19 @@ SUITE(polygon) { } TEST(normalizeMultiPolygonTwoHoles) { - GeoPoint verts[] = {{0, 0}, {0, 0.4}, {0.4, 0.4}, {0.4, 0}}; + LatLng verts[] = {{0, 0}, {0, 0.4}, {0.4, 0.4}, {0.4, 0}}; LinkedGeoLoop* outer = malloc(sizeof(*outer)); assert(outer != NULL); createLinkedLoop(outer, &verts[0], 4); - GeoPoint verts2[] = {{0.1, 0.1}, {0.2, 0.2}, {0.1, 0.2}}; + LatLng verts2[] = {{0.1, 0.1}, {0.2, 0.2}, {0.1, 0.2}}; LinkedGeoLoop* inner1 = malloc(sizeof(*inner1)); assert(inner1 != NULL); createLinkedLoop(inner1, &verts2[0], 3); - GeoPoint verts3[] = {{0.2, 0.2}, {0.3, 0.3}, {0.2, 0.3}}; + LatLng verts3[] = {{0.2, 0.2}, {0.3, 0.3}, {0.2, 0.3}}; LinkedGeoLoop* inner2 = malloc(sizeof(*inner2)); assert(inner2 != NULL); @@ -397,22 +397,22 @@ SUITE(polygon) { } TEST(normalizeMultiPolygonTwoDonuts) { - GeoPoint verts[] = {{0, 0}, {0, 3}, {3, 3}, {3, 0}}; + LatLng verts[] = {{0, 0}, {0, 3}, {3, 3}, {3, 0}}; LinkedGeoLoop* outer = malloc(sizeof(*outer)); assert(outer != NULL); createLinkedLoop(outer, &verts[0], 4); - GeoPoint verts2[] = {{1, 1}, {2, 2}, {1, 2}}; + LatLng verts2[] = {{1, 1}, {2, 2}, {1, 2}}; LinkedGeoLoop* inner = malloc(sizeof(*inner)); assert(inner != NULL); createLinkedLoop(inner, &verts2[0], 3); - GeoPoint verts3[] = {{0, 0}, {0, -3}, {-3, -3}, {-3, 0}}; + LatLng verts3[] = {{0, 0}, {0, -3}, {-3, -3}, {-3, 0}}; LinkedGeoLoop* outer2 = malloc(sizeof(*outer)); assert(outer2 != NULL); createLinkedLoop(outer2, &verts3[0], 4); - GeoPoint verts4[] = {{-1, -1}, {-2, -2}, {-1, -2}}; + LatLng verts4[] = {{-1, -1}, {-2, -2}, {-1, -2}}; LinkedGeoLoop* inner2 = malloc(sizeof(*inner)); assert(inner2 != NULL); createLinkedLoop(inner2, &verts4[0], 3); @@ -445,24 +445,24 @@ SUITE(polygon) { } TEST(normalizeMultiPolygonNestedDonuts) { - GeoPoint verts[] = {{0.2, 0.2}, {0.2, -0.2}, {-0.2, -0.2}, {-0.2, 0.2}}; + LatLng verts[] = {{0.2, 0.2}, {0.2, -0.2}, {-0.2, -0.2}, {-0.2, 0.2}}; LinkedGeoLoop* outer = malloc(sizeof(*outer)); assert(outer != NULL); createLinkedLoop(outer, &verts[0], 4); - GeoPoint verts2[] = { + LatLng verts2[] = { {0.1, 0.1}, {-0.1, 0.1}, {-0.1, -0.1}, {0.1, -0.1}}; LinkedGeoLoop* inner = malloc(sizeof(*inner)); assert(inner != NULL); createLinkedLoop(inner, &verts2[0], 4); - GeoPoint verts3[] = { + LatLng verts3[] = { {0.6, 0.6}, {0.6, -0.6}, {-0.6, -0.6}, {-0.6, 0.6}}; LinkedGeoLoop* outerBig = malloc(sizeof(*outerBig)); assert(outerBig != NULL); createLinkedLoop(outerBig, &verts3[0], 4); - GeoPoint verts4[] = { + LatLng verts4[] = { {0.5, 0.5}, {-0.5, 0.5}, {-0.5, -0.5}, {0.5, -0.5}}; LinkedGeoLoop* innerBig = malloc(sizeof(*innerBig)); assert(innerBig != NULL); @@ -492,13 +492,13 @@ SUITE(polygon) { } TEST(normalizeMultiPolygonNoOuterLoops) { - GeoPoint verts1[] = {{0, 0}, {1, 1}, {0, 1}}; + LatLng verts1[] = {{0, 0}, {1, 1}, {0, 1}}; LinkedGeoLoop* outer1 = malloc(sizeof(*outer1)); assert(outer1 != NULL); createLinkedLoop(outer1, &verts1[0], 3); - GeoPoint verts2[] = {{2, 2}, {3, 3}, {2, 3}}; + LatLng verts2[] = {{2, 2}, {3, 3}, {2, 3}}; LinkedGeoLoop* outer2 = malloc(sizeof(*outer2)); assert(outer2 != NULL); @@ -521,13 +521,13 @@ SUITE(polygon) { } TEST(normalizeMultiPolygonAlreadyNormalized) { - GeoPoint verts1[] = {{0, 0}, {0, 1}, {1, 1}}; + LatLng verts1[] = {{0, 0}, {0, 1}, {1, 1}}; LinkedGeoLoop* outer1 = malloc(sizeof(*outer1)); assert(outer1 != NULL); createLinkedLoop(outer1, &verts1[0], 3); - GeoPoint verts2[] = {{2, 2}, {2, 3}, {3, 3}}; + LatLng verts2[] = {{2, 2}, {2, 3}, {3, 3}}; LinkedGeoLoop* outer2 = malloc(sizeof(*outer2)); assert(outer2 != NULL); @@ -556,13 +556,13 @@ SUITE(polygon) { } TEST(normalizeMultiPolygon_unassignedHole) { - GeoPoint verts[] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}}; + LatLng verts[] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}}; LinkedGeoLoop* outer = malloc(sizeof(*outer)); assert(outer != NULL); createLinkedLoop(outer, &verts[0], 4); - GeoPoint verts2[] = {{2, 2}, {3, 3}, {2, 3}}; + LatLng verts2[] = {{2, 2}, {3, 3}, {2, 3}}; LinkedGeoLoop* inner = malloc(sizeof(*inner)); assert(inner != NULL); diff --git a/src/apps/testapps/testPolygonToCells.c b/src/apps/testapps/testPolygonToCells.c index 762671111..802069333 100644 --- a/src/apps/testapps/testPolygonToCells.c +++ b/src/apps/testapps/testPolygonToCells.c @@ -24,20 +24,20 @@ #include "utility.h" // Fixtures -static GeoPoint sfVerts[] = { +static LatLng sfVerts[] = { {0.659966917655, -2.1364398519396}, {0.6595011102219, -2.1359434279405}, {0.6583348114025, -2.1354884206045}, {0.6581220034068, -2.1382437718946}, {0.6594479998527, -2.1384597563896}, {0.6599990002976, -2.1376771158464}}; static GeoLoop sfGeoLoop = {.numVerts = 6, .verts = sfVerts}; static GeoPolygon sfGeoPolygon; -static GeoPoint holeVerts[] = {{0.6595072188743, -2.1371053983433}, +static LatLng holeVerts[] = {{0.6595072188743, -2.1371053983433}, {0.6591482046471, -2.1373141048153}, {0.6592295020837, -2.1365222838402}}; static GeoLoop holeGeoLoop = {.numVerts = 3, .verts = holeVerts}; static GeoPolygon holeGeoPolygon; -static GeoPoint emptyVerts[] = {{0.659966917655, -2.1364398519394}, +static LatLng emptyVerts[] = {{0.659966917655, -2.1364398519394}, {0.659966917655, -2.1364398519395}, {0.659966917655, -2.1364398519396}}; static GeoLoop emptyGeoLoop = {.numVerts = 3, .verts = emptyVerts}; @@ -172,13 +172,13 @@ SUITE(polygonToCells) { } TEST(polygonToCellsExact) { - GeoPoint somewhere = {1, 2}; + LatLng somewhere = {1, 2}; H3Index origin; t_assertSuccess(H3_EXPORT(latLngToCell)(&somewhere, 9, &origin)); CellBoundary boundary; H3_EXPORT(cellToBoundary)(origin, &boundary); - GeoPoint* verts = calloc(boundary.numVerts + 1, sizeof(GeoPoint)); + LatLng* verts = calloc(boundary.numVerts + 1, sizeof(LatLng)); for (int i = 0; i < boundary.numVerts; i++) { verts[i] = boundary.verts[i]; } @@ -203,14 +203,14 @@ SUITE(polygonToCells) { } TEST(polygonToCellsTransmeridian) { - GeoPoint primeMeridianVerts[] = { + LatLng primeMeridianVerts[] = { {0.01, 0.01}, {0.01, -0.01}, {-0.01, -0.01}, {-0.01, 0.01}}; GeoLoop primeMeridianGeoLoop = {.numVerts = 4, .verts = primeMeridianVerts}; GeoPolygon primeMeridianGeoPolygon = {.geoloop = primeMeridianGeoLoop, .numHoles = 0}; - GeoPoint transMeridianVerts[] = {{0.01, -M_PI + 0.01}, + LatLng transMeridianVerts[] = {{0.01, -M_PI + 0.01}, {0.01, M_PI - 0.01}, {-0.01, M_PI - 0.01}, {-0.01, -M_PI + 0.01}}; @@ -219,7 +219,7 @@ SUITE(polygonToCells) { GeoPolygon transMeridianGeoPolygon = {.geoloop = transMeridianGeoLoop, .numHoles = 0}; - GeoPoint transMeridianHoleVerts[] = {{0.005, -M_PI + 0.005}, + LatLng transMeridianHoleVerts[] = {{0.005, -M_PI + 0.005}, {0.005, M_PI - 0.005}, {-0.005, M_PI - 0.005}, {-0.005, -M_PI + 0.005}}; @@ -292,7 +292,7 @@ SUITE(polygonToCells) { // This polygon is "complex" in that it has > 4 vertices - this // tests for a bug that was taking the max and min longitude as // the bounds for transmeridian polygons - GeoPoint verts[] = {{0.1, -M_PI + 0.00001}, {0.1, M_PI - 0.00001}, + LatLng verts[] = {{0.1, -M_PI + 0.00001}, {0.1, M_PI - 0.00001}, {0.05, M_PI - 0.2}, {-0.1, M_PI - 0.00001}, {-0.1, -M_PI + 0.00001}, {-0.05, -M_PI + 0.2}}; GeoLoop geoloop = {.numVerts = 6, .verts = verts}; @@ -314,29 +314,29 @@ SUITE(polygonToCells) { TEST(polygonToCellsPentagon) { H3Index pentagon; setH3Index(&pentagon, 9, 24, 0); - GeoPoint coord; + LatLng coord; H3_EXPORT(cellToLatLng)(pentagon, &coord); // Length of half an edge of the polygon, in radians double edgeLength2 = H3_EXPORT(degsToRads)(0.001); - GeoPoint boundingTopRigt = coord; + LatLng boundingTopRigt = coord; boundingTopRigt.lat += edgeLength2; boundingTopRigt.lon += edgeLength2; - GeoPoint boundingTopLeft = coord; + LatLng boundingTopLeft = coord; boundingTopLeft.lat += edgeLength2; boundingTopLeft.lon -= edgeLength2; - GeoPoint boundingBottomRight = coord; + LatLng boundingBottomRight = coord; boundingBottomRight.lat -= edgeLength2; boundingBottomRight.lon += edgeLength2; - GeoPoint boundingBottomLeft = coord; + LatLng boundingBottomLeft = coord; boundingBottomLeft.lat -= edgeLength2; boundingBottomLeft.lon -= edgeLength2; - GeoPoint verts[] = {boundingBottomLeft, boundingTopLeft, + LatLng verts[] = {boundingBottomLeft, boundingTopLeft, boundingTopRigt, boundingBottomRight}; GeoLoop geoloop; diff --git a/src/apps/testapps/testPolygonToCellsReported.c b/src/apps/testapps/testPolygonToCellsReported.c index 9fa6b2f64..6a381c91e 100644 --- a/src/apps/testapps/testPolygonToCellsReported.c +++ b/src/apps/testapps/testPolygonToCellsReported.c @@ -29,11 +29,11 @@ SUITE(polygonToCells_reported) { // https://github.com/uber/h3-js/issues/76#issuecomment-561204505 TEST(entireWorld) { // TODO: Fails for a single worldwide polygon - GeoPoint worldVerts[] = { + LatLng worldVerts[] = { {-M_PI_2, -M_PI}, {M_PI_2, -M_PI}, {M_PI_2, 0}, {-M_PI_2, 0}}; GeoLoop worldGeoLoop = {.numVerts = 4, .verts = worldVerts}; GeoPolygon worldGeoPolygon = {.geoloop = worldGeoLoop, .numHoles = 0}; - GeoPoint worldVerts2[] = { + LatLng worldVerts2[] = { {-M_PI_2, 0}, {M_PI_2, 0}, {M_PI_2, M_PI}, {-M_PI_2, M_PI}}; GeoLoop worldGeoLoop2 = {.numVerts = 4, .verts = worldVerts2}; GeoPolygon worldGeoPolygon2 = {.geoloop = worldGeoLoop2, .numHoles = 0}; @@ -91,7 +91,7 @@ SUITE(polygonToCells_reported) { double south = H3_EXPORT(degsToRads)(-34.30714385628804); double west = H3_EXPORT(degsToRads)(-57.65625); - GeoPoint testVerts[] = { + LatLng testVerts[] = { {north, east}, {south, east}, {south, west}, {north, west}}; GeoLoop testGeoLoop = {.numVerts = 4, .verts = testVerts}; GeoPolygon testPolygon; @@ -117,7 +117,7 @@ SUITE(polygonToCells_reported) { double south = H3_EXPORT(degsToRads)(-35.4606699514953); double west = H3_EXPORT(degsToRads)(-59.0625); - GeoPoint testVerts[] = { + LatLng testVerts[] = { {north, east}, {south, east}, {south, west}, {north, west}}; GeoLoop testGeoLoop = {.numVerts = 4, .verts = testVerts}; GeoPolygon testPolygon; @@ -138,7 +138,7 @@ SUITE(polygonToCells_reported) { // https://github.com/uber/h3/issues/136 TEST(h3_136) { - GeoPoint testVerts[] = {{0.10068990369902957, 0.8920772174196191}, + LatLng testVerts[] = {{0.10068990369902957, 0.8920772174196191}, {0.10032914690616246, 0.8915914753447348}, {0.10033349237998787, 0.8915860128746426}, {0.10069496685903621, 0.8920742194546231}}; diff --git a/src/apps/testapps/testVec3d.c b/src/apps/testapps/testVec3d.c index 1bd35def0..056700807 100644 --- a/src/apps/testapps/testVec3d.c +++ b/src/apps/testapps/testVec3d.c @@ -44,19 +44,19 @@ SUITE(Vec3d) { TEST(_geoToVec3d) { Vec3d origin = {0}; - GeoPoint c1 = {0, 0}; + LatLng c1 = {0, 0}; Vec3d p1; _geoToVec3d(&c1, &p1); t_assert(fabs(_pointSquareDist(&origin, &p1) - 1) < EPSILON_RAD, "Geo point is on the unit sphere"); - GeoPoint c2 = {M_PI_2, 0}; + LatLng c2 = {M_PI_2, 0}; Vec3d p2; _geoToVec3d(&c2, &p2); t_assert(fabs(_pointSquareDist(&p1, &p2) - 2) < EPSILON_RAD, "Geo point is on another axis"); - GeoPoint c3 = {M_PI, 0}; + LatLng c3 = {M_PI, 0}; Vec3d p3; _geoToVec3d(&c3, &p3); t_assert(fabs(_pointSquareDist(&p1, &p3) - 4) < EPSILON_RAD, diff --git a/src/apps/testapps/testVertexExhaustive.c b/src/apps/testapps/testVertexExhaustive.c index ada7255f9..b1449457d 100644 --- a/src/apps/testapps/testVertexExhaustive.c +++ b/src/apps/testapps/testVertexExhaustive.c @@ -40,7 +40,7 @@ static void cellToVertex_point_assertions(H3Index h3) { // This test won't work if there are distortion vertexes in the boundary if (numVerts < gb.numVerts) return; - GeoPoint coord; + LatLng coord; for (int i = 0; i < numVerts; i++) { H3Index vertex = H3_EXPORT(cellToVertex)(h3, i); H3_EXPORT(vertexToLatLng)(vertex, &coord); diff --git a/src/apps/testapps/testVertexGraph.c b/src/apps/testapps/testVertexGraph.c index fca6008b3..bd926ca61 100644 --- a/src/apps/testapps/testVertexGraph.c +++ b/src/apps/testapps/testVertexGraph.c @@ -23,13 +23,13 @@ #include "vertexGraph.h" // Fixtures -static GeoPoint center; -static GeoPoint vertex1; -static GeoPoint vertex2; -static GeoPoint vertex3; -static GeoPoint vertex4; -static GeoPoint vertex5; -static GeoPoint vertex6; +static LatLng center; +static LatLng vertex1; +static LatLng vertex2; +static LatLng vertex3; +static LatLng vertex4; +static LatLng vertex5; +static LatLng vertex6; SUITE(vertexGraph) { setGeoDegs(¢er, 37.77362016769341, -122.41673772517154); diff --git a/src/h3lib/include/bbox.h b/src/h3lib/include/bbox.h index b9d748677..759b183ce 100644 --- a/src/h3lib/include/bbox.h +++ b/src/h3lib/include/bbox.h @@ -35,11 +35,11 @@ typedef struct { } BBox; bool bboxIsTransmeridian(const BBox* bbox); -void bboxCenter(const BBox* bbox, GeoPoint* center); -bool bboxContains(const BBox* bbox, const GeoPoint* point); +void bboxCenter(const BBox* bbox, LatLng* center); +bool bboxContains(const BBox* bbox, const LatLng* point); bool bboxEquals(const BBox* b1, const BBox* b2); int bboxHexEstimate(const BBox* bbox, int res); -int lineHexEstimate(const GeoPoint* origin, const GeoPoint* destination, +int lineHexEstimate(const LatLng* origin, const LatLng* destination, int res); #endif diff --git a/src/h3lib/include/faceijk.h b/src/h3lib/include/faceijk.h index f6b1da7fa..891197fab 100644 --- a/src/h3lib/include/faceijk.h +++ b/src/h3lib/include/faceijk.h @@ -47,7 +47,7 @@ typedef struct { /// face } FaceOrientIJK; -extern const GeoPoint faceCenterGeo[NUM_ICOSA_FACES]; +extern const LatLng faceCenterGeo[NUM_ICOSA_FACES]; // indexes for faceNeighbors table /** IJ quadrant faceNeighbors table direction */ @@ -72,16 +72,16 @@ typedef enum { // Internal functions -void _geoToFaceIjk(const GeoPoint* g, int res, FaceIJK* h); -void _geoToHex2d(const GeoPoint* g, int res, int* face, Vec2d* v); -void _faceIjkToGeo(const FaceIJK* h, int res, GeoPoint* g); +void _geoToFaceIjk(const LatLng* g, int res, FaceIJK* h); +void _geoToHex2d(const LatLng* g, int res, int* face, Vec2d* v); +void _faceIjkToGeo(const FaceIJK* h, int res, LatLng* g); void _faceIjkToCellBoundary(const FaceIJK* h, int res, int start, int length, CellBoundary* g); void _faceIjkPentToCellBoundary(const FaceIJK* h, int res, int start, int length, CellBoundary* g); void _faceIjkToVerts(FaceIJK* fijk, int* res, FaceIJK* fijkVerts); void _faceIjkPentToVerts(FaceIJK* fijk, int* res, FaceIJK* fijkVerts); -void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, GeoPoint* g); +void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, LatLng* g); Overage _adjustOverageClassII(FaceIJK* fijk, int res, int pentLeading4, int substrate); Overage _adjustPentVertOverage(FaceIJK* fijk, int res); diff --git a/src/h3lib/include/geoPoint.h b/src/h3lib/include/geoPoint.h index 2442f08a3..7ad1c0f8f 100644 --- a/src/h3lib/include/geoPoint.h +++ b/src/h3lib/include/geoPoint.h @@ -32,20 +32,20 @@ /** epsilon of ~0.1mm in radians */ #define EPSILON_RAD (EPSILON_DEG * M_PI_180) -void setGeoDegs(GeoPoint *p, double latDegs, double lonDegs); +void setGeoDegs(LatLng *p, double latDegs, double lonDegs); double constrainLat(double lat); double constrainLng(double lng); -bool geoAlmostEqual(const GeoPoint *p1, const GeoPoint *p2); -bool geoAlmostEqualThreshold(const GeoPoint *p1, const GeoPoint *p2, +bool geoAlmostEqual(const LatLng *p1, const LatLng *p2); +bool geoAlmostEqualThreshold(const LatLng *p1, const LatLng *p2, double threshold); // Internal functions double _posAngleRads(double rads); -void _setGeoRads(GeoPoint *p, double latRads, double lonRads); -double _geoAzimuthRads(const GeoPoint *p1, const GeoPoint *p2); -void _geoAzDistanceRads(const GeoPoint *p1, double az, double distance, - GeoPoint *p2); +void _setGeoRads(LatLng *p, double latRads, double lonRads); +double _geoAzimuthRads(const LatLng *p1, const LatLng *p2); +void _geoAzDistanceRads(const LatLng *p1, double az, double distance, + LatLng *p2); #endif diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index cfdb9c697..f03f322c5 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -121,20 +121,20 @@ typedef enum { */ #define MAX_CELL_BNDRY_VERTS 10 -/** @struct GeoPoint +/** @struct LatLng @brief latitude/longitude in radians */ typedef struct { double lat; ///< latitude in radians double lon; ///< longitude in radians -} GeoPoint; +} LatLng; /** @struct CellBoundary @brief cell boundary in latitude/longitude */ typedef struct { int numVerts; ///< number of vertices - GeoPoint verts[MAX_CELL_BNDRY_VERTS]; ///< vertices in ccw order + LatLng verts[MAX_CELL_BNDRY_VERTS]; ///< vertices in ccw order } CellBoundary; /** @struct GeoLoop @@ -142,7 +142,7 @@ typedef struct { */ typedef struct { int numVerts; - GeoPoint *verts; + LatLng *verts; } GeoLoop; /** @struct GeoPolygon @@ -167,7 +167,7 @@ typedef struct { */ typedef struct LinkedLatLng LinkedLatLng; struct LinkedLatLng { - GeoPoint vertex; + LatLng vertex; LinkedLatLng *next; }; @@ -207,7 +207,7 @@ typedef struct { */ /** @brief find the H3 index of the resolution res cell containing the lat/lng */ -DECLSPEC H3Error H3_EXPORT(latLngToCell)(const GeoPoint *g, int res, +DECLSPEC H3Error H3_EXPORT(latLngToCell)(const LatLng *g, int res, H3Index *out); /** @} */ @@ -216,7 +216,7 @@ DECLSPEC H3Error H3_EXPORT(latLngToCell)(const GeoPoint *g, int res, * @{ */ /** @brief find the lat/lon center point g of the cell h3 */ -DECLSPEC H3Error H3_EXPORT(cellToLatLng)(H3Index h3, GeoPoint *g); +DECLSPEC H3Error H3_EXPORT(cellToLatLng)(H3Index h3, LatLng *g); /** @} */ /** @defgroup cellToBoundary cellToBoundary @@ -320,15 +320,15 @@ DECLSPEC double H3_EXPORT(radsToDegs)(double radians); * Functions for pointDist * @{ */ -/** @brief "great circle distance" between pairs of GeoPoint points in radians*/ -double H3_EXPORT(pointDistRads)(const GeoPoint *a, const GeoPoint *b); +/** @brief "great circle distance" between pairs of LatLng points in radians*/ +double H3_EXPORT(pointDistRads)(const LatLng *a, const LatLng *b); -/** @brief "great circle distance" between pairs of GeoPoint points in +/** @brief "great circle distance" between pairs of LatLng points in * kilometers*/ -double H3_EXPORT(pointDistKm)(const GeoPoint *a, const GeoPoint *b); +double H3_EXPORT(pointDistKm)(const LatLng *a, const LatLng *b); -/** @brief "great circle distance" between pairs of GeoPoint points in meters*/ -double H3_EXPORT(pointDistM)(const GeoPoint *a, const GeoPoint *b); +/** @brief "great circle distance" between pairs of LatLng points in meters*/ +double H3_EXPORT(pointDistM)(const LatLng *a, const LatLng *b); /** @} */ /** @defgroup getHexagonAreaAvg getHexagonAreaAvg @@ -680,7 +680,7 @@ DECLSPEC void H3_EXPORT(cellToVertexes)(H3Index origin, H3Index *vertexes); * @{ */ /** @brief Returns a single vertex for a given cell, as an H3 index */ -DECLSPEC void H3_EXPORT(vertexToLatLng)(H3Index vertex, GeoPoint *point); +DECLSPEC void H3_EXPORT(vertexToLatLng)(H3Index vertex, LatLng *point); /** @} */ /** @defgroup isValidVertex isValidVertex diff --git a/src/h3lib/include/linkedGeo.h b/src/h3lib/include/linkedGeo.h index cc5fffb6e..e3d35941a 100644 --- a/src/h3lib/include/linkedGeo.h +++ b/src/h3lib/include/linkedGeo.h @@ -56,7 +56,7 @@ int normalizeMultiPolygon(LinkedGeoPolygon* root); LinkedGeoPolygon* addNewLinkedPolygon(LinkedGeoPolygon* polygon); LinkedGeoLoop* addNewLinkedLoop(LinkedGeoPolygon* polygon); LinkedGeoLoop* addLinkedLoop(LinkedGeoPolygon* polygon, LinkedGeoLoop* loop); -LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint* vertex); +LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const LatLng* vertex); int countLinkedPolygons(LinkedGeoPolygon* polygon); int countLinkedLoops(LinkedGeoPolygon* polygon); int countLinkedCoords(LinkedGeoLoop* loop); @@ -81,7 +81,7 @@ void bboxFromLinkedGeoLoop(const LinkedGeoLoop* loop, BBox* bbox); * @return Whether the point is contained */ bool pointInsideLinkedGeoLoop(const LinkedGeoLoop* loop, const BBox* bbox, - const GeoPoint* coord); + const LatLng* coord); /** * Whether the winding order of a given LinkedGeoLoop is clockwise diff --git a/src/h3lib/include/polygon.h b/src/h3lib/include/polygon.h index a81a708c0..76c416624 100644 --- a/src/h3lib/include/polygon.h +++ b/src/h3lib/include/polygon.h @@ -43,7 +43,7 @@ // Defined directly in polygon.c: void bboxesFromGeoPolygon(const GeoPolygon* polygon, BBox* bboxes); bool pointInsidePolygon(const GeoPolygon* geoPolygon, const BBox* bboxes, - const GeoPoint* coord); + const LatLng* coord); // The following functions are created via macro in polygonAlgos.h, // so their signatures are documented here: @@ -64,7 +64,7 @@ void bboxFromGeoLoop(const GeoLoop* loop, BBox* bbox); * @return Whether the point is contained */ bool pointInsideGeoLoop(const GeoLoop* loop, const BBox* bbox, - const GeoPoint* coord); + const LatLng* coord); /** * Whether the winding order of a given GeoLoop is clockwise diff --git a/src/h3lib/include/polygonAlgos.h b/src/h3lib/include/polygonAlgos.h index 0fc792b14..386e29a39 100644 --- a/src/h3lib/include/polygonAlgos.h +++ b/src/h3lib/include/polygonAlgos.h @@ -65,7 +65,7 @@ * @return Whether the point is contained */ bool GENERIC_LOOP_ALGO(pointInside)(const TYPE* loop, const BBox* bbox, - const GeoPoint* coord) { + const LatLng* coord) { // fail fast if we're outside the bounding box if (!bboxContains(bbox, coord)) { return false; @@ -76,8 +76,8 @@ bool GENERIC_LOOP_ALGO(pointInside)(const TYPE* loop, const BBox* bbox, double lat = coord->lat; double lng = NORMALIZE_LON(coord->lon, isTransmeridian); - GeoPoint a; - GeoPoint b; + LatLng a; + LatLng b; INIT_ITERATION; @@ -87,7 +87,7 @@ bool GENERIC_LOOP_ALGO(pointInside)(const TYPE* loop, const BBox* bbox, // Ray casting algo requires the second point to always be higher // than the first, so swap if needed if (a.lat > b.lat) { - GeoPoint tmp = a; + LatLng tmp = a; a = b; b = tmp; } @@ -151,8 +151,8 @@ void GENERIC_LOOP_ALGO(bboxFrom)(const TYPE* loop, BBox* bbox) { double lat; double lon; - GeoPoint coord; - GeoPoint next; + LatLng coord; + LatLng next; INIT_ITERATION; @@ -191,8 +191,8 @@ void GENERIC_LOOP_ALGO(bboxFrom)(const TYPE* loop, BBox* bbox) { static bool GENERIC_LOOP_ALGO(isClockwiseNormalized)(const TYPE* loop, bool isTransmeridian) { double sum = 0; - GeoPoint a; - GeoPoint b; + LatLng a; + LatLng b; INIT_ITERATION; while (true) { diff --git a/src/h3lib/include/vec3d.h b/src/h3lib/include/vec3d.h index bb765dd93..ee598daad 100644 --- a/src/h3lib/include/vec3d.h +++ b/src/h3lib/include/vec3d.h @@ -31,7 +31,7 @@ typedef struct { double z; ///< z component } Vec3d; -void _geoToVec3d(const GeoPoint* geo, Vec3d* point); +void _geoToVec3d(const LatLng* geo, Vec3d* point); double _pointSquareDist(const Vec3d* p1, const Vec3d* p2); #endif diff --git a/src/h3lib/include/vertexGraph.h b/src/h3lib/include/vertexGraph.h index 77558e192..c841567d8 100644 --- a/src/h3lib/include/vertexGraph.h +++ b/src/h3lib/include/vertexGraph.h @@ -30,8 +30,8 @@ */ typedef struct VertexNode VertexNode; struct VertexNode { - GeoPoint from; - GeoPoint to; + LatLng from; + LatLng to; VertexNode* next; }; @@ -49,22 +49,22 @@ void initVertexGraph(VertexGraph* graph, int numBuckets, int res); void destroyVertexGraph(VertexGraph* graph); -VertexNode* addVertexNode(VertexGraph* graph, const GeoPoint* fromVtx, - const GeoPoint* toVtx); +VertexNode* addVertexNode(VertexGraph* graph, const LatLng* fromVtx, + const LatLng* toVtx); int removeVertexNode(VertexGraph* graph, VertexNode* node); -VertexNode* findNodeForEdge(const VertexGraph* graph, const GeoPoint* fromVtx, - const GeoPoint* toVtx); +VertexNode* findNodeForEdge(const VertexGraph* graph, const LatLng* fromVtx, + const LatLng* toVtx); VertexNode* findNodeForVertex(const VertexGraph* graph, - const GeoPoint* fromVtx); + const LatLng* fromVtx); VertexNode* firstVertexNode(const VertexGraph* graph); // Internal functions -uint32_t _hashVertex(const GeoPoint* vertex, int res, int numBuckets); -void _initVertexNode(VertexNode* node, const GeoPoint* fromVtx, - const GeoPoint* toVtx); +uint32_t _hashVertex(const LatLng* vertex, int res, int numBuckets); +void _initVertexNode(VertexNode* node, const LatLng* fromVtx, + const LatLng* toVtx); #endif diff --git a/src/h3lib/lib/algos.c b/src/h3lib/lib/algos.c index 8672772c5..e120e5665 100644 --- a/src/h3lib/lib/algos.c +++ b/src/h3lib/lib/algos.c @@ -775,14 +775,14 @@ void H3_EXPORT(polygonToCells)(const GeoPolygon* geoPolygon, int res, int _getEdgeHexagons(const GeoLoop* geoloop, int numHexagons, int res, int* numSearchHexes, H3Index* search, H3Index* found) { for (int i = 0; i < geoloop->numVerts; i++) { - GeoPoint origin = geoloop->verts[i]; - GeoPoint destination = i == geoloop->numVerts - 1 + LatLng origin = geoloop->verts[i]; + LatLng destination = i == geoloop->numVerts - 1 ? geoloop->verts[0] : geoloop->verts[i + 1]; const int numHexesEstimate = lineHexEstimate(&origin, &destination, res); for (int j = 0; j < numHexesEstimate; j++) { - GeoPoint interpolate; + LatLng interpolate; interpolate.lat = (origin.lat * (numHexesEstimate - j) / numHexesEstimate) + (destination.lat * j / numHexesEstimate); @@ -959,7 +959,7 @@ int _polygonToCellsInternal(const GeoPolygon* geoPolygon, int res, } // Check if the hexagon is in the polygon or not - GeoPoint hexCenter; + LatLng hexCenter; H3_EXPORT(cellToLatLng)(hex, &hexCenter); // If not, skip @@ -1007,8 +1007,8 @@ int _polygonToCellsInternal(const GeoPolygon* geoPolygon, int res, void h3SetToVertexGraph(const H3Index* h3Set, const int numHexes, VertexGraph* graph) { CellBoundary vertices; - GeoPoint* fromVtx; - GeoPoint* toVtx; + LatLng* fromVtx; + LatLng* toVtx; VertexNode* edge; if (numHexes < 1) { // We still need to init the graph, or calls to destroyVertexGraph will @@ -1054,7 +1054,7 @@ void _vertexGraphToLinkedGeo(VertexGraph* graph, LinkedGeoPolygon* out) { *out = (LinkedGeoPolygon){0}; LinkedGeoLoop* loop; VertexNode* edge; - GeoPoint nextVtx; + LatLng nextVtx; // Find the next unused entry point while ((edge = firstVertexNode(graph)) != NULL) { loop = addNewLinkedLoop(out); diff --git a/src/h3lib/lib/bbox.c b/src/h3lib/lib/bbox.c index c8efec448..2d9abea71 100644 --- a/src/h3lib/lib/bbox.c +++ b/src/h3lib/lib/bbox.c @@ -39,7 +39,7 @@ bool bboxIsTransmeridian(const BBox* bbox) { return bbox->east < bbox->west; } * @param bbox Input bounding box * @param center Output center coordinate */ -void bboxCenter(const BBox* bbox, GeoPoint* center) { +void bboxCenter(const BBox* bbox, LatLng* center) { center->lat = (bbox->north + bbox->south) / 2.0; // If the bbox crosses the antimeridian, shift east 360 degrees double east = bboxIsTransmeridian(bbox) ? bbox->east + M_2PI : bbox->east; @@ -52,7 +52,7 @@ void bboxCenter(const BBox* bbox, GeoPoint* center) { * @param point Point to test * @return Whether the point is contained */ -bool bboxContains(const BBox* bbox, const GeoPoint* point) { +bool bboxContains(const BBox* bbox, const LatLng* point) { return point->lat >= bbox->south && point->lat <= bbox->north && (bboxIsTransmeridian(bbox) ? // transmeridian case @@ -82,7 +82,7 @@ bool bboxEquals(const BBox* b1, const BBox* b2) { double _hexRadiusKm(H3Index h3Index) { // There is probably a cheaper way to determine the radius of a // hexagon, but this way is conceptually simple - GeoPoint h3Center; + LatLng h3Center; CellBoundary h3Boundary; H3_EXPORT(cellToLatLng)(h3Index, &h3Center); H3_EXPORT(cellToBoundary)(h3Index, &h3Boundary); @@ -111,7 +111,7 @@ int bboxHexEstimate(const BBox* bbox, int res) { 0.8 * (2.59807621135 * pentagonRadiusKm * pentagonRadiusKm); // Then get the area of the bounding box of the geoloop in question - GeoPoint p1, p2; + LatLng p1, p2; p1.lat = bbox->north; p1.lon = bbox->east; p2.lat = bbox->south; @@ -136,7 +136,7 @@ int bboxHexEstimate(const BBox* bbox, int res) { * @param res the resolution of the H3 hexagons to trace the line * @return the estimated number of hexagons required to trace the line */ -int lineHexEstimate(const GeoPoint* origin, const GeoPoint* destination, +int lineHexEstimate(const LatLng* origin, const LatLng* destination, int res) { // Get the area of the pentagon as the maximally-distorted area possible H3Index pentagons[12] = {0}; diff --git a/src/h3lib/lib/faceijk.c b/src/h3lib/lib/faceijk.c index 799c3595d..2af419cee 100644 --- a/src/h3lib/lib/faceijk.c +++ b/src/h3lib/lib/faceijk.c @@ -36,7 +36,7 @@ #define M_SQRT7 2.6457513110645905905016157536392604257102L /** @brief icosahedron face centers in lat/lon radians */ -const GeoPoint faceCenterGeo[NUM_ICOSA_FACES] = { +const LatLng faceCenterGeo[NUM_ICOSA_FACES] = { {0.803582649718989942, 1.248397419617396099}, // face 0 {1.307747883455638156, 2.536945009877921159}, // face 1 {1.054751253523952054, -1.347517358900396623}, // face 2 @@ -368,7 +368,7 @@ static const int unitScaleByCIIres[] = { * @param res The desired H3 resolution for the encoding. * @param h The FaceIJK address of the containing cell at resolution res. */ -void _geoToFaceIjk(const GeoPoint* g, int res, FaceIJK* h) { +void _geoToFaceIjk(const LatLng* g, int res, FaceIJK* h) { // first convert to hex2d Vec2d v; _geoToHex2d(g, res, &h->face, &v); @@ -386,7 +386,7 @@ void _geoToFaceIjk(const GeoPoint* g, int res, FaceIJK* h) { * @param face The icosahedral face containing the spherical coordinates. * @param v The 2D hex coordinates of the cell containing the point. */ -void _geoToHex2d(const GeoPoint* g, int res, int* face, Vec2d* v) { +void _geoToHex2d(const LatLng* g, int res, int* face, Vec2d* v) { Vec3d v3d; _geoToVec3d(g, &v3d); @@ -445,7 +445,7 @@ void _geoToHex2d(const GeoPoint* g, int res, int* face, Vec2d* v) { * @param g The spherical coordinates of the cell center point. */ void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, - GeoPoint* g) { + LatLng* g) { // calculate (r, theta) in hex2d double r = _v2dMag(v); @@ -490,7 +490,7 @@ void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, * @param res The H3 resolution of the cell. * @param g The spherical coordinates of the cell center point. */ -void _faceIjkToGeo(const FaceIJK* h, int res, GeoPoint* g) { +void _faceIjkToGeo(const FaceIJK* h, int res, LatLng* g) { Vec2d v; _ijkToHex2d(&h->coord, &v); _hex2dToGeo(&v, h->face, res, 0, g); diff --git a/src/h3lib/lib/geoPoint.c b/src/h3lib/lib/geoPoint.c index 29f60a6b3..b22e0751f 100644 --- a/src/h3lib/lib/geoPoint.c +++ b/src/h3lib/lib/geoPoint.c @@ -48,7 +48,7 @@ double _posAngleRads(double rads) { * @return Whether or not the two coordinates are within the threshold distance * of each other. */ -bool geoAlmostEqualThreshold(const GeoPoint *p1, const GeoPoint *p2, +bool geoAlmostEqualThreshold(const LatLng *p1, const LatLng *p2, double threshold) { return fabs(p1->lat - p2->lat) < threshold && fabs(p1->lon - p2->lon) < threshold; @@ -63,7 +63,7 @@ bool geoAlmostEqualThreshold(const GeoPoint *p1, const GeoPoint *p2, * @return Whether or not the two coordinates are within the epsilon distance * of each other. */ -bool geoAlmostEqual(const GeoPoint *p1, const GeoPoint *p2) { +bool geoAlmostEqual(const LatLng *p1, const LatLng *p2) { return geoAlmostEqualThreshold(p1, p2, EPSILON_RAD); } @@ -74,7 +74,7 @@ bool geoAlmostEqual(const GeoPoint *p1, const GeoPoint *p2) { * @param latDegs The desired latitude in decimal degrees. * @param lonDegs The desired longitude in decimal degrees. */ -void setGeoDegs(GeoPoint *p, double latDegs, double lonDegs) { +void setGeoDegs(LatLng *p, double latDegs, double lonDegs) { _setGeoRads(p, H3_EXPORT(degsToRads)(latDegs), H3_EXPORT(degsToRads)(lonDegs)); } @@ -86,7 +86,7 @@ void setGeoDegs(GeoPoint *p, double latDegs, double lonDegs) { * @param latRads The desired latitude in decimal radians. * @param lonRads The desired longitude in decimal radians. */ -void _setGeoRads(GeoPoint *p, double latRads, double lonRads) { +void _setGeoRads(LatLng *p, double latRads, double lonRads) { p->lat = latRads; p->lon = lonRads; } @@ -149,7 +149,7 @@ double constrainLng(double lng) { * * @return the great circle distance in radians between a and b */ -double H3_EXPORT(pointDistRads)(const GeoPoint *a, const GeoPoint *b) { +double H3_EXPORT(pointDistRads)(const LatLng *a, const LatLng *b) { double sinLat = sin((b->lat - a->lat) / 2.0); double sinLng = sin((b->lon - a->lon) / 2.0); @@ -161,14 +161,14 @@ double H3_EXPORT(pointDistRads)(const GeoPoint *a, const GeoPoint *b) { /** * The great circle distance in kilometers between two spherical coordinates. */ -double H3_EXPORT(pointDistKm)(const GeoPoint *a, const GeoPoint *b) { +double H3_EXPORT(pointDistKm)(const LatLng *a, const LatLng *b) { return H3_EXPORT(pointDistRads)(a, b) * EARTH_RADIUS_KM; } /** * The great circle distance in meters between two spherical coordinates. */ -double H3_EXPORT(pointDistM)(const GeoPoint *a, const GeoPoint *b) { +double H3_EXPORT(pointDistM)(const LatLng *a, const LatLng *b) { return H3_EXPORT(pointDistKm)(a, b) * 1000; } @@ -179,7 +179,7 @@ double H3_EXPORT(pointDistM)(const GeoPoint *a, const GeoPoint *b) { * @param p2 The second spherical coordinates. * @return The azimuth in radians from p1 to p2. */ -double _geoAzimuthRads(const GeoPoint *p1, const GeoPoint *p2) { +double _geoAzimuthRads(const LatLng *p1, const LatLng *p2) { return atan2(cos(p2->lat) * sin(p2->lon - p1->lon), cos(p1->lat) * sin(p2->lat) - sin(p1->lat) * cos(p2->lat) * cos(p2->lon - p1->lon)); @@ -195,8 +195,8 @@ double _geoAzimuthRads(const GeoPoint *p1, const GeoPoint *p2) { * @param p2 The spherical coordinates at the desired azimuth and distance from * p1. */ -void _geoAzDistanceRads(const GeoPoint *p1, double az, double distance, - GeoPoint *p2) { +void _geoAzDistanceRads(const LatLng *p1, double az, double distance, + LatLng *p2) { if (distance < EPSILON) { *p2 = *p1; return; @@ -329,7 +329,7 @@ double triangleEdgeLengthsToArea(double a, double b, double c) { * * @return area of triangle on unit sphere, in radians^2 */ -double triangleArea(const GeoPoint *a, const GeoPoint *b, const GeoPoint *c) { +double triangleArea(const LatLng *a, const LatLng *b, const LatLng *c) { return triangleEdgeLengthsToArea(H3_EXPORT(pointDistRads)(a, b), H3_EXPORT(pointDistRads)(b, c), H3_EXPORT(pointDistRads)(c, a)); @@ -349,7 +349,7 @@ double triangleArea(const GeoPoint *a, const GeoPoint *b, const GeoPoint *c) { * @return cell area in radians^2 */ double H3_EXPORT(cellAreaRads2)(H3Index cell) { - GeoPoint c; + LatLng c; CellBoundary cb; H3_EXPORT(cellToLatLng)(cell, &c); H3_EXPORT(cellToBoundary)(cell, &cb); diff --git a/src/h3lib/lib/h3Index.c b/src/h3lib/lib/h3Index.c index 6e4da5ca9..9538ff601 100644 --- a/src/h3lib/lib/h3Index.c +++ b/src/h3lib/lib/h3Index.c @@ -723,7 +723,7 @@ H3Index _faceIjkToH3(const FaceIJK* fijk, int res) { * @param out The encoded H3Index. * @returns E_SUCCESS (0) on success, another value otherwise */ -H3Error H3_EXPORT(latLngToCell)(const GeoPoint* g, int res, H3Index* out) { +H3Error H3_EXPORT(latLngToCell)(const LatLng* g, int res, H3Index* out) { if (res < 0 || res > MAX_H3_RES) { return E_RES_DOMAIN; } @@ -836,7 +836,7 @@ H3Error _h3ToFaceIjk(H3Index h, FaceIJK* fijk) { * @param h3 The H3 index. * @param g The spherical coordinates of the H3 cell center. */ -H3Error H3_EXPORT(cellToLatLng)(H3Index h3, GeoPoint* g) { +H3Error H3_EXPORT(cellToLatLng)(H3Index h3, LatLng* g) { FaceIJK fijk; H3Error e = _h3ToFaceIjk(h3, &fijk); if (e) { diff --git a/src/h3lib/lib/linkedGeo.c b/src/h3lib/lib/linkedGeo.c index 6870a69ef..3aecd9187 100644 --- a/src/h3lib/lib/linkedGeo.c +++ b/src/h3lib/lib/linkedGeo.c @@ -73,7 +73,7 @@ LinkedGeoLoop* addLinkedLoop(LinkedGeoPolygon* polygon, LinkedGeoLoop* loop) { * @param vertex Coordinate to add * @return Pointer to the coordinate */ -LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const GeoPoint* vertex) { +LinkedLatLng* addLinkedCoord(LinkedGeoLoop* loop, const LatLng* vertex) { LinkedLatLng* coord = H3_MEMORY(malloc)(sizeof(*coord)); assert(coord != NULL); *coord = (LinkedLatLng){.vertex = *vertex, .next = NULL}; diff --git a/src/h3lib/lib/polygon.c b/src/h3lib/lib/polygon.c index 0a5cb845f..658659049 100644 --- a/src/h3lib/lib/polygon.c +++ b/src/h3lib/lib/polygon.c @@ -64,7 +64,7 @@ void bboxesFromGeoPolygon(const GeoPolygon* polygon, BBox* bboxes) { * @return Whether the point is contained */ bool pointInsidePolygon(const GeoPolygon* geoPolygon, const BBox* bboxes, - const GeoPoint* coord) { + const LatLng* coord) { // Start with contains state of primary geoloop bool contains = pointInsideGeoLoop(&(geoPolygon->geoloop), &bboxes[0], coord); diff --git a/src/h3lib/lib/vec3d.c b/src/h3lib/lib/vec3d.c index 989558c32..a357d71b4 100644 --- a/src/h3lib/lib/vec3d.c +++ b/src/h3lib/lib/vec3d.c @@ -47,7 +47,7 @@ double _pointSquareDist(const Vec3d* v1, const Vec3d* v2) { * @param geo The latitude and longitude of the point. * @param v The 3D coordinate of the point. */ -void _geoToVec3d(const GeoPoint* geo, Vec3d* v) { +void _geoToVec3d(const LatLng* geo, Vec3d* v) { double r = cos(geo->lat); v->z = sin(geo->lat); diff --git a/src/h3lib/lib/vertex.c b/src/h3lib/lib/vertex.c index 8486c64f4..2a110d5a4 100644 --- a/src/h3lib/lib/vertex.c +++ b/src/h3lib/lib/vertex.c @@ -285,7 +285,7 @@ void H3_EXPORT(cellToVertexes)(H3Index cell, H3Index* vertexes) { * @param vertex H3 index describing a vertex * @param coord Output geo coordinate */ -void H3_EXPORT(vertexToLatLng)(H3Index vertex, GeoPoint* coord) { +void H3_EXPORT(vertexToLatLng)(H3Index vertex, LatLng* coord) { // Get the vertex number and owner from the vertex int vertexNum = H3_GET_RESERVED_BITS(vertex); H3Index owner = vertex; diff --git a/src/h3lib/lib/vertexGraph.c b/src/h3lib/lib/vertexGraph.c index 49e6f57f7..15ab1fe2b 100644 --- a/src/h3lib/lib/vertexGraph.c +++ b/src/h3lib/lib/vertexGraph.c @@ -70,15 +70,15 @@ void destroyVertexGraph(VertexGraph* graph) { * @param numBuckets Number of buckets in the graph * @return Integer hash */ -uint32_t _hashVertex(const GeoPoint* vertex, int res, int numBuckets) { +uint32_t _hashVertex(const LatLng* vertex, int res, int numBuckets) { // Simple hash: Take the sum of the lat and lon with a precision level // determined by the resolution, converted to int, modulo bucket count. return (uint32_t)fmod(fabs((vertex->lat + vertex->lon) * pow(10, 15 - res)), numBuckets); } -void _initVertexNode(VertexNode* node, const GeoPoint* fromVtx, - const GeoPoint* toVtx) { +void _initVertexNode(VertexNode* node, const LatLng* fromVtx, + const LatLng* toVtx) { node->from = *fromVtx; node->to = *toVtx; node->next = NULL; @@ -91,8 +91,8 @@ void _initVertexNode(VertexNode* node, const GeoPoint* fromVtx, * @param toVtx End vertex * @return Pointer to the new node */ -VertexNode* addVertexNode(VertexGraph* graph, const GeoPoint* fromVtx, - const GeoPoint* toVtx) { +VertexNode* addVertexNode(VertexGraph* graph, const LatLng* fromVtx, + const LatLng* toVtx) { // Make the new node VertexNode* node = H3_MEMORY(malloc)(sizeof(VertexNode)); assert(node != NULL); @@ -168,8 +168,8 @@ int removeVertexNode(VertexGraph* graph, VertexNode* node) { * @param toVtx End vertex, or NULL if we don't care * @return Pointer to the vertex node, if found */ -VertexNode* findNodeForEdge(const VertexGraph* graph, const GeoPoint* fromVtx, - const GeoPoint* toVtx) { +VertexNode* findNodeForEdge(const VertexGraph* graph, const LatLng* fromVtx, + const LatLng* toVtx) { // Determine location uint32_t index = _hashVertex(fromVtx, graph->res, graph->numBuckets); // Check whether there's an existing node in that spot @@ -195,7 +195,7 @@ VertexNode* findNodeForEdge(const VertexGraph* graph, const GeoPoint* fromVtx, * @return Pointer to the vertex node, if found */ VertexNode* findNodeForVertex(const VertexGraph* graph, - const GeoPoint* fromVtx) { + const LatLng* fromVtx) { return findNodeForEdge(graph, fromVtx, NULL); } From a0f50ab560915430edbe40308b67c5b2cd053edd Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:14:17 -0700 Subject: [PATCH 20/74] formatting --- src/apps/benchmarks/benchmarkPolygon.c | 192 +++++++++--------- src/apps/benchmarks/benchmarkPolygonToCells.c | 142 ++++++------- src/apps/filters/latLngToCell.c | 2 +- src/apps/testapps/testBBox.c | 18 +- src/apps/testapps/testPolygon.c | 40 ++-- src/apps/testapps/testPolygonToCells.c | 28 +-- .../testapps/testPolygonToCellsReported.c | 6 +- src/h3lib/include/bbox.h | 3 +- src/h3lib/include/h3api.h.in | 2 +- src/h3lib/include/vertexGraph.h | 3 +- src/h3lib/lib/algos.c | 5 +- src/h3lib/lib/bbox.c | 3 +- src/h3lib/lib/faceijk.c | 3 +- src/h3lib/lib/vertexGraph.c | 3 +- 14 files changed, 220 insertions(+), 230 deletions(-) diff --git a/src/apps/benchmarks/benchmarkPolygon.c b/src/apps/benchmarks/benchmarkPolygon.c index dfc19ae2c..8e0ec3474 100644 --- a/src/apps/benchmarks/benchmarkPolygon.c +++ b/src/apps/benchmarks/benchmarkPolygon.c @@ -22,106 +22,106 @@ LatLng coord = {0.6593020122281105, -2.136646587644049}; LatLng smallVerts[] = {{0.6593216174404631, -2.136686544190228}, - {0.6592922488566673, -2.1367052400423}, - {0.6592659902057862, -2.136683255590617}, - {0.6592690997315311, -2.136642575268508}, - {0.6592984683133152, -2.1366238782059224}, - {0.6593247273713713, -2.136645862675915}, - {0.6593216174404631, -2.136686544190228}}; + {0.6592922488566673, -2.1367052400423}, + {0.6592659902057862, -2.136683255590617}, + {0.6592690997315311, -2.136642575268508}, + {0.6592984683133152, -2.1366238782059224}, + {0.6593247273713713, -2.136645862675915}, + {0.6593216174404631, -2.136686544190228}}; GeoLoop smallGeoLoop; BBox smallBBox; LatLng largeVerts[] = {{0.659094230575688, -2.1371021015485354}, - {0.6590648582999955, -2.137120785446624}, - {0.6590386025000088, -2.1370988011284138}, - {0.6590417185683777, -2.1370581328924323}, - {0.6590154614299164, -2.1370361492494108}, - {0.6590185761584009, -2.136995480477803}, - {0.6589923176815468, -2.136973497510139}, - {0.6589954310701313, -2.1369328282032267}, - {0.6589691712549669, -2.13691084591109}, - {0.6589722833036354, -2.136870176069197}, - {0.6589460221502428, -2.1368481944527566}, - {0.6589491328589803, -2.1368075240762017}, - {0.658922870367441, -2.136785543135628}, - {0.6589259797362319, -2.136744872224736}, - {0.6588997159066284, -2.1367228919601997}, - {0.6589028239354577, -2.13668222051529}, - {0.658876558767872, -2.1366602409269593}, - {0.6588796654567243, -2.136619568948354}, - {0.6589090377185067, -2.136600875366403}, - {0.6589121434726317, -2.136560201662654}, - {0.6589415152070064, -2.1365415063736677}, - {0.6589446200261924, -2.136500830944929}, - {0.6589739912329232, -2.1364821339488738}, - {0.6589770951169582, -2.136441456795302}, - {0.659006465795809, -2.136422758092143}, - {0.6590095687444818, -2.1363820792138917}, - {0.6590389388952168, -2.136363378803596}, - {0.6590420409083151, -2.136322698200821}, - {0.6590714105306988, -2.1363039960833543}, - {0.659074511608011, -2.1362633137562117}, - {0.6591038807018073, -2.1362446099315373}, - {0.6591069808431212, -2.1362039258801833}, - {0.6591363494080951, -2.1361852203482696}, - {0.6591626178344537, -2.136207200077111}, - {0.6591919858731505, -2.136188494047296}, - {0.6592182533686533, -2.1362104744708654}, - {0.6592476208809147, -2.136191767943126}, - {0.6592738874454308, -2.136213749061465}, - {0.6593032544310998, -2.136195042035775}, - {0.6593295200644976, -2.136217023848928}, - {0.6593588865234161, -2.1361983163252596}, - {0.659385151225565, -2.1362202988332704}, - {0.6594145171575755, -2.1362015908116003}, - {0.6594407809283439, -2.136223574014512}, - {0.6594701463332887, -2.1362048654948134}, - {0.6594964091725459, -2.136226849392669}, - {0.659525774050267, -2.1362081403749165}, - {0.659552035957882, -2.1362301249677595}, - {0.6595489325807627, -2.1362708185614188}, - {0.6595751931496329, -2.1362928038322995}, - {0.6595720884311551, -2.1363334968937866}, - {0.6595983476611981, -2.1363554828425366}, - {0.6595952416013771, -2.1363961753715284}, - {0.6596214994925101, -2.1364181619979767}, - {0.6596183920913612, -2.136458853994151}, - {0.659644648643503, -2.1364808412981295}, - {0.6596415399010412, -2.1365215327611633}, - {0.6596677951141098, -2.1365435207425008}, - {0.6596646850303514, -2.1365842116720724}, - {0.659690938904264, -2.136606200330602}, - {0.6596878274792236, -2.1366468907263876}, - {0.6597140800138991, -2.136668880061937}, - {0.6597109672475924, -2.136709569923617}, - {0.6596816023515922, -2.136728269257012}, - {0.6596784886490965, -2.136768957391624}, - {0.6596491232239399, -2.1367876550164606}, - {0.6596460085854672, -2.1368283414238483}, - {0.659616642631389, -2.1368470373401607}, - {0.6596135270571513, -2.1368877220201696}, - {0.6595841605743876, -2.1369064162279927}, - {0.6595810440645967, -2.1369470991804675}, - {0.6595516770533838, -2.1369657916798346}, - {0.6595485596082516, -2.137006472904621}, - {0.6595191920688248, -2.1370251636955686}, - {0.6595160736885637, -2.137065843192512}, - {0.6594867056211589, -2.137084532275072}, - {0.6594835863059806, -2.1371252100440166}, - {0.6594542177108332, -2.137143897418225}, - {0.6594279684321879, -2.137121908235114}, - {0.659398599310775, -2.1371405951126565}, - {0.6593723491001167, -2.137118606624661}, - {0.6593429794525963, -2.137137293005565}, - {0.6593167283100556, -2.1371153052126406}, - {0.6592873581365857, -2.137133991096931}, - {0.6592611060622934, -2.1371120039990363}, - {0.6592317353630313, -2.1371306893867383}, - {0.659205482357119, -2.137108702983829}, - {0.6591761111322224, -2.1371273878749673}, - {0.6591498571948209, -2.137105402167002}, - {0.6591204854444472, -2.137124086561602}, - {0.659094230575688, -2.1371021015485354}}; + {0.6590648582999955, -2.137120785446624}, + {0.6590386025000088, -2.1370988011284138}, + {0.6590417185683777, -2.1370581328924323}, + {0.6590154614299164, -2.1370361492494108}, + {0.6590185761584009, -2.136995480477803}, + {0.6589923176815468, -2.136973497510139}, + {0.6589954310701313, -2.1369328282032267}, + {0.6589691712549669, -2.13691084591109}, + {0.6589722833036354, -2.136870176069197}, + {0.6589460221502428, -2.1368481944527566}, + {0.6589491328589803, -2.1368075240762017}, + {0.658922870367441, -2.136785543135628}, + {0.6589259797362319, -2.136744872224736}, + {0.6588997159066284, -2.1367228919601997}, + {0.6589028239354577, -2.13668222051529}, + {0.658876558767872, -2.1366602409269593}, + {0.6588796654567243, -2.136619568948354}, + {0.6589090377185067, -2.136600875366403}, + {0.6589121434726317, -2.136560201662654}, + {0.6589415152070064, -2.1365415063736677}, + {0.6589446200261924, -2.136500830944929}, + {0.6589739912329232, -2.1364821339488738}, + {0.6589770951169582, -2.136441456795302}, + {0.659006465795809, -2.136422758092143}, + {0.6590095687444818, -2.1363820792138917}, + {0.6590389388952168, -2.136363378803596}, + {0.6590420409083151, -2.136322698200821}, + {0.6590714105306988, -2.1363039960833543}, + {0.659074511608011, -2.1362633137562117}, + {0.6591038807018073, -2.1362446099315373}, + {0.6591069808431212, -2.1362039258801833}, + {0.6591363494080951, -2.1361852203482696}, + {0.6591626178344537, -2.136207200077111}, + {0.6591919858731505, -2.136188494047296}, + {0.6592182533686533, -2.1362104744708654}, + {0.6592476208809147, -2.136191767943126}, + {0.6592738874454308, -2.136213749061465}, + {0.6593032544310998, -2.136195042035775}, + {0.6593295200644976, -2.136217023848928}, + {0.6593588865234161, -2.1361983163252596}, + {0.659385151225565, -2.1362202988332704}, + {0.6594145171575755, -2.1362015908116003}, + {0.6594407809283439, -2.136223574014512}, + {0.6594701463332887, -2.1362048654948134}, + {0.6594964091725459, -2.136226849392669}, + {0.659525774050267, -2.1362081403749165}, + {0.659552035957882, -2.1362301249677595}, + {0.6595489325807627, -2.1362708185614188}, + {0.6595751931496329, -2.1362928038322995}, + {0.6595720884311551, -2.1363334968937866}, + {0.6595983476611981, -2.1363554828425366}, + {0.6595952416013771, -2.1363961753715284}, + {0.6596214994925101, -2.1364181619979767}, + {0.6596183920913612, -2.136458853994151}, + {0.659644648643503, -2.1364808412981295}, + {0.6596415399010412, -2.1365215327611633}, + {0.6596677951141098, -2.1365435207425008}, + {0.6596646850303514, -2.1365842116720724}, + {0.659690938904264, -2.136606200330602}, + {0.6596878274792236, -2.1366468907263876}, + {0.6597140800138991, -2.136668880061937}, + {0.6597109672475924, -2.136709569923617}, + {0.6596816023515922, -2.136728269257012}, + {0.6596784886490965, -2.136768957391624}, + {0.6596491232239399, -2.1367876550164606}, + {0.6596460085854672, -2.1368283414238483}, + {0.659616642631389, -2.1368470373401607}, + {0.6596135270571513, -2.1368877220201696}, + {0.6595841605743876, -2.1369064162279927}, + {0.6595810440645967, -2.1369470991804675}, + {0.6595516770533838, -2.1369657916798346}, + {0.6595485596082516, -2.137006472904621}, + {0.6595191920688248, -2.1370251636955686}, + {0.6595160736885637, -2.137065843192512}, + {0.6594867056211589, -2.137084532275072}, + {0.6594835863059806, -2.1371252100440166}, + {0.6594542177108332, -2.137143897418225}, + {0.6594279684321879, -2.137121908235114}, + {0.659398599310775, -2.1371405951126565}, + {0.6593723491001167, -2.137118606624661}, + {0.6593429794525963, -2.137137293005565}, + {0.6593167283100556, -2.1371153052126406}, + {0.6592873581365857, -2.137133991096931}, + {0.6592611060622934, -2.1371120039990363}, + {0.6592317353630313, -2.1371306893867383}, + {0.659205482357119, -2.137108702983829}, + {0.6591761111322224, -2.1371273878749673}, + {0.6591498571948209, -2.137105402167002}, + {0.6591204854444472, -2.137124086561602}, + {0.659094230575688, -2.1371021015485354}}; GeoLoop largeGeoLoop; BBox largeBBox; diff --git a/src/apps/benchmarks/benchmarkPolygonToCells.c b/src/apps/benchmarks/benchmarkPolygonToCells.c index 1fed2f0d3..4147fd269 100644 --- a/src/apps/benchmarks/benchmarkPolygonToCells.c +++ b/src/apps/benchmarks/benchmarkPolygonToCells.c @@ -26,81 +26,81 @@ GeoLoop sfGeoLoop; GeoPolygon sfGeoPolygon; LatLng alamedaVerts[] = {{0.6597959342671712, -2.133241848488897}, - {0.6597959348850178, -2.133241848495878}, - {0.6598352639563587, -2.1331688423977755}, - {0.6601346536539207, -2.13270417124178}, - {0.6601594763880223, -2.1326680320633344}, - {0.6601512007732382, -2.1326594176574534}, - {0.6598535076212304, -2.1323049630593562}, - {0.6596565748646488, -2.132069889917591}, - {0.6594645035394391, -2.131843148468039}, - {0.6593438094209757, -2.1316994860539844}, - {0.6591174422311021, -2.131429776816562}, - {0.658849344286881, -2.1311111485483867}, - {0.6588348862079956, -2.1310988536794455}, - {0.6586273138317915, -2.131668420800747}, - {0.6583729538174264, -2.132370426573979}, - {0.6582479206289285, -2.132718691911663}, - {0.6582322393220743, -2.1327614200082317}, - {0.6583003647098981, -2.132837478687196}, - {0.6584457274847966, -2.132827956758973}, - {0.6585526679060995, -2.1330231566043203}, - {0.6587379099516777, -2.1331602726234538}, - {0.6587273684736642, -2.1332676321559063}, - {0.6584638025857692, -2.133305719954319}, - {0.6583545950288919, -2.1334323622944993}, - {0.6584427148370682, -2.1335885223323947}, - {0.6584715236640714, -2.133649780409862}, - {0.6584715242505019, -2.133649780481421}, - {0.658474662092443, -2.1336459234695804}, - {0.6591666596433436, -2.1348354004882926}, - {0.6591809355063646, -2.1348424115474565}, - {0.6593477498700266, -2.1351460576998926}, - {0.6597155087395117, -2.1351049454274}, - {0.6597337410387994, -2.135113899444683}, - {0.6598277083823935, -2.1351065432309517}, - {0.659837290351688, -2.1350919904836627}, - {0.6598391300107502, -2.1350911731005957}, - {0.6598335712627461, -2.1350732321630828}, - {0.6597162034032434, -2.134664026354221}, - {0.6596785831942451, -2.134651647657116}, - {0.6596627824684727, -2.13458880305965}, - {0.6596785832500957, -2.134530719130462}, - {0.6596093592822273, -2.13428052987356}, - {0.6596116166352313, -2.134221493755564}, - {0.6595973199434513, -2.134146270344056}, - {0.6595536764042369, -2.1340805688066653}, - {0.6594611172376618, -2.133753252031165}, - {0.6594829406269346, -2.1337342082305697}, - {0.6594897134102581, -2.1337104032834757}, - {0.6597920983773051, -2.1332343063312775}, - {0.6597959342671712, -2.133241848488897}}; + {0.6597959348850178, -2.133241848495878}, + {0.6598352639563587, -2.1331688423977755}, + {0.6601346536539207, -2.13270417124178}, + {0.6601594763880223, -2.1326680320633344}, + {0.6601512007732382, -2.1326594176574534}, + {0.6598535076212304, -2.1323049630593562}, + {0.6596565748646488, -2.132069889917591}, + {0.6594645035394391, -2.131843148468039}, + {0.6593438094209757, -2.1316994860539844}, + {0.6591174422311021, -2.131429776816562}, + {0.658849344286881, -2.1311111485483867}, + {0.6588348862079956, -2.1310988536794455}, + {0.6586273138317915, -2.131668420800747}, + {0.6583729538174264, -2.132370426573979}, + {0.6582479206289285, -2.132718691911663}, + {0.6582322393220743, -2.1327614200082317}, + {0.6583003647098981, -2.132837478687196}, + {0.6584457274847966, -2.132827956758973}, + {0.6585526679060995, -2.1330231566043203}, + {0.6587379099516777, -2.1331602726234538}, + {0.6587273684736642, -2.1332676321559063}, + {0.6584638025857692, -2.133305719954319}, + {0.6583545950288919, -2.1334323622944993}, + {0.6584427148370682, -2.1335885223323947}, + {0.6584715236640714, -2.133649780409862}, + {0.6584715242505019, -2.133649780481421}, + {0.658474662092443, -2.1336459234695804}, + {0.6591666596433436, -2.1348354004882926}, + {0.6591809355063646, -2.1348424115474565}, + {0.6593477498700266, -2.1351460576998926}, + {0.6597155087395117, -2.1351049454274}, + {0.6597337410387994, -2.135113899444683}, + {0.6598277083823935, -2.1351065432309517}, + {0.659837290351688, -2.1350919904836627}, + {0.6598391300107502, -2.1350911731005957}, + {0.6598335712627461, -2.1350732321630828}, + {0.6597162034032434, -2.134664026354221}, + {0.6596785831942451, -2.134651647657116}, + {0.6596627824684727, -2.13458880305965}, + {0.6596785832500957, -2.134530719130462}, + {0.6596093592822273, -2.13428052987356}, + {0.6596116166352313, -2.134221493755564}, + {0.6595973199434513, -2.134146270344056}, + {0.6595536764042369, -2.1340805688066653}, + {0.6594611172376618, -2.133753252031165}, + {0.6594829406269346, -2.1337342082305697}, + {0.6594897134102581, -2.1337104032834757}, + {0.6597920983773051, -2.1332343063312775}, + {0.6597959342671712, -2.133241848488897}}; GeoLoop alamedaGeoLoop; GeoPolygon alamedaGeoPolygon; LatLng southernVerts[] = {{0.6367481147484843, -2.1290865397798906}, - {0.6367481152301953, -2.129086539469222}, - {0.6367550754426818, -2.128887436716856}, - {0.6367816002113981, -2.1273204058681094}, - {0.6380814125349741, -2.127201274803692}, - {0.6388614350074809, -2.12552061082428}, - {0.6393520289210095, -2.124274316938293}, - {0.639524834205869, -2.122168447308359}, - {0.6405714857447717, -2.122083222593005}, - {0.640769478635285, -2.120979885974894}, - {0.6418936996869471, -2.1147667448862255}, - {0.6419094141707652, -2.1146521242709584}, - {0.6269997808948107, -2.1038647304637257}, - {0.6252080524974937, -2.1195521728170457}, - {0.626379700264057, -2.1203708632511162}, - {0.6282200029232767, -2.1210412050690723}, - {0.6283657301211779, -2.1219496416754393}, - {0.6305651783819565, -2.123628532238016}, - {0.6308259852882764, -2.124225549648211}, - {0.6317049665784865, -2.124887756638367}, - {0.6323403882676475, -2.1266205835454053}, - {0.6334397909415498, -2.1277211741619553}, - {0.6367481147484843, -2.1290865397798906}}; + {0.6367481152301953, -2.129086539469222}, + {0.6367550754426818, -2.128887436716856}, + {0.6367816002113981, -2.1273204058681094}, + {0.6380814125349741, -2.127201274803692}, + {0.6388614350074809, -2.12552061082428}, + {0.6393520289210095, -2.124274316938293}, + {0.639524834205869, -2.122168447308359}, + {0.6405714857447717, -2.122083222593005}, + {0.640769478635285, -2.120979885974894}, + {0.6418936996869471, -2.1147667448862255}, + {0.6419094141707652, -2.1146521242709584}, + {0.6269997808948107, -2.1038647304637257}, + {0.6252080524974937, -2.1195521728170457}, + {0.626379700264057, -2.1203708632511162}, + {0.6282200029232767, -2.1210412050690723}, + {0.6283657301211779, -2.1219496416754393}, + {0.6305651783819565, -2.123628532238016}, + {0.6308259852882764, -2.124225549648211}, + {0.6317049665784865, -2.124887756638367}, + {0.6323403882676475, -2.1266205835454053}, + {0.6334397909415498, -2.1277211741619553}, + {0.6367481147484843, -2.1290865397798906}}; GeoLoop southernGeoLoop; GeoPolygon southernGeoPolygon; diff --git a/src/apps/filters/latLngToCell.c b/src/apps/filters/latLngToCell.c index df26d7f9a..78c3dd713 100644 --- a/src/apps/filters/latLngToCell.c +++ b/src/apps/filters/latLngToCell.c @@ -45,7 +45,7 @@ */ void doCoords(double lat, double lon, int res) { LatLng g = {.lat = H3_EXPORT(degsToRads)(lat), - .lon = H3_EXPORT(degsToRads)(lon)}; + .lon = H3_EXPORT(degsToRads)(lon)}; H3Index h; H3Error e = H3_EXPORT(latLngToCell)(&g, res, &h); diff --git a/src/apps/testapps/testBBox.c b/src/apps/testapps/testBBox.c index b19e6e824..7deabd6fa 100644 --- a/src/apps/testapps/testBBox.c +++ b/src/apps/testapps/testBBox.c @@ -84,9 +84,9 @@ SUITE(BBox) { TEST(transmeridian) { LatLng verts[] = {{0.4, M_PI - 0.1}, - {0.4, -M_PI + 0.1}, - {-0.4, -M_PI + 0.1}, - {-0.4, M_PI - 0.1}}; + {0.4, -M_PI + 0.1}, + {-0.4, -M_PI + 0.1}, + {-0.4, M_PI - 0.1}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {0.4, -0.4, -M_PI + 0.1, M_PI - 0.1}; const LatLng insideOnMeridian = {-0.1, M_PI}; @@ -110,9 +110,9 @@ SUITE(BBox) { TEST(edgeOnNorthPole) { LatLng verts[] = {{M_PI_2 - 0.1, 0.1}, - {M_PI_2 - 0.1, 0.8}, - {M_PI_2, 0.8}, - {M_PI_2, 0.1}}; + {M_PI_2 - 0.1, 0.8}, + {M_PI_2, 0.8}, + {M_PI_2, 0.1}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {M_PI_2, M_PI_2 - 0.1, 0.8, 0.1}; const LatLng inside = {M_PI_2 - 0.01, 0.4}; @@ -122,9 +122,9 @@ SUITE(BBox) { TEST(edgeOnSouthPole) { LatLng verts[] = {{-M_PI_2 + 0.1, 0.1}, - {-M_PI_2 + 0.1, 0.8}, - {-M_PI_2, 0.8}, - {-M_PI_2, 0.1}}; + {-M_PI_2 + 0.1, 0.8}, + {-M_PI_2, 0.8}, + {-M_PI_2, 0.1}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {-M_PI_2 + 0.1, -M_PI_2, 0.8, 0.1}; const LatLng inside = {-M_PI_2 + 0.01, 0.4}; diff --git a/src/apps/testapps/testPolygon.c b/src/apps/testapps/testPolygon.c index bd8a2739a..e9ea7af98 100644 --- a/src/apps/testapps/testPolygon.c +++ b/src/apps/testapps/testPolygon.c @@ -31,8 +31,7 @@ static LatLng sfVerts[] = { {0.6583348114025, -2.1354884206045}, {0.6581220034068, -2.1382437718946}, {0.6594479998527, -2.1384597563896}, {0.6599990002976, -2.1376771158464}}; -static void createLinkedLoop(LinkedGeoLoop* loop, LatLng* verts, - int numVerts) { +static void createLinkedLoop(LinkedGeoLoop* loop, LatLng* verts, int numVerts) { *loop = (LinkedGeoLoop){0}; for (int i = 0; i < numVerts; i++) { addLinkedCoord(loop, verts++); @@ -61,9 +60,9 @@ SUITE(polygon) { TEST(pointInsideGeoLoopTransmeridian) { LatLng verts[] = {{0.01, -M_PI + 0.01}, - {0.01, M_PI - 0.01}, - {-0.01, M_PI - 0.01}, - {-0.01, -M_PI + 0.01}}; + {0.01, M_PI - 0.01}, + {-0.01, M_PI - 0.01}, + {-0.01, -M_PI + 0.01}}; GeoLoop transMeridianGeoLoop = {.numVerts = 4, .verts = verts}; LatLng eastPoint = {0.001, -M_PI + 0.001}; @@ -119,8 +118,8 @@ SUITE(polygon) { TEST(bboxFromGeoLoopTransmeridian) { LatLng verts[] = {{0.1, -M_PI + 0.1}, {0.1, M_PI - 0.1}, - {0.05, M_PI - 0.2}, {-0.1, M_PI - 0.1}, - {-0.1, -M_PI + 0.1}, {-0.05, -M_PI + 0.2}}; + {0.05, M_PI - 0.2}, {-0.1, M_PI - 0.1}, + {-0.1, -M_PI + 0.1}, {-0.05, -M_PI + 0.2}}; GeoLoop geoloop = {.numVerts = 6, .verts = verts}; const BBox expected = {0.1, -0.1, -M_PI + 0.2, M_PI - 0.2}; @@ -241,9 +240,9 @@ SUITE(polygon) { TEST(isClockwiseGeoLoopTransmeridian) { LatLng verts[] = {{0.4, M_PI - 0.1}, - {0.4, -M_PI + 0.1}, - {-0.4, -M_PI + 0.1}, - {-0.4, M_PI - 0.1}}; + {0.4, -M_PI + 0.1}, + {-0.4, -M_PI + 0.1}, + {-0.4, M_PI - 0.1}}; GeoLoop geoloop = {.numVerts = 4, .verts = verts}; t_assert(isClockwiseGeoLoop(&geoloop), @@ -252,9 +251,9 @@ SUITE(polygon) { TEST(isClockwiseLinkedGeoLoopTransmeridian) { LatLng verts[] = {{0.4, M_PI - 0.1}, - {0.4, -M_PI + 0.1}, - {-0.4, -M_PI + 0.1}, - {-0.4, M_PI - 0.1}}; + {0.4, -M_PI + 0.1}, + {-0.4, -M_PI + 0.1}, + {-0.4, M_PI - 0.1}}; LinkedGeoLoop loop; createLinkedLoop(&loop, &verts[0], 4); @@ -266,9 +265,9 @@ SUITE(polygon) { TEST(isNotClockwiseLinkedGeoLoopTransmeridian) { LatLng verts[] = {{0.4, M_PI - 0.1}, - {-0.4, M_PI - 0.1}, - {-0.4, -M_PI + 0.1}, - {0.4, -M_PI + 0.1}}; + {-0.4, M_PI - 0.1}, + {-0.4, -M_PI + 0.1}, + {0.4, -M_PI + 0.1}}; LinkedGeoLoop loop; createLinkedLoop(&loop, &verts[0], 4); @@ -450,20 +449,17 @@ SUITE(polygon) { assert(outer != NULL); createLinkedLoop(outer, &verts[0], 4); - LatLng verts2[] = { - {0.1, 0.1}, {-0.1, 0.1}, {-0.1, -0.1}, {0.1, -0.1}}; + LatLng verts2[] = {{0.1, 0.1}, {-0.1, 0.1}, {-0.1, -0.1}, {0.1, -0.1}}; LinkedGeoLoop* inner = malloc(sizeof(*inner)); assert(inner != NULL); createLinkedLoop(inner, &verts2[0], 4); - LatLng verts3[] = { - {0.6, 0.6}, {0.6, -0.6}, {-0.6, -0.6}, {-0.6, 0.6}}; + LatLng verts3[] = {{0.6, 0.6}, {0.6, -0.6}, {-0.6, -0.6}, {-0.6, 0.6}}; LinkedGeoLoop* outerBig = malloc(sizeof(*outerBig)); assert(outerBig != NULL); createLinkedLoop(outerBig, &verts3[0], 4); - LatLng verts4[] = { - {0.5, 0.5}, {-0.5, 0.5}, {-0.5, -0.5}, {0.5, -0.5}}; + LatLng verts4[] = {{0.5, 0.5}, {-0.5, 0.5}, {-0.5, -0.5}, {0.5, -0.5}}; LinkedGeoLoop* innerBig = malloc(sizeof(*innerBig)); assert(innerBig != NULL); createLinkedLoop(innerBig, &verts4[0], 4); diff --git a/src/apps/testapps/testPolygonToCells.c b/src/apps/testapps/testPolygonToCells.c index 802069333..3b3566f7d 100644 --- a/src/apps/testapps/testPolygonToCells.c +++ b/src/apps/testapps/testPolygonToCells.c @@ -32,14 +32,14 @@ static GeoLoop sfGeoLoop = {.numVerts = 6, .verts = sfVerts}; static GeoPolygon sfGeoPolygon; static LatLng holeVerts[] = {{0.6595072188743, -2.1371053983433}, - {0.6591482046471, -2.1373141048153}, - {0.6592295020837, -2.1365222838402}}; + {0.6591482046471, -2.1373141048153}, + {0.6592295020837, -2.1365222838402}}; static GeoLoop holeGeoLoop = {.numVerts = 3, .verts = holeVerts}; static GeoPolygon holeGeoPolygon; static LatLng emptyVerts[] = {{0.659966917655, -2.1364398519394}, - {0.659966917655, -2.1364398519395}, - {0.659966917655, -2.1364398519396}}; + {0.659966917655, -2.1364398519395}, + {0.659966917655, -2.1364398519396}}; static GeoLoop emptyGeoLoop = {.numVerts = 3, .verts = emptyVerts}; static GeoPolygon emptyGeoPolygon; @@ -211,18 +211,18 @@ SUITE(polygonToCells) { .numHoles = 0}; LatLng transMeridianVerts[] = {{0.01, -M_PI + 0.01}, - {0.01, M_PI - 0.01}, - {-0.01, M_PI - 0.01}, - {-0.01, -M_PI + 0.01}}; + {0.01, M_PI - 0.01}, + {-0.01, M_PI - 0.01}, + {-0.01, -M_PI + 0.01}}; GeoLoop transMeridianGeoLoop = {.numVerts = 4, .verts = transMeridianVerts}; GeoPolygon transMeridianGeoPolygon = {.geoloop = transMeridianGeoLoop, .numHoles = 0}; LatLng transMeridianHoleVerts[] = {{0.005, -M_PI + 0.005}, - {0.005, M_PI - 0.005}, - {-0.005, M_PI - 0.005}, - {-0.005, -M_PI + 0.005}}; + {0.005, M_PI - 0.005}, + {-0.005, M_PI - 0.005}, + {-0.005, -M_PI + 0.005}}; GeoLoop transMeridianHoleGeoLoop = {.numVerts = 4, .verts = transMeridianHoleVerts}; GeoPolygon transMeridianHoleGeoPolygon = { @@ -293,8 +293,8 @@ SUITE(polygonToCells) { // tests for a bug that was taking the max and min longitude as // the bounds for transmeridian polygons LatLng verts[] = {{0.1, -M_PI + 0.00001}, {0.1, M_PI - 0.00001}, - {0.05, M_PI - 0.2}, {-0.1, M_PI - 0.00001}, - {-0.1, -M_PI + 0.00001}, {-0.05, -M_PI + 0.2}}; + {0.05, M_PI - 0.2}, {-0.1, M_PI - 0.00001}, + {-0.1, -M_PI + 0.00001}, {-0.05, -M_PI + 0.2}}; GeoLoop geoloop = {.numVerts = 6, .verts = verts}; GeoPolygon polygon = {.geoloop = geoloop, .numHoles = 0}; @@ -336,8 +336,8 @@ SUITE(polygonToCells) { boundingBottomLeft.lat -= edgeLength2; boundingBottomLeft.lon -= edgeLength2; - LatLng verts[] = {boundingBottomLeft, boundingTopLeft, - boundingTopRigt, boundingBottomRight}; + LatLng verts[] = {boundingBottomLeft, boundingTopLeft, boundingTopRigt, + boundingBottomRight}; GeoLoop geoloop; geoloop.verts = verts; diff --git a/src/apps/testapps/testPolygonToCellsReported.c b/src/apps/testapps/testPolygonToCellsReported.c index 6a381c91e..1297bdd6f 100644 --- a/src/apps/testapps/testPolygonToCellsReported.c +++ b/src/apps/testapps/testPolygonToCellsReported.c @@ -139,9 +139,9 @@ SUITE(polygonToCells_reported) { // https://github.com/uber/h3/issues/136 TEST(h3_136) { LatLng testVerts[] = {{0.10068990369902957, 0.8920772174196191}, - {0.10032914690616246, 0.8915914753447348}, - {0.10033349237998787, 0.8915860128746426}, - {0.10069496685903621, 0.8920742194546231}}; + {0.10032914690616246, 0.8915914753447348}, + {0.10033349237998787, 0.8915860128746426}, + {0.10069496685903621, 0.8920742194546231}}; GeoLoop testGeoLoop = {.numVerts = 4, .verts = testVerts}; GeoPolygon testPolygon; testPolygon.geoloop = testGeoLoop; diff --git a/src/h3lib/include/bbox.h b/src/h3lib/include/bbox.h index 759b183ce..b009f3320 100644 --- a/src/h3lib/include/bbox.h +++ b/src/h3lib/include/bbox.h @@ -39,7 +39,6 @@ void bboxCenter(const BBox* bbox, LatLng* center); bool bboxContains(const BBox* bbox, const LatLng* point); bool bboxEquals(const BBox* b1, const BBox* b2); int bboxHexEstimate(const BBox* bbox, int res); -int lineHexEstimate(const LatLng* origin, const LatLng* destination, - int res); +int lineHexEstimate(const LatLng* origin, const LatLng* destination, int res); #endif diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index f03f322c5..76643a219 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -133,7 +133,7 @@ typedef struct { @brief cell boundary in latitude/longitude */ typedef struct { - int numVerts; ///< number of vertices + int numVerts; ///< number of vertices LatLng verts[MAX_CELL_BNDRY_VERTS]; ///< vertices in ccw order } CellBoundary; diff --git a/src/h3lib/include/vertexGraph.h b/src/h3lib/include/vertexGraph.h index c841567d8..e560dcbbf 100644 --- a/src/h3lib/include/vertexGraph.h +++ b/src/h3lib/include/vertexGraph.h @@ -57,8 +57,7 @@ int removeVertexNode(VertexGraph* graph, VertexNode* node); VertexNode* findNodeForEdge(const VertexGraph* graph, const LatLng* fromVtx, const LatLng* toVtx); -VertexNode* findNodeForVertex(const VertexGraph* graph, - const LatLng* fromVtx); +VertexNode* findNodeForVertex(const VertexGraph* graph, const LatLng* fromVtx); VertexNode* firstVertexNode(const VertexGraph* graph); diff --git a/src/h3lib/lib/algos.c b/src/h3lib/lib/algos.c index e120e5665..188caf281 100644 --- a/src/h3lib/lib/algos.c +++ b/src/h3lib/lib/algos.c @@ -776,9 +776,8 @@ int _getEdgeHexagons(const GeoLoop* geoloop, int numHexagons, int res, int* numSearchHexes, H3Index* search, H3Index* found) { for (int i = 0; i < geoloop->numVerts; i++) { LatLng origin = geoloop->verts[i]; - LatLng destination = i == geoloop->numVerts - 1 - ? geoloop->verts[0] - : geoloop->verts[i + 1]; + LatLng destination = i == geoloop->numVerts - 1 ? geoloop->verts[0] + : geoloop->verts[i + 1]; const int numHexesEstimate = lineHexEstimate(&origin, &destination, res); for (int j = 0; j < numHexesEstimate; j++) { diff --git a/src/h3lib/lib/bbox.c b/src/h3lib/lib/bbox.c index 2d9abea71..3b908fd74 100644 --- a/src/h3lib/lib/bbox.c +++ b/src/h3lib/lib/bbox.c @@ -136,8 +136,7 @@ int bboxHexEstimate(const BBox* bbox, int res) { * @param res the resolution of the H3 hexagons to trace the line * @return the estimated number of hexagons required to trace the line */ -int lineHexEstimate(const LatLng* origin, const LatLng* destination, - int res) { +int lineHexEstimate(const LatLng* origin, const LatLng* destination, int res) { // Get the area of the pentagon as the maximally-distorted area possible H3Index pentagons[12] = {0}; H3_EXPORT(getPentagons)(res, pentagons); diff --git a/src/h3lib/lib/faceijk.c b/src/h3lib/lib/faceijk.c index 2af419cee..0aeb0508e 100644 --- a/src/h3lib/lib/faceijk.c +++ b/src/h3lib/lib/faceijk.c @@ -444,8 +444,7 @@ void _geoToHex2d(const LatLng* g, int res, int* face, Vec2d* v) { * grid relative to the specified resolution. * @param g The spherical coordinates of the cell center point. */ -void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, - LatLng* g) { +void _hex2dToGeo(const Vec2d* v, int face, int res, int substrate, LatLng* g) { // calculate (r, theta) in hex2d double r = _v2dMag(v); diff --git a/src/h3lib/lib/vertexGraph.c b/src/h3lib/lib/vertexGraph.c index 15ab1fe2b..9cf41a906 100644 --- a/src/h3lib/lib/vertexGraph.c +++ b/src/h3lib/lib/vertexGraph.c @@ -194,8 +194,7 @@ VertexNode* findNodeForEdge(const VertexGraph* graph, const LatLng* fromVtx, * @param fromVtx Start vertex * @return Pointer to the vertex node, if found */ -VertexNode* findNodeForVertex(const VertexGraph* graph, - const LatLng* fromVtx) { +VertexNode* findNodeForVertex(const VertexGraph* graph, const LatLng* fromVtx) { return findNodeForEdge(graph, fromVtx, NULL); } From 8289bfcf83469ea54b16b8f45fc630dde55bc05a Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:16:30 -0700 Subject: [PATCH 21/74] remaining GeoPoints --- CMakeLists.txt | 4 ++-- .../v4.0.0/names_for_concepts_types_functions.md | 6 +++--- dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md | 2 +- src/apps/testapps/{testGeoPoint.c => testLatLng.c} | 0 website/docs/api/indexing.mdx | 12 ++++++------ website/docs/library/migration-3.x/functions.md | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) rename src/apps/testapps/{testGeoPoint.c => testLatLng.c} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76b2db426..c393ac2c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,7 +180,7 @@ set(OTHER_SOURCE_FILES src/apps/testapps/testCellToCenterChild.c src/apps/testapps/testCellToChildren.c src/apps/testapps/testGetIcosahedronFaces.c - src/apps/testapps/testGeoPoint.c + src/apps/testapps/testLatLng.c src/apps/testapps/testGridRingUnsafe.c src/apps/testapps/testH3SetToVertexGraph.c src/apps/testapps/testBBox.c @@ -586,7 +586,7 @@ if(H3_IS_ROOT_PROJECT AND BUILD_TESTING) add_h3_test(testPolygonToCellsReported src/apps/testapps/testPolygonToCellsReported.c) add_h3_test(testVertexGraph src/apps/testapps/testVertexGraph.c) add_h3_test(testDirectedEdge src/apps/testapps/testDirectedEdge.c) - add_h3_test(testGeoPoint src/apps/testapps/testGeoPoint.c) + add_h3_test(testLatLng src/apps/testapps/testLatLng.c) add_h3_test(testBBox src/apps/testapps/testBBox.c) add_h3_test(testVertex src/apps/testapps/testVertex.c) add_h3_test(testPolygon src/apps/testapps/testPolygon.c) diff --git a/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md b/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md index fa8abdd60..dd9504df4 100644 --- a/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md +++ b/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md @@ -262,9 +262,9 @@ discussion requiring benchmarking, so we will defer that to a | Current name | Proposed name | Notes | |-------------------|-------------------|-----------------------------------| -| `GeoBoundary` | `CellBoundary` | <= 10 stack-allocated `GeoPoint`s | -| `GeoCoord` | `GeoPoint` | | -| `Geofence` | `GeoLoop` | heap-allocated `GeoPoint`s | +| `GeoBoundary` | `CellBoundary` | <= 10 stack-allocated `LatLng`s | +| `GeoCoord` | `LatLng` | | +| `Geofence` | `GeoLoop` | heap-allocated `LatLng`s | | `GeoPolygon` | `GeoPolygon` | | | `GeoMultiPolygon` | `GeoMultiPolygon` | currently not used | diff --git a/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md b/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md index 0f91823af..426c72805 100644 --- a/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md +++ b/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md @@ -47,4 +47,4 @@ Proposed simple algorithm for determining ownership: * `void getCellVertexes(H3Index cell, H3Vertex *vertices)` * `H3Vertex getCellVertex(H3Index cell, int vertIndex)` -* `GeoCoord vertexToGeoPoint(H3Vertex vertex)` +* `GeoCoord vertexToLatLng(H3Vertex vertex)` diff --git a/src/apps/testapps/testGeoPoint.c b/src/apps/testapps/testLatLng.c similarity index 100% rename from src/apps/testapps/testGeoPoint.c rename to src/apps/testapps/testLatLng.c diff --git a/website/docs/api/indexing.mdx b/website/docs/api/indexing.mdx index 4df20591b..1d39b9e52 100644 --- a/website/docs/api/indexing.mdx +++ b/website/docs/api/indexing.mdx @@ -25,7 +25,7 @@ These function are used for finding the H3 cell index containing coordinates, an ```c -H3Error latLngToCell(const GeoPoint *g, int res, H3Index *out); +H3Error latLngToCell(const LatLng *g, int res, H3Index *out); ``` @@ -81,7 +81,7 @@ Returns 0 (`E_SUCCESS`) on success. ```c -H3Error cellToLatLng(H3Index cell, GeoPoint *g); +H3Error cellToLatLng(H3Index cell, LatLng *g); ``` @@ -95,8 +95,8 @@ h3.cell_to_point(cell) ```java -GeoPoint cellToLatLng(long cell); -GeoPoint cellToLatLng(String cellAddress); +LatLng cellToLatLng(long cell); +LatLng cellToLatLng(String cellAddress); ``` @@ -149,8 +149,8 @@ h3.cell_to_boundary(cell, geo_json=False) ```java -List cellToBoundary(long cell); -List cellToBoundary(String cellAddress); +List cellToBoundary(long cell); +List cellToBoundary(String cellAddress); ``` diff --git a/website/docs/library/migration-3.x/functions.md b/website/docs/library/migration-3.x/functions.md index 3964cd797..53ae79baf 100644 --- a/website/docs/library/migration-3.x/functions.md +++ b/website/docs/library/migration-3.x/functions.md @@ -138,9 +138,9 @@ the passed-in cell. | 3.x name | 4.0.0 name | Notes | |-------------------|-------------------|-----------------------------------| -| `GeoBoundary` | `CellBoundary` | <= 10 stack-allocated `GeoPoint`s | -| `GeoCoord` | `GeoPoint` | | -| `Geofence` | `GeoLoop` | heap-allocated `GeoPoint`s | +| `GeoBoundary` | `CellBoundary` | <= 10 stack-allocated `LatLng`s | +| `GeoCoord` | `LatLng` | | +| `Geofence` | `GeoLoop` | heap-allocated `LatLng`s | | `GeoPolygon` | `GeoPolygon` | | | `GeoMultiPolygon` | `GeoMultiPolygon` | currently not used | From 474f4d0083d818edf0e5122ccffafa6f0e196cd7 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:31:42 -0700 Subject: [PATCH 22/74] filename changes --- CMakeLists.txt | 4 ++-- src/apps/applib/include/kml.h | 2 +- src/apps/applib/include/test.h | 2 +- src/apps/benchmarks/benchmarkDirectedEdge.c | 2 +- src/apps/benchmarks/benchmarkH3Api.c | 2 +- src/apps/testapps/testBBox.c | 2 +- src/apps/testapps/testCellToBoundary.c | 2 +- src/apps/testapps/testCellToLatLng.c | 2 +- src/apps/testapps/testDirectedEdge.c | 2 +- src/apps/testapps/testDirectedEdgeExhaustive.c | 2 +- src/apps/testapps/testH3Api.c | 2 +- src/apps/testapps/testH3Memory.c | 2 +- src/apps/testapps/testLatLng.c | 4 ++-- src/apps/testapps/testLatLngToCell.c | 2 +- src/apps/testapps/testLinkedGeo.c | 2 +- src/apps/testapps/testPolygon.c | 2 +- src/apps/testapps/testPolygonToCells.c | 2 +- src/apps/testapps/testPolygonToCellsReported.c | 2 +- src/apps/testapps/testVertexGraph.c | 2 +- src/h3lib/include/bbox.h | 2 +- src/h3lib/include/coordijk.h | 2 +- src/h3lib/include/faceijk.h | 2 +- src/h3lib/include/{geoPoint.h => latLng.h} | 2 +- src/h3lib/include/linkedGeo.h | 2 +- src/h3lib/include/polygon.h | 2 +- src/h3lib/include/polygonAlgos.h | 2 +- src/h3lib/include/vec3d.h | 2 +- src/h3lib/include/vertexGraph.h | 2 +- src/h3lib/lib/algos.c | 2 +- src/h3lib/lib/bbox.c | 2 +- src/h3lib/lib/coordijk.c | 4 ++-- src/h3lib/lib/directedEdge.c | 2 +- src/h3lib/lib/faceijk.c | 2 +- src/h3lib/lib/{geoPoint.c => latLng.c} | 4 ++-- src/h3lib/lib/linkedGeo.c | 2 +- src/h3lib/lib/polygon.c | 2 +- src/h3lib/lib/vertex.c | 2 +- src/h3lib/lib/vertexGraph.c | 2 +- 38 files changed, 42 insertions(+), 42 deletions(-) rename src/h3lib/include/{geoPoint.h => latLng.h} (98%) rename src/h3lib/lib/{geoPoint.c => latLng.c} (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index c393ac2c0..a42716c68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,7 +106,7 @@ set(LIB_SOURCE_FILES src/h3lib/include/polygonAlgos.h src/h3lib/include/h3Index.h src/h3lib/include/directedEdge.h - src/h3lib/include/geoPoint.h + src/h3lib/include/latLng.h src/h3lib/include/vec2d.h src/h3lib/include/vec3d.h src/h3lib/include/linkedGeo.h @@ -129,7 +129,7 @@ set(LIB_SOURCE_FILES src/h3lib/lib/vertex.c src/h3lib/lib/linkedGeo.c src/h3lib/lib/localij.c - src/h3lib/lib/geoPoint.c + src/h3lib/lib/latLng.c src/h3lib/lib/directedEdge.c src/h3lib/lib/mathExtensions.c src/h3lib/lib/iterators.c diff --git a/src/apps/applib/include/kml.h b/src/apps/applib/include/kml.h index 634a08632..8f4775120 100644 --- a/src/apps/applib/include/kml.h +++ b/src/apps/applib/include/kml.h @@ -20,7 +20,7 @@ #ifndef KML_H #define KML_H -#include "geoPoint.h" +#include "latLng.h" // output the KML header file for points void kmlPtsHeader(const char* name, const char* desc); diff --git a/src/apps/applib/include/test.h b/src/apps/applib/include/test.h index 1514dec7a..7ffbb5904 100644 --- a/src/apps/applib/include/test.h +++ b/src/apps/applib/include/test.h @@ -22,8 +22,8 @@ #include -#include "geoPoint.h" #include "h3api.h" +#include "latLng.h" extern int globalTestCount; extern const char* currentSuiteName; diff --git a/src/apps/benchmarks/benchmarkDirectedEdge.c b/src/apps/benchmarks/benchmarkDirectedEdge.c index bd05ace27..25d189afa 100644 --- a/src/apps/benchmarks/benchmarkDirectedEdge.c +++ b/src/apps/benchmarks/benchmarkDirectedEdge.c @@ -14,8 +14,8 @@ * limitations under the License. */ #include "benchmark.h" -#include "geoPoint.h" #include "h3api.h" +#include "latLng.h" // Fixtures (arbitrary res 9 hexagon) H3Index edges[6] = {0}; diff --git a/src/apps/benchmarks/benchmarkH3Api.c b/src/apps/benchmarks/benchmarkH3Api.c index 8c2e0f1f2..69aefc136 100644 --- a/src/apps/benchmarks/benchmarkH3Api.c +++ b/src/apps/benchmarks/benchmarkH3Api.c @@ -14,8 +14,8 @@ * limitations under the License. */ #include "benchmark.h" -#include "geoPoint.h" #include "h3api.h" +#include "latLng.h" // Fixtures (arbitrary res 9 hexagon) LatLng coord = {0.659966917655, -2.1364398519396}; diff --git a/src/apps/testapps/testBBox.c b/src/apps/testapps/testBBox.c index 7deabd6fa..e756b02db 100644 --- a/src/apps/testapps/testBBox.c +++ b/src/apps/testapps/testBBox.c @@ -19,7 +19,7 @@ #include "bbox.h" #include "constants.h" -#include "geoPoint.h" +#include "latLng.h" #include "polygon.h" #include "test.h" diff --git a/src/apps/testapps/testCellToBoundary.c b/src/apps/testapps/testCellToBoundary.c index 46580960d..d42d55b84 100644 --- a/src/apps/testapps/testCellToBoundary.c +++ b/src/apps/testapps/testCellToBoundary.c @@ -29,8 +29,8 @@ #include #include "baseCells.h" -#include "geoPoint.h" #include "h3Index.h" +#include "latLng.h" #include "test.h" #include "utility.h" diff --git a/src/apps/testapps/testCellToLatLng.c b/src/apps/testapps/testCellToLatLng.c index 30193a03b..b35bb0663 100644 --- a/src/apps/testapps/testCellToLatLng.c +++ b/src/apps/testapps/testCellToLatLng.c @@ -28,8 +28,8 @@ #include #include "constants.h" -#include "geoPoint.h" #include "h3Index.h" +#include "latLng.h" #include "test.h" #include "utility.h" diff --git a/src/apps/testapps/testDirectedEdge.c b/src/apps/testapps/testDirectedEdge.c index 9844e2f8f..35ee7b7c0 100644 --- a/src/apps/testapps/testDirectedEdge.c +++ b/src/apps/testapps/testDirectedEdge.c @@ -22,8 +22,8 @@ #include #include "constants.h" -#include "geoPoint.h" #include "h3Index.h" +#include "latLng.h" #include "test.h" #include "utility.h" diff --git a/src/apps/testapps/testDirectedEdgeExhaustive.c b/src/apps/testapps/testDirectedEdgeExhaustive.c index 104891459..adbdc6720 100644 --- a/src/apps/testapps/testDirectedEdgeExhaustive.c +++ b/src/apps/testapps/testDirectedEdgeExhaustive.c @@ -26,8 +26,8 @@ #include "baseCells.h" #include "constants.h" -#include "geoPoint.h" #include "h3Index.h" +#include "latLng.h" #include "test.h" #include "utility.h" diff --git a/src/apps/testapps/testH3Api.c b/src/apps/testapps/testH3Api.c index 7064dbcfd..82af3f723 100644 --- a/src/apps/testapps/testH3Api.c +++ b/src/apps/testapps/testH3Api.c @@ -21,9 +21,9 @@ #include -#include "geoPoint.h" #include "h3Index.h" #include "h3api.h" +#include "latLng.h" #include "test.h" #include "utility.h" diff --git a/src/apps/testapps/testH3Memory.c b/src/apps/testapps/testH3Memory.c index 077154290..f494be9bf 100644 --- a/src/apps/testapps/testH3Memory.c +++ b/src/apps/testapps/testH3Memory.c @@ -22,9 +22,9 @@ #include #include -#include "geoPoint.h" #include "h3Index.h" #include "h3api.h" +#include "latLng.h" #include "test.h" #include "utility.h" diff --git a/src/apps/testapps/testLatLng.c b/src/apps/testapps/testLatLng.c index f5bf1c467..2faf8f893 100644 --- a/src/apps/testapps/testLatLng.c +++ b/src/apps/testapps/testLatLng.c @@ -23,8 +23,8 @@ #include #include "constants.h" -#include "geoPoint.h" #include "h3api.h" +#include "latLng.h" #include "test.h" #include "utility.h" @@ -46,7 +46,7 @@ static void testDecreasingFunction(double (*function)(int), } } -SUITE(geoPoint) { +SUITE(latLng) { TEST(radsToDegs) { double originalRads = 1; double degs = H3_EXPORT(radsToDegs)(originalRads); diff --git a/src/apps/testapps/testLatLngToCell.c b/src/apps/testapps/testLatLngToCell.c index 458602e34..7f84ae538 100644 --- a/src/apps/testapps/testLatLngToCell.c +++ b/src/apps/testapps/testLatLngToCell.c @@ -27,8 +27,8 @@ #include #include -#include "geoPoint.h" #include "h3Index.h" +#include "latLng.h" #include "test.h" #include "utility.h" diff --git a/src/apps/testapps/testLinkedGeo.c b/src/apps/testapps/testLinkedGeo.c index fed9203fc..9b9660e54 100644 --- a/src/apps/testapps/testLinkedGeo.c +++ b/src/apps/testapps/testLinkedGeo.c @@ -17,8 +17,8 @@ #include #include -#include "geoPoint.h" #include "h3api.h" +#include "latLng.h" #include "linkedGeo.h" #include "test.h" diff --git a/src/apps/testapps/testPolygon.c b/src/apps/testapps/testPolygon.c index e9ea7af98..413896b6b 100644 --- a/src/apps/testapps/testPolygon.c +++ b/src/apps/testapps/testPolygon.c @@ -19,8 +19,8 @@ #include "bbox.h" #include "constants.h" -#include "geoPoint.h" #include "h3Index.h" +#include "latLng.h" #include "linkedGeo.h" #include "polygon.h" #include "test.h" diff --git a/src/apps/testapps/testPolygonToCells.c b/src/apps/testapps/testPolygonToCells.c index 3b3566f7d..fa5160c48 100644 --- a/src/apps/testapps/testPolygonToCells.c +++ b/src/apps/testapps/testPolygonToCells.c @@ -18,8 +18,8 @@ #include "algos.h" #include "constants.h" -#include "geoPoint.h" #include "h3Index.h" +#include "latLng.h" #include "test.h" #include "utility.h" diff --git a/src/apps/testapps/testPolygonToCellsReported.c b/src/apps/testapps/testPolygonToCellsReported.c index 1297bdd6f..a34a7281e 100644 --- a/src/apps/testapps/testPolygonToCellsReported.c +++ b/src/apps/testapps/testPolygonToCellsReported.c @@ -18,8 +18,8 @@ #include "algos.h" #include "constants.h" -#include "geoPoint.h" #include "h3Index.h" +#include "latLng.h" #include "test.h" #include "utility.h" diff --git a/src/apps/testapps/testVertexGraph.c b/src/apps/testapps/testVertexGraph.c index bd926ca61..cf3aeb544 100644 --- a/src/apps/testapps/testVertexGraph.c +++ b/src/apps/testapps/testVertexGraph.c @@ -17,8 +17,8 @@ #include #include -#include "geoPoint.h" #include "h3api.h" +#include "latLng.h" #include "test.h" #include "vertexGraph.h" diff --git a/src/h3lib/include/bbox.h b/src/h3lib/include/bbox.h index b009f3320..e31948bb8 100644 --- a/src/h3lib/include/bbox.h +++ b/src/h3lib/include/bbox.h @@ -22,7 +22,7 @@ #include -#include "geoPoint.h" +#include "latLng.h" /** @struct BBox * @brief Geographic bounding box with coordinates defined in radians diff --git a/src/h3lib/include/coordijk.h b/src/h3lib/include/coordijk.h index c7e7cae49..a84243544 100644 --- a/src/h3lib/include/coordijk.h +++ b/src/h3lib/include/coordijk.h @@ -30,8 +30,8 @@ #ifndef COORDIJK_H #define COORDIJK_H -#include "geoPoint.h" #include "h3api.h" +#include "latLng.h" #include "vec2d.h" /** @struct CoordIJK diff --git a/src/h3lib/include/faceijk.h b/src/h3lib/include/faceijk.h index 891197fab..d9203b5d2 100644 --- a/src/h3lib/include/faceijk.h +++ b/src/h3lib/include/faceijk.h @@ -25,7 +25,7 @@ #define FACEIJK_H #include "coordijk.h" -#include "geoPoint.h" +#include "latLng.h" #include "vec2d.h" /** @struct FaceIJK diff --git a/src/h3lib/include/geoPoint.h b/src/h3lib/include/latLng.h similarity index 98% rename from src/h3lib/include/geoPoint.h rename to src/h3lib/include/latLng.h index 7ad1c0f8f..5f5f50fa6 100644 --- a/src/h3lib/include/geoPoint.h +++ b/src/h3lib/include/latLng.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** @file geoPoint.h +/** @file latLng.h * @brief Geodetic (lat/lon) functions. */ diff --git a/src/h3lib/include/linkedGeo.h b/src/h3lib/include/linkedGeo.h index e3d35941a..8f3ba5054 100644 --- a/src/h3lib/include/linkedGeo.h +++ b/src/h3lib/include/linkedGeo.h @@ -23,8 +23,8 @@ #include #include "bbox.h" -#include "geoPoint.h" #include "h3api.h" +#include "latLng.h" // Error codes for normalizeMultiPolygon #define NORMALIZATION_SUCCESS 0 diff --git a/src/h3lib/include/polygon.h b/src/h3lib/include/polygon.h index 76c416624..492045412 100644 --- a/src/h3lib/include/polygon.h +++ b/src/h3lib/include/polygon.h @@ -23,8 +23,8 @@ #include #include "bbox.h" -#include "geoPoint.h" #include "h3api.h" +#include "latLng.h" #include "linkedGeo.h" // Macros for use with polygonAlgos.h diff --git a/src/h3lib/include/polygonAlgos.h b/src/h3lib/include/polygonAlgos.h index 386e29a39..e2555c668 100644 --- a/src/h3lib/include/polygonAlgos.h +++ b/src/h3lib/include/polygonAlgos.h @@ -28,8 +28,8 @@ #include "bbox.h" #include "constants.h" -#include "geoPoint.h" #include "h3api.h" +#include "latLng.h" #include "linkedGeo.h" #include "polygon.h" diff --git a/src/h3lib/include/vec3d.h b/src/h3lib/include/vec3d.h index ee598daad..f5902b523 100644 --- a/src/h3lib/include/vec3d.h +++ b/src/h3lib/include/vec3d.h @@ -20,7 +20,7 @@ #ifndef VEC3D_H #define VEC3D_H -#include "geoPoint.h" +#include "latLng.h" /** @struct Vec3D * @brief 3D floating point structure diff --git a/src/h3lib/include/vertexGraph.h b/src/h3lib/include/vertexGraph.h index e560dcbbf..f2676bd79 100644 --- a/src/h3lib/include/vertexGraph.h +++ b/src/h3lib/include/vertexGraph.h @@ -23,7 +23,7 @@ #include #include -#include "geoPoint.h" +#include "latLng.h" /** @struct VertexNode * @brief A single node in a vertex graph, part of a linked list diff --git a/src/h3lib/lib/algos.c b/src/h3lib/lib/algos.c index 188caf281..dac4ba0a5 100644 --- a/src/h3lib/lib/algos.c +++ b/src/h3lib/lib/algos.c @@ -30,9 +30,9 @@ #include "baseCells.h" #include "bbox.h" #include "faceijk.h" -#include "geoPoint.h" #include "h3Index.h" #include "h3api.h" +#include "latLng.h" #include "linkedGeo.h" #include "polygon.h" #include "vertexGraph.h" diff --git a/src/h3lib/lib/bbox.c b/src/h3lib/lib/bbox.c index 3b908fd74..7d87d4034 100644 --- a/src/h3lib/lib/bbox.c +++ b/src/h3lib/lib/bbox.c @@ -24,8 +24,8 @@ #include #include "constants.h" -#include "geoPoint.h" #include "h3Index.h" +#include "latLng.h" /** * Whether the given bounding box crosses the antimeridian diff --git a/src/h3lib/lib/coordijk.c b/src/h3lib/lib/coordijk.c index c1e5eb603..06e828af7 100644 --- a/src/h3lib/lib/coordijk.c +++ b/src/h3lib/lib/coordijk.c @@ -26,7 +26,7 @@ #include #include "constants.h" -#include "geoPoint.h" +#include "latLng.h" #include "mathExtensions.h" /** @@ -553,4 +553,4 @@ void cubeToIjk(CoordIJK* ijk) { ijk->i = -ijk->i; ijk->k = 0; _ijkNormalize(ijk); -} \ No newline at end of file +} diff --git a/src/h3lib/lib/directedEdge.c b/src/h3lib/lib/directedEdge.c index dd13b6f45..b190c2e1d 100644 --- a/src/h3lib/lib/directedEdge.c +++ b/src/h3lib/lib/directedEdge.c @@ -23,8 +23,8 @@ #include "algos.h" #include "constants.h" #include "coordijk.h" -#include "geoPoint.h" #include "h3Index.h" +#include "latLng.h" #include "vertex.h" /** diff --git a/src/h3lib/lib/faceijk.c b/src/h3lib/lib/faceijk.c index 0aeb0508e..c037d7e34 100644 --- a/src/h3lib/lib/faceijk.c +++ b/src/h3lib/lib/faceijk.c @@ -28,8 +28,8 @@ #include "constants.h" #include "coordijk.h" -#include "geoPoint.h" #include "h3Index.h" +#include "latLng.h" #include "vec3d.h" /** square root of 7 */ diff --git a/src/h3lib/lib/geoPoint.c b/src/h3lib/lib/latLng.c similarity index 99% rename from src/h3lib/lib/geoPoint.c rename to src/h3lib/lib/latLng.c index b22e0751f..44e22c597 100644 --- a/src/h3lib/lib/geoPoint.c +++ b/src/h3lib/lib/latLng.c @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** @file geoPoint.c +/** @file latLng.c * @brief Functions for working with lat/lon coordinates. */ -#include "geoPoint.h" +#include "latLng.h" #include #include diff --git a/src/h3lib/lib/linkedGeo.c b/src/h3lib/lib/linkedGeo.c index 3aecd9187..e2dd23eac 100644 --- a/src/h3lib/lib/linkedGeo.c +++ b/src/h3lib/lib/linkedGeo.c @@ -23,8 +23,8 @@ #include #include "alloc.h" -#include "geoPoint.h" #include "h3api.h" +#include "latLng.h" /** * Add a linked polygon to the current polygon diff --git a/src/h3lib/lib/polygon.c b/src/h3lib/lib/polygon.c index 658659049..3d28f5095 100644 --- a/src/h3lib/lib/polygon.c +++ b/src/h3lib/lib/polygon.c @@ -25,8 +25,8 @@ #include "bbox.h" #include "constants.h" -#include "geoPoint.h" #include "h3api.h" +#include "latLng.h" #include "linkedGeo.h" // Define macros used in polygon algos for GeoLoop diff --git a/src/h3lib/lib/vertex.c b/src/h3lib/lib/vertex.c index 2a110d5a4..282ff3658 100644 --- a/src/h3lib/lib/vertex.c +++ b/src/h3lib/lib/vertex.c @@ -25,8 +25,8 @@ #include "algos.h" #include "baseCells.h" #include "faceijk.h" -#include "geoPoint.h" #include "h3Index.h" +#include "latLng.h" #define DIRECTION_INDEX_OFFSET 2 diff --git a/src/h3lib/lib/vertexGraph.c b/src/h3lib/lib/vertexGraph.c index 9cf41a906..153a1d6f3 100644 --- a/src/h3lib/lib/vertexGraph.c +++ b/src/h3lib/lib/vertexGraph.c @@ -26,7 +26,7 @@ #include #include "alloc.h" -#include "geoPoint.h" +#include "latLng.h" /** * Initialize a new VertexGraph From 5b99ff7efb9ed87aceb3aba3352683035d2b3faf Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:33:38 -0700 Subject: [PATCH 23/74] lonDegs --- src/apps/testapps/testCellToBoundary.c | 6 +++--- src/apps/testapps/testCellToLatLng.c | 6 +++--- src/apps/testapps/testLatLngToCell.c | 6 +++--- src/h3lib/include/latLng.h | 2 +- src/h3lib/lib/latLng.c | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/apps/testapps/testCellToBoundary.c b/src/apps/testapps/testCellToBoundary.c index d42d55b84..4909bb361 100644 --- a/src/apps/testapps/testCellToBoundary.c +++ b/src/apps/testapps/testCellToBoundary.c @@ -79,13 +79,13 @@ int readBoundary(FILE* f, CellBoundary* b) { return -5; } - double latDegs, lonDegs; - if (sscanf(buff, "%lf %lf", &latDegs, &lonDegs) != 2) { + double latDegs, lngDegs; + if (sscanf(buff, "%lf %lf", &latDegs, &lngDegs) != 2) { printf("parsing CellBoundary from input"); return -6; } - setGeoDegs(&b->verts[b->numVerts], latDegs, lonDegs); + setGeoDegs(&b->verts[b->numVerts], latDegs, lngDegs); b->numVerts++; } diff --git a/src/apps/testapps/testCellToLatLng.c b/src/apps/testapps/testCellToLatLng.c index b35bb0663..6aeeb5c77 100644 --- a/src/apps/testapps/testCellToLatLng.c +++ b/src/apps/testapps/testCellToLatLng.c @@ -68,15 +68,15 @@ int main(int argc, char* argv[]) { error("reading input from stdin"); } - double latDegs, lonDegs; - if (sscanf(buff, "%s %lf %lf", h3Str, &latDegs, &lonDegs) != 3) + double latDegs, lngDegs; + if (sscanf(buff, "%s %lf %lf", h3Str, &latDegs, &lngDegs) != 3) error("parsing input (should be \"H3Index lat lon\")"); H3Index h3; h3 = H3_EXPORT(stringToH3)(h3Str); LatLng coord; - setGeoDegs(&coord, latDegs, lonDegs); + setGeoDegs(&coord, latDegs, lngDegs); assertExpected(h3, &coord); } diff --git a/src/apps/testapps/testLatLngToCell.c b/src/apps/testapps/testLatLngToCell.c index 7f84ae538..2c1ac675f 100644 --- a/src/apps/testapps/testLatLngToCell.c +++ b/src/apps/testapps/testLatLngToCell.c @@ -59,15 +59,15 @@ int main(int argc, char* argv[]) { error("reading input from stdin"); } - double latDegs, lonDegs; - if (sscanf(buff, "%s %lf %lf", h3Str, &latDegs, &lonDegs) != 3) + double latDegs, lngDegs; + if (sscanf(buff, "%s %lf %lf", h3Str, &latDegs, &lngDegs) != 3) error("parsing input (should be \"H3Index lat lon\")"); H3Index h3; h3 = H3_EXPORT(stringToH3)(h3Str); LatLng coord; - setGeoDegs(&coord, latDegs, lonDegs); + setGeoDegs(&coord, latDegs, lngDegs); assertExpected(h3, &coord); } diff --git a/src/h3lib/include/latLng.h b/src/h3lib/include/latLng.h index 5f5f50fa6..a6258987c 100644 --- a/src/h3lib/include/latLng.h +++ b/src/h3lib/include/latLng.h @@ -32,7 +32,7 @@ /** epsilon of ~0.1mm in radians */ #define EPSILON_RAD (EPSILON_DEG * M_PI_180) -void setGeoDegs(LatLng *p, double latDegs, double lonDegs); +void setGeoDegs(LatLng *p, double latDegs, double lngDegs); double constrainLat(double lat); double constrainLng(double lng); diff --git a/src/h3lib/lib/latLng.c b/src/h3lib/lib/latLng.c index 44e22c597..70f2a188e 100644 --- a/src/h3lib/lib/latLng.c +++ b/src/h3lib/lib/latLng.c @@ -72,11 +72,11 @@ bool geoAlmostEqual(const LatLng *p1, const LatLng *p2) { * * @param p The spherical coordinates. * @param latDegs The desired latitude in decimal degrees. - * @param lonDegs The desired longitude in decimal degrees. + * @param lngDegs The desired longitude in decimal degrees. */ -void setGeoDegs(LatLng *p, double latDegs, double lonDegs) { +void setGeoDegs(LatLng *p, double latDegs, double lngDegs) { _setGeoRads(p, H3_EXPORT(degsToRads)(latDegs), - H3_EXPORT(degsToRads)(lonDegs)); + H3_EXPORT(degsToRads)(lngDegs)); } /** From 0cca39e13db4c5a1c0498cfeef9d84469bb60fee Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:34:51 -0700 Subject: [PATCH 24/74] lonRads --- src/h3lib/include/latLng.h | 2 +- src/h3lib/lib/latLng.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/h3lib/include/latLng.h b/src/h3lib/include/latLng.h index a6258987c..df6a8afc6 100644 --- a/src/h3lib/include/latLng.h +++ b/src/h3lib/include/latLng.h @@ -43,7 +43,7 @@ bool geoAlmostEqualThreshold(const LatLng *p1, const LatLng *p2, // Internal functions double _posAngleRads(double rads); -void _setGeoRads(LatLng *p, double latRads, double lonRads); +void _setGeoRads(LatLng *p, double latRads, double lngRads); double _geoAzimuthRads(const LatLng *p1, const LatLng *p2); void _geoAzDistanceRads(const LatLng *p1, double az, double distance, LatLng *p2); diff --git a/src/h3lib/lib/latLng.c b/src/h3lib/lib/latLng.c index 70f2a188e..aedc6f1e3 100644 --- a/src/h3lib/lib/latLng.c +++ b/src/h3lib/lib/latLng.c @@ -84,11 +84,11 @@ void setGeoDegs(LatLng *p, double latDegs, double lngDegs) { * * @param p The spherical coordinates. * @param latRads The desired latitude in decimal radians. - * @param lonRads The desired longitude in decimal radians. + * @param lngRads The desired longitude in decimal radians. */ -void _setGeoRads(LatLng *p, double latRads, double lonRads) { +void _setGeoRads(LatLng *p, double latRads, double lngRads) { p->lat = latRads; - p->lon = lonRads; + p->lon = lngRads; } /** From dfc8c14a194632ecb6d38c479556ae3839b82659 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:36:25 -0700 Subject: [PATCH 25/74] coslon and sinlon --- src/apps/testapps/testH3Api.c | 2 +- src/h3lib/lib/latLng.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/apps/testapps/testH3Api.c b/src/apps/testapps/testH3Api.c index 82af3f723..12b8c3636 100644 --- a/src/apps/testapps/testH3Api.c +++ b/src/apps/testapps/testH3Api.c @@ -84,7 +84,7 @@ SUITE(h3Api) { t_assertBoundary(h3, &boundary); } - TEST(cellToBoundary_coslonConstrain) { + TEST(cellToBoundary_coslngConstrain) { // Bug test for https://github.com/uber/h3/issues/212 H3Index h3 = 0x87dc6d364ffffffL; CellBoundary boundary; diff --git a/src/h3lib/lib/latLng.c b/src/h3lib/lib/latLng.c index aedc6f1e3..4c0f16e64 100644 --- a/src/h3lib/lib/latLng.c +++ b/src/h3lib/lib/latLng.c @@ -202,7 +202,7 @@ void _geoAzDistanceRads(const LatLng *p1, double az, double distance, return; } - double sinlat, sinlon, coslon; + double sinlat, sinlng, coslng; az = _posAngleRads(az); @@ -239,14 +239,14 @@ void _geoAzDistanceRads(const LatLng *p1, double az, double distance, p2->lat = -M_PI_2; p2->lon = 0.0; } else { - sinlon = sin(az) * sin(distance) / cos(p2->lat); - coslon = (cos(distance) - sin(p1->lat) * sin(p2->lat)) / + sinlng = sin(az) * sin(distance) / cos(p2->lat); + coslng = (cos(distance) - sin(p1->lat) * sin(p2->lat)) / cos(p1->lat) / cos(p2->lat); - if (sinlon > 1.0) sinlon = 1.0; - if (sinlon < -1.0) sinlon = -1.0; - if (coslon > 1.0) coslon = 1.0; - if (coslon < -1.0) coslon = -1.0; - p2->lon = constrainLng(p1->lon + atan2(sinlon, coslon)); + if (sinlng > 1.0) sinlng = 1.0; + if (sinlng < -1.0) sinlng = -1.0; + if (coslng > 1.0) coslng = 1.0; + if (coslng < -1.0) coslng = -1.0; + p2->lon = constrainLng(p1->lon + atan2(sinlng, coslng)); } } } From 075dd5e41f11e5930f113f76451d049d59cfd3e8 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:42:18 -0700 Subject: [PATCH 26/74] lat/lon -> lat/lng --- dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md | 4 ++-- src/apps/applib/lib/utility.c | 2 +- src/apps/filters/cellToBoundary.c | 2 +- src/apps/filters/cellToLatLng.c | 2 +- src/apps/filters/latLngToCell.c | 16 ++++++++-------- src/apps/miscapps/cellToBoundaryHier.c | 4 ++-- src/apps/miscapps/cellToLatLngHier.c | 4 ++-- src/apps/miscapps/generateFaceCenterPoint.c | 2 +- src/apps/testapps/mkRandGeo.c | 8 ++++---- src/apps/testapps/mkRandGeoBoundary.c | 4 ++-- src/apps/testapps/testCellToLatLng.c | 6 +++--- src/apps/testapps/testLatLngToCell.c | 8 ++++---- src/h3lib/include/coordijk.h | 2 +- src/h3lib/include/faceijk.h | 2 +- src/h3lib/include/h3api.h.in | 4 ++-- src/h3lib/include/latLng.h | 2 +- src/h3lib/lib/coordijk.c | 2 +- src/h3lib/lib/faceijk.c | 14 +++++++------- src/h3lib/lib/latLng.c | 2 +- src/h3lib/lib/vertexGraph.c | 2 +- website/docs/core-library/filters.md | 6 +++--- .../version-3.x/core-library/filters.md | 6 +++--- 22 files changed, 52 insertions(+), 52 deletions(-) diff --git a/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md b/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md index 426c72805..6ea01da91 100644 --- a/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md +++ b/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md @@ -13,8 +13,8 @@ This proposal would add a new H3 index mode, Vertex Mode, to provide a canonical The advantages of this approach: * Shared vertices can be compared between hexagons with a strict equality check -* Vertices can be represented and stored without the trig calls required to produce a lat/lon point -* Vertex to lat/lon can be guaranteed to return the same result across different cells that share the vertex +* Vertices can be represented and stored without the trig calls required to produce a lat/lng point +* Vertex to lat/lng can be guaranteed to return the same result across different cells that share the vertex At a minimum, this should open up significant performance and correctness gains in `h3SetToLinkedGeo` and `directedEdgeToBoundary`, and there are likely other uses as well. diff --git a/src/apps/applib/lib/utility.c b/src/apps/applib/lib/utility.c index 6e6b138f5..a0808c591 100644 --- a/src/apps/applib/lib/utility.c +++ b/src/apps/applib/lib/utility.c @@ -167,7 +167,7 @@ void iterateBaseCellIndexesAtRes(int res, void (*callback)(H3Index), } /** - * Generates a random lat/lon pair. + * Generates a random lat/lng pair. * * @param g Lat/lon will be placed here. */ diff --git a/src/apps/filters/cellToBoundary.c b/src/apps/filters/cellToBoundary.c index 6adde01aa..283ffbd4c 100644 --- a/src/apps/filters/cellToBoundary.c +++ b/src/apps/filters/cellToBoundary.c @@ -14,7 +14,7 @@ * limitations under the License. */ /** @file - * @brief stdin/stdout filter that converts from integer H3 indexes to lat/lon + * @brief stdin/stdout filter that converts from integer H3 indexes to lat/lng * cell boundaries * * See `cellToBoundary --help` for usage. diff --git a/src/apps/filters/cellToLatLng.c b/src/apps/filters/cellToLatLng.c index e6e654576..32490de1e 100644 --- a/src/apps/filters/cellToLatLng.c +++ b/src/apps/filters/cellToLatLng.c @@ -14,7 +14,7 @@ * limitations under the License. */ /** @file - * @brief stdin/stdout filter that converts from integer H3 indexes to lat/lon + * @brief stdin/stdout filter that converts from integer H3 indexes to lat/lng * cell center point * * See `cellToLatLng --help` for usage. diff --git a/src/apps/filters/latLngToCell.c b/src/apps/filters/latLngToCell.c index 78c3dd713..5e2727b41 100644 --- a/src/apps/filters/latLngToCell.c +++ b/src/apps/filters/latLngToCell.c @@ -14,16 +14,16 @@ * limitations under the License. */ /** @file - * @brief stdin/stdout filter that converts from lat/lon coordinates to integer + * @brief stdin/stdout filter that converts from lat/lng coordinates to integer * H3 indexes * * See `latLngToCell --help` for usage. * - * The program reads lat/lon pairs from stdin until EOF is encountered. For - * each lat/lon the program outputs to stdout the integer H3 index of the + * The program reads lat/lng pairs from stdin until EOF is encountered. For + * each lat/lng the program outputs to stdout the integer H3 index of the * containing cell at the specified resolution. * - * The stdin input should have the following format (lat/lon in decimal + * The stdin input should have the following format (lat/lng in decimal * degrees): * * lat0 lon0 @@ -101,19 +101,19 @@ int main(int argc, char* argv[]) { if (latArg.found) { doCoords(lat, lon, res); } else { - // process the lat/lon's on stdin + // process the lat/lng's on stdin char buff[BUFF_SIZE]; while (1) { - // get a lat/lon from stdin + // get a lat/lng from stdin if (!fgets(buff, BUFF_SIZE, stdin)) { if (feof(stdin)) break; else - error("reading lat/lon"); + error("reading lat/lng"); } if (sscanf(buff, "%lf %lf", &lat, &lon) != 2) - error("parsing lat/lon"); + error("parsing lat/lng"); // convert to H3 doCoords(lat, lon, res); diff --git a/src/apps/miscapps/cellToBoundaryHier.c b/src/apps/miscapps/cellToBoundaryHier.c index 024101785..2061fdb45 100644 --- a/src/apps/miscapps/cellToBoundaryHier.c +++ b/src/apps/miscapps/cellToBoundaryHier.c @@ -19,7 +19,7 @@ * * See `cellToBoundaryHier` for usage. * - * The program generates the cell boundaries in lat/lon coordinates for all + * The program generates the cell boundaries in lat/lng coordinates for all * hierarchical children of H3Index at the specified resolution. If the * specified resolution is less than or equal to the resolution of H3Index * the single cell H3Index is processed. @@ -34,7 +34,7 @@ * --------- * * `cellToBoundaryHier --parent 836e9bfffffffff` - * - outputs the cell boundary in lat/lon for cell `836e9bfffffffff` as + * - outputs the cell boundary in lat/lng for cell `836e9bfffffffff` as * plain text * * `cellToBoundaryHier --parent 820ceffffffffff --resolution 4 --kml > diff --git a/src/apps/miscapps/cellToLatLngHier.c b/src/apps/miscapps/cellToLatLngHier.c index 4856d93ef..2612cd2e3 100644 --- a/src/apps/miscapps/cellToLatLngHier.c +++ b/src/apps/miscapps/cellToLatLngHier.c @@ -19,7 +19,7 @@ * * See `cellToLatLngHier --help` for usage. * - * The program generates the cell center points in lat/lon coordinates for all + * The program generates the cell center points in lat/lng coordinates for all * hierarchical children of H3Index at the specified resolution. If the * specified resolution is less than or equal to the resolution of H3Index * the single cell H3Index is processed. @@ -34,7 +34,7 @@ * --------- * * `cellToLatLngHier --parent 836e9bfffffffff` - * - outputs the cell center point in lat/lon for cell + * - outputs the cell center point in lat/lng for cell * `836e9bfffffffff` as plain text * * `cellToLatLngHier --parent 820ceffffffffff --resolution 4 --kml > diff --git a/src/apps/miscapps/generateFaceCenterPoint.c b/src/apps/miscapps/generateFaceCenterPoint.c index 657bf21cc..84494eb9a 100644 --- a/src/apps/miscapps/generateFaceCenterPoint.c +++ b/src/apps/miscapps/generateFaceCenterPoint.c @@ -24,7 +24,7 @@ #include "faceijk.h" #include "vec3d.h" -/** @brief icosahedron face centers in lat/lon radians. Copied from faceijk.c. +/** @brief icosahedron face centers in lat/lng radians. Copied from faceijk.c. */ const LatLng faceCenterGeoCopy[NUM_ICOSA_FACES] = { {0.803582649718989942, 1.248397419617396099}, // face 0 diff --git a/src/apps/testapps/mkRandGeo.c b/src/apps/testapps/mkRandGeo.c index bf9089d52..a2f38ad8c 100644 --- a/src/apps/testapps/mkRandGeo.c +++ b/src/apps/testapps/mkRandGeo.c @@ -14,12 +14,12 @@ * limitations under the License. */ /** @file - * @brief generates random lat/lon pairs and bins them at the specified + * @brief generates random lat/lng pairs and bins them at the specified * resolution * * See `mkRandGeo --help` for usage. * - * The program generates `numPoints` random lat/lon coordinates and outputs + * The program generates `numPoints` random lat/lng coordinates and outputs * them along with the corresponding H3Index at the specified `resolution`. */ @@ -40,7 +40,7 @@ int main(int argc, char* argv[]) { .scanFormat = "%d", .valueName = "num", .value = &numPoints, - .helpText = "Number of random lat/lon pairs to generate."}; + .helpText = "Number of random lat/lng pairs to generate."}; Arg resArg = {.names = {"-r", "--resolution"}, .required = true, .scanFormat = "%d", @@ -51,7 +51,7 @@ int main(int argc, char* argv[]) { Arg* args[] = {&helpArg, &numPointsArg, &resArg}; const int numArgs = 3; const char* helpText = - "Generates random lat/lon pairs and indexes them at the specified " + "Generates random lat/lng pairs and indexes them at the specified " "resolution."; if (parseArgs(argc, argv, numArgs, args, &helpArg, helpText)) { diff --git a/src/apps/testapps/mkRandGeoBoundary.c b/src/apps/testapps/mkRandGeoBoundary.c index 5506fbf74..7c4403721 100644 --- a/src/apps/testapps/mkRandGeoBoundary.c +++ b/src/apps/testapps/mkRandGeoBoundary.c @@ -18,7 +18,7 @@ * * See `mkRandCellBoundary --help` for usage. * - * The program generates `numPoints` random lat/lon coordinates and outputs + * The program generates `numPoints` random lat/lng coordinates and outputs * them along with the corresponding H3Index at the specified `resolution`. */ @@ -39,7 +39,7 @@ int main(int argc, char* argv[]) { .scanFormat = "%d", .valueName = "num", .value = &numPoints, - .helpText = "Number of random lat/lon pairs to generate."}; + .helpText = "Number of random lat/lng pairs to generate."}; Arg resArg = {.names = {"-r", "--resolution"}, .required = true, .scanFormat = "%d", diff --git a/src/apps/testapps/testCellToLatLng.c b/src/apps/testapps/testCellToLatLng.c index 6aeeb5c77..3d56fefcd 100644 --- a/src/apps/testapps/testCellToLatLng.c +++ b/src/apps/testapps/testCellToLatLng.c @@ -18,7 +18,7 @@ * * usage: `testCellToLatLng` * - * The program reads lines containing H3 indexes and lat/lon center + * The program reads lines containing H3 indexes and lat/lng center * point pairs from stdin until EOF is encountered. For each input line, * the program calls `cellToLatLng` to convert H3 index to a lat/lng, then * validates against the input lat/lng within a given threshold @@ -35,7 +35,7 @@ void assertExpected(H3Index h1, const LatLng* g1) { const double epsilon = 0.000001 * M_PI_180; - // convert H3 to lat/lon and verify + // convert H3 to lat/lng and verify LatLng g2; H3_EXPORT(cellToLatLng)(h1, &g2); @@ -56,7 +56,7 @@ int main(int argc, char* argv[]) { exit(1); } - // process the indexes and lat/lons on stdin + // process the indexes and lat/lngs on stdin char buff[BUFF_SIZE]; char h3Str[BUFF_SIZE]; while (1) { diff --git a/src/apps/testapps/testLatLngToCell.c b/src/apps/testapps/testLatLngToCell.c index 2c1ac675f..fcb1087ff 100644 --- a/src/apps/testapps/testLatLngToCell.c +++ b/src/apps/testapps/testLatLngToCell.c @@ -18,9 +18,9 @@ * * usage: `testLatLngToCell` * - * The program reads lines containing H3 indexes and lat/lon pairs from + * The program reads lines containing H3 indexes and lat/lng pairs from * stdin until EOF is encountered. For each input line, it calls `latLngToCell` - * to convert the input lat/lon to an H3 index, and then validates the + * to convert the input lat/lng to an H3 index, and then validates the * index against the original input index. */ @@ -33,7 +33,7 @@ #include "utility.h" static void assertExpected(H3Index h1, const LatLng* g1) { - // convert lat/lon to H3 and verify + // convert lat/lng to H3 and verify int res = H3_EXPORT(getResolution)(h1); H3Index h2; t_assertSuccess(H3_EXPORT(latLngToCell)(g1, res, &h2)); @@ -47,7 +47,7 @@ int main(int argc, char* argv[]) { exit(1); } - // process the indexes and lat/lons on stdin + // process the indexes and lat/lngs on stdin char buff[BUFF_SIZE]; char h3Str[BUFF_SIZE]; while (1) { diff --git a/src/h3lib/include/coordijk.h b/src/h3lib/include/coordijk.h index a84243544..292f47864 100644 --- a/src/h3lib/include/coordijk.h +++ b/src/h3lib/include/coordijk.h @@ -14,7 +14,7 @@ * limitations under the License. */ /** @file coordijk.h - * @brief Header file for CoordIJK functions including conversion from lat/lon + * @brief Header file for CoordIJK functions including conversion from lat/lng * * References two Vec2d cartesian coordinate systems: * diff --git a/src/h3lib/include/faceijk.h b/src/h3lib/include/faceijk.h index d9203b5d2..9c474a2dd 100644 --- a/src/h3lib/include/faceijk.h +++ b/src/h3lib/include/faceijk.h @@ -14,7 +14,7 @@ * limitations under the License. */ /** @file faceijk.h - * @brief FaceIJK functions including conversion to/from lat/lon. + * @brief FaceIJK functions including conversion to/from lat/lng. * * References the Vec2d cartesian coordinate systems hex2d: local face-centered * coordinate system scaled a specific H3 grid resolution unit length and diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index 76643a219..a90109a3c 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -215,7 +215,7 @@ DECLSPEC H3Error H3_EXPORT(latLngToCell)(const LatLng *g, int res, * Functions for cellToLatLng * @{ */ -/** @brief find the lat/lon center point g of the cell h3 */ +/** @brief find the lat/lng center point g of the cell h3 */ DECLSPEC H3Error H3_EXPORT(cellToLatLng)(H3Index h3, LatLng *g); /** @} */ @@ -223,7 +223,7 @@ DECLSPEC H3Error H3_EXPORT(cellToLatLng)(H3Index h3, LatLng *g); * Functions for cellToBoundary * @{ */ -/** @brief give the cell boundary in lat/lon coordinates for the cell h3 */ +/** @brief give the cell boundary in lat/lng coordinates for the cell h3 */ DECLSPEC H3Error H3_EXPORT(cellToBoundary)(H3Index h3, CellBoundary *gp); /** @} */ diff --git a/src/h3lib/include/latLng.h b/src/h3lib/include/latLng.h index df6a8afc6..bc885ce64 100644 --- a/src/h3lib/include/latLng.h +++ b/src/h3lib/include/latLng.h @@ -14,7 +14,7 @@ * limitations under the License. */ /** @file latLng.h - * @brief Geodetic (lat/lon) functions. + * @brief Geodetic (lat/lng) functions. */ #ifndef GEOPOINT_H diff --git a/src/h3lib/lib/coordijk.c b/src/h3lib/lib/coordijk.c index 06e828af7..70b085b0e 100644 --- a/src/h3lib/lib/coordijk.c +++ b/src/h3lib/lib/coordijk.c @@ -15,7 +15,7 @@ */ /** @file coordijk.c * @brief Hex IJK coordinate systems functions including conversions to/from - * lat/lon. + * lat/lng. */ #include "coordijk.h" diff --git a/src/h3lib/lib/faceijk.c b/src/h3lib/lib/faceijk.c index c037d7e34..66470b175 100644 --- a/src/h3lib/lib/faceijk.c +++ b/src/h3lib/lib/faceijk.c @@ -35,7 +35,7 @@ /** square root of 7 */ #define M_SQRT7 2.6457513110645905905016157536392604257102L -/** @brief icosahedron face centers in lat/lon radians */ +/** @brief icosahedron face centers in lat/lng radians */ const LatLng faceCenterGeo[NUM_ICOSA_FACES] = { {0.803582649718989942, 1.248397419617396099}, // face 0 {1.307747883455638156, 2.536945009877921159}, // face 1 @@ -516,7 +516,7 @@ void _faceIjkPentToCellBoundary(const FaceIJK* h, int res, int start, // of a distortion vertex on the last edge int additionalIteration = length == NUM_PENT_VERTS ? 1 : 0; - // convert each vertex to lat/lon + // convert each vertex to lat/lng // adjust the face of each vertex as appropriate and introduce // edge-crossing vertices as needed g->numVerts = 0; @@ -584,7 +584,7 @@ void _faceIjkPentToCellBoundary(const FaceIJK* h, int res, int start, break; } - // find the intersection and add the lat/lon point to the result + // find the intersection and add the lat/lng point to the result Vec2d inter; _v2dIntersect(&orig2d0, &orig2d1, edge0, edge1, &inter); _hex2dToGeo(&inter, tmpFijk.face, adjRes, 1, @@ -592,7 +592,7 @@ void _faceIjkPentToCellBoundary(const FaceIJK* h, int res, int start, g->numVerts++; } - // convert vertex to lat/lon and add to the result + // convert vertex to lat/lng and add to the result // vert == start + NUM_PENT_VERTS is only used to test for possible // intersection on last edge if (vert < start + NUM_PENT_VERTS) { @@ -689,7 +689,7 @@ void _faceIjkToCellBoundary(const FaceIJK* h, int res, int start, int length, // of a distortion vertex on the last edge int additionalIteration = length == NUM_HEX_VERTS ? 1 : 0; - // convert each vertex to lat/lon + // convert each vertex to lat/lng // adjust the face of each vertex as appropriate and introduce // edge-crossing vertices as needed g->numVerts = 0; @@ -749,7 +749,7 @@ void _faceIjkToCellBoundary(const FaceIJK* h, int res, int start, int length, break; } - // find the intersection and add the lat/lon point to the result + // find the intersection and add the lat/lng point to the result Vec2d inter; _v2dIntersect(&orig2d0, &orig2d1, edge0, edge1, &inter); /* @@ -766,7 +766,7 @@ void _faceIjkToCellBoundary(const FaceIJK* h, int res, int start, int length, } } - // convert vertex to lat/lon and add to the result + // convert vertex to lat/lng and add to the result // vert == start + NUM_HEX_VERTS is only used to test for possible // intersection on last edge if (vert < start + NUM_HEX_VERTS) { diff --git a/src/h3lib/lib/latLng.c b/src/h3lib/lib/latLng.c index 4c0f16e64..6af2cd1cc 100644 --- a/src/h3lib/lib/latLng.c +++ b/src/h3lib/lib/latLng.c @@ -14,7 +14,7 @@ * limitations under the License. */ /** @file latLng.c - * @brief Functions for working with lat/lon coordinates. + * @brief Functions for working with lat/lng coordinates. */ #include "latLng.h" diff --git a/src/h3lib/lib/vertexGraph.c b/src/h3lib/lib/vertexGraph.c index 153a1d6f3..41f69905a 100644 --- a/src/h3lib/lib/vertexGraph.c +++ b/src/h3lib/lib/vertexGraph.c @@ -60,7 +60,7 @@ void destroyVertexGraph(VertexGraph* graph) { } /** - * Get an integer hash for a lat/lon point, at a precision determined + * Get an integer hash for a lat/lng point, at a precision determined * by the current hexagon resolution. * TODO: Light testing suggests this might not be sufficient at resolutions * finer than 10. Design a better hash function if performance and collisions diff --git a/website/docs/core-library/filters.md b/website/docs/core-library/filters.md index 742b73644..e6f3877ed 100644 --- a/website/docs/core-library/filters.md +++ b/website/docs/core-library/filters.md @@ -14,9 +14,9 @@ All latitude/longitude coordinates are in decimal degrees. See the [H3 Index Rep | filter | input | outputs | ---------------- | --------- | ------- -| `geoToH3` | lat/lon | `H3Index` -| `h3ToGeo` | `H3Index` | cell center point in lat/lon -| `h3ToGeoBoundary`| `H3Index` | cell boundary in lat/lon +| `geoToH3` | lat/lng | `H3Index` +| `h3ToGeo` | `H3Index` | cell center point in lat/lng +| `h3ToGeoBoundary`| `H3Index` | cell boundary in lat/lng | `h3ToComponents` | `H3Index` | components | `kRing` | `H3Index` | surrounding `H3Index` | `hexRange` | `H3Index` | surrounding `H3Index`, in order diff --git a/website/versioned_docs/version-3.x/core-library/filters.md b/website/versioned_docs/version-3.x/core-library/filters.md index 742b73644..e6f3877ed 100644 --- a/website/versioned_docs/version-3.x/core-library/filters.md +++ b/website/versioned_docs/version-3.x/core-library/filters.md @@ -14,9 +14,9 @@ All latitude/longitude coordinates are in decimal degrees. See the [H3 Index Rep | filter | input | outputs | ---------------- | --------- | ------- -| `geoToH3` | lat/lon | `H3Index` -| `h3ToGeo` | `H3Index` | cell center point in lat/lon -| `h3ToGeoBoundary`| `H3Index` | cell boundary in lat/lon +| `geoToH3` | lat/lng | `H3Index` +| `h3ToGeo` | `H3Index` | cell center point in lat/lng +| `h3ToGeoBoundary`| `H3Index` | cell boundary in lat/lng | `h3ToComponents` | `H3Index` | components | `kRing` | `H3Index` | surrounding `H3Index` | `hexRange` | `H3Index` | surrounding `H3Index`, in order From 0cf7d066a7f29ba53525158b867ae4577b38fc7e Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:43:41 -0700 Subject: [PATCH 27/74] few more lat/lons --- src/apps/applib/lib/utility.c | 2 +- src/h3lib/lib/vertexGraph.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/applib/lib/utility.c b/src/apps/applib/lib/utility.c index a0808c591..d2bfaa17f 100644 --- a/src/apps/applib/lib/utility.c +++ b/src/apps/applib/lib/utility.c @@ -169,7 +169,7 @@ void iterateBaseCellIndexesAtRes(int res, void (*callback)(H3Index), /** * Generates a random lat/lng pair. * - * @param g Lat/lon will be placed here. + * @param g Lat/lng will be placed here. */ void randomGeo(LatLng* g) { static int init = 0; diff --git a/src/h3lib/lib/vertexGraph.c b/src/h3lib/lib/vertexGraph.c index 41f69905a..c1f8180a0 100644 --- a/src/h3lib/lib/vertexGraph.c +++ b/src/h3lib/lib/vertexGraph.c @@ -65,7 +65,7 @@ void destroyVertexGraph(VertexGraph* graph) { * TODO: Light testing suggests this might not be sufficient at resolutions * finer than 10. Design a better hash function if performance and collisions * seem to be an issue here. - * @param vertex Lat/lon vertex to hash + * @param vertex Lat/lng vertex to hash * @param res Resolution of the hexagon the vertex belongs to * @param numBuckets Number of buckets in the graph * @return Integer hash From 459c0180b28d05506307301647915d39db209616 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:45:55 -0700 Subject: [PATCH 28/74] E_LATLON_DOMAIN --- dev-docs/RFCs/v4.0.0/error-handling-rfc.md | 6 +++--- src/apps/testapps/testH3Api.c | 6 +++--- src/h3lib/include/h3api.h.in | 2 +- src/h3lib/lib/h3Index.c | 2 +- website/docs/library/errors.md | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dev-docs/RFCs/v4.0.0/error-handling-rfc.md b/dev-docs/RFCs/v4.0.0/error-handling-rfc.md index 4330f82e5..39aaf10cc 100644 --- a/dev-docs/RFCs/v4.0.0/error-handling-rfc.md +++ b/dev-docs/RFCs/v4.0.0/error-handling-rfc.md @@ -243,7 +243,7 @@ SQLite's approach to this is to define broad error categories (in 8 bits), and t | 0 | E_SUCCESS | Success (no error) | 1 | E_FAILED | The operation failed but a more specific error is not available | 2 | E_DOMAIN | Argument was outside of acceptable range (when a more specific error code is not available) -| 3 | E_LATLON_DOMAIN | Latitude or longitude arguments were outside of acceptable range +| 3 | E_LATLNG_DOMAIN | Latitude or longitude arguments were outside of acceptable range | 4 | E_RES_DOMAIN | Resolution argument was outside of acceptable range | 5 | E_CELL_INVALID | `H3Index` cell argument was not valid | 6 | E_DIR_EDGE_INVALID | `H3Index` directed edge argument was not valid @@ -260,7 +260,7 @@ The H3 library may always add additional error messages. Error messages not reco #### Example error code results ``` -geoToH3(lat=Infinity, lon=0, res=0, &out) => E_LATLON_DOMAIN +geoToH3(lat=Infinity, lon=0, res=0, &out) => E_LATLNG_DOMAIN geoToH3(lat=0, lat=0, res=-1, &out) => E_RES_DOMAIN h3ToGeo(index=0, &out) => E_CELL_INVALID h3IsResClassIII(index=RES_0_INDEX, &out) => E_SUCCESS @@ -272,7 +272,7 @@ hexRange(origin=AN_INDEX, k=-1, &out) => E_DOMAIN hexRange(origin=PENTAGON_INDEX, k=1, &out) => E_PENTAGON # Failed to allocate internal buffer: kRing(origin=AN_INDEX, k=1, &out) => E_MEMORY -pointDistRads({Infinity, Infinity}, {0, 0}, &out) => E_LATLON_DOMAIN +pointDistRads({Infinity, Infinity}, {0, 0}, &out) => E_LATLNG_DOMAIN hexAreaKm2(res=-1) => E_RES_DOMAIN # Cannot parse: stringToH3(str="zzzz", &out) => E_FAILED diff --git a/src/apps/testapps/testH3Api.c b/src/apps/testapps/testH3Api.c index 12b8c3636..a47e8a51a 100644 --- a/src/apps/testapps/testH3Api.c +++ b/src/apps/testapps/testH3Api.c @@ -44,12 +44,12 @@ SUITE(h3Api) { LatLng invalidLon = {0, NAN}; LatLng invalidLatLon = {INFINITY, -INFINITY}; - t_assert(H3_EXPORT(latLngToCell)(&invalidLat, 1, &h) == E_LATLON_DOMAIN, + t_assert(H3_EXPORT(latLngToCell)(&invalidLat, 1, &h) == E_LATLNG_DOMAIN, "invalid latitude is rejected"); - t_assert(H3_EXPORT(latLngToCell)(&invalidLon, 1, &h) == E_LATLON_DOMAIN, + t_assert(H3_EXPORT(latLngToCell)(&invalidLon, 1, &h) == E_LATLNG_DOMAIN, "invalid longitude is rejected"); t_assert( - H3_EXPORT(latLngToCell)(&invalidLatLon, 1, &h) == E_LATLON_DOMAIN, + H3_EXPORT(latLngToCell)(&invalidLatLon, 1, &h) == E_LATLNG_DOMAIN, "coordinates with infinity are rejected"); } diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index a90109a3c..e33ed4f2f 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -83,7 +83,7 @@ typedef enum { 1, // The operation failed but a more specific error is not available E_DOMAIN = 2, // Argument was outside of acceptable range (when a more // specific error code is not available) - E_LATLON_DOMAIN = + E_LATLNG_DOMAIN = 3, // Latitude or longitude arguments were outside of acceptable range E_RES_DOMAIN = 4, // Resolution argument was outside of acceptable range E_CELL_INVALID = 5, // `H3Index` cell argument was not valid diff --git a/src/h3lib/lib/h3Index.c b/src/h3lib/lib/h3Index.c index 9538ff601..6c16f832a 100644 --- a/src/h3lib/lib/h3Index.c +++ b/src/h3lib/lib/h3Index.c @@ -728,7 +728,7 @@ H3Error H3_EXPORT(latLngToCell)(const LatLng* g, int res, H3Index* out) { return E_RES_DOMAIN; } if (!isfinite(g->lat) || !isfinite(g->lon)) { - return E_LATLON_DOMAIN; + return E_LATLNG_DOMAIN; } FaceIJK fijk; diff --git a/website/docs/library/errors.md b/website/docs/library/errors.md index 51491eb02..1056f04e8 100644 --- a/website/docs/library/errors.md +++ b/website/docs/library/errors.md @@ -41,7 +41,7 @@ The type returned by most H3 functions is `H3Error`, a 32 bit integer type with | 0 | E_SUCCESS | Success (no error) | 1 | E_FAILED | The operation failed but a more specific error is not available | 2 | E_DOMAIN | Argument was outside of acceptable range (when a more specific error code is not available) -| 3 | E_LATLON_DOMAIN | Latitude or longitude arguments were outside of acceptable range +| 3 | E_LATLNG_DOMAIN | Latitude or longitude arguments were outside of acceptable range | 4 | E_RES_DOMAIN | Resolution argument was outside of acceptable range | 5 | E_CELL_INVALID | `H3Index` cell argument was not valid | 6 | E_DIR_EDGE_INVALID | `H3Index` directed edge argument was not valid @@ -63,4 +63,4 @@ When possible, it is preferrable to retain the error code. When this is not poss ## References -* [Technical RFC on error handling](https://github.com/uber/h3/blob/master/dev-docs/RFCs/v4.0.0/error-handling-rfc.md) \ No newline at end of file +* [Technical RFC on error handling](https://github.com/uber/h3/blob/master/dev-docs/RFCs/v4.0.0/error-handling-rfc.md) From 8d4d2d13eeb9f0addaa391303b8e1fd4f770dfa4 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:48:01 -0700 Subject: [PATCH 29/74] LatLon --- src/apps/applib/include/kml.h | 2 +- src/apps/applib/lib/kml.c | 16 ++++++++-------- src/apps/testapps/testH3Api.c | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/apps/applib/include/kml.h b/src/apps/applib/include/kml.h index 8f4775120..45ffc09ca 100644 --- a/src/apps/applib/include/kml.h +++ b/src/apps/applib/include/kml.h @@ -31,7 +31,7 @@ void kmlPtsFooter(void); void kmlBoundaryFooter(void); // output KML individual points or polygons -void outputLatLonKML(const LatLng* g); +void outputLatLngKML(const LatLng* g); void outputPointKML(const LatLng* g, const char* name); void outputTriKML(const LatLng* v1, const LatLng* v2, const LatLng* v3, const char* name); diff --git a/src/apps/applib/lib/kml.c b/src/apps/applib/lib/kml.c index e61e0561b..71f62bf8d 100644 --- a/src/apps/applib/lib/kml.c +++ b/src/apps/applib/lib/kml.c @@ -107,7 +107,7 @@ void kmlBoundaryFooter(void) { printf("\n"); } -void outputLatLonKML(const LatLng* g) { +void outputLatLngKML(const LatLng* g) { printf(" %8lf,%8lf,5.0\n", H3_EXPORT(radsToDegs)(g->lon), H3_EXPORT(radsToDegs)(g->lat)); } @@ -119,7 +119,7 @@ void outputPointKML(const LatLng* g, const char* name) { printf(" \n"); printf(" relativeToGround\n"); printf(" \n"); - outputLatLonKML(g); + outputLatLngKML(g); printf(" \n"); printf(" \n"); printf("\n"); @@ -133,10 +133,10 @@ void outputTriKML(const LatLng* v1, const LatLng* v2, const LatLng* v3, printf(" \n"); printf(" 1\n"); printf(" \n"); - outputLatLonKML(v1); - outputLatLonKML(v2); - outputLatLonKML(v3); - outputLatLonKML(v1); + outputLatLngKML(v1); + outputLatLngKML(v2); + outputLatLngKML(v3); + outputLatLngKML(v1); printf(" \n"); printf(" \n"); printf("\n"); @@ -155,8 +155,8 @@ void outputPolyKML(const LatLng geoVerts[], int numVerts, const char* name) { printf(" 1\n"); printf(" \n"); - for (int v = 0; v < numVerts; v++) outputLatLonKML(&geoVerts[v]); - outputLatLonKML(&geoVerts[0]); + for (int v = 0; v < numVerts; v++) outputLatLngKML(&geoVerts[v]); + outputLatLngKML(&geoVerts[0]); printf(" \n"); printf(" \n"); diff --git a/src/apps/testapps/testH3Api.c b/src/apps/testapps/testH3Api.c index a47e8a51a..f959d05eb 100644 --- a/src/apps/testapps/testH3Api.c +++ b/src/apps/testapps/testH3Api.c @@ -42,14 +42,14 @@ SUITE(h3Api) { H3Index h; LatLng invalidLat = {NAN, 0}; LatLng invalidLon = {0, NAN}; - LatLng invalidLatLon = {INFINITY, -INFINITY}; + LatLng invalidLatLng = {INFINITY, -INFINITY}; t_assert(H3_EXPORT(latLngToCell)(&invalidLat, 1, &h) == E_LATLNG_DOMAIN, "invalid latitude is rejected"); t_assert(H3_EXPORT(latLngToCell)(&invalidLon, 1, &h) == E_LATLNG_DOMAIN, "invalid longitude is rejected"); t_assert( - H3_EXPORT(latLngToCell)(&invalidLatLon, 1, &h) == E_LATLNG_DOMAIN, + H3_EXPORT(latLngToCell)(&invalidLatLng, 1, &h) == E_LATLNG_DOMAIN, "coordinates with infinity are rejected"); } From c8083828b0bd9c50dbdafcf63e111d2861d21983 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:52:31 -0700 Subject: [PATCH 30/74] invalidLon --- src/apps/testapps/testH3Api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/testapps/testH3Api.c b/src/apps/testapps/testH3Api.c index f959d05eb..691cda104 100644 --- a/src/apps/testapps/testH3Api.c +++ b/src/apps/testapps/testH3Api.c @@ -41,12 +41,12 @@ SUITE(h3Api) { TEST(latLngToCell_coord) { H3Index h; LatLng invalidLat = {NAN, 0}; - LatLng invalidLon = {0, NAN}; + LatLng invalidLng = {0, NAN}; LatLng invalidLatLng = {INFINITY, -INFINITY}; t_assert(H3_EXPORT(latLngToCell)(&invalidLat, 1, &h) == E_LATLNG_DOMAIN, "invalid latitude is rejected"); - t_assert(H3_EXPORT(latLngToCell)(&invalidLon, 1, &h) == E_LATLNG_DOMAIN, + t_assert(H3_EXPORT(latLngToCell)(&invalidLng, 1, &h) == E_LATLNG_DOMAIN, "invalid longitude is rejected"); t_assert( H3_EXPORT(latLngToCell)(&invalidLatLng, 1, &h) == E_LATLNG_DOMAIN, From 9ebc904b2950f23a3b68c98980520ab767ef72d6 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:55:15 -0700 Subject: [PATCH 31/74] a few stray `Lon `s --- src/apps/testapps/testPolygonToCells.c | 8 ++++---- src/h3lib/include/polygonAlgos.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/apps/testapps/testPolygonToCells.c b/src/apps/testapps/testPolygonToCells.c index fa5160c48..ddc5931e8 100644 --- a/src/apps/testapps/testPolygonToCells.c +++ b/src/apps/testapps/testPolygonToCells.c @@ -50,13 +50,13 @@ static bool isTransmeridianCell(H3Index h) { CellBoundary bndry; H3_EXPORT(cellToBoundary)(h, &bndry); - double minLon = M_PI, maxLon = -M_PI; + double minLng = M_PI, maxLng = -M_PI; for (int i = 0; i < bndry.numVerts; i++) { - if (bndry.verts[i].lon < minLon) minLon = bndry.verts[i].lon; - if (bndry.verts[i].lon > maxLon) maxLon = bndry.verts[i].lon; + if (bndry.verts[i].lon < minLon) minLng = bndry.verts[i].lon; + if (bndry.verts[i].lon > maxLon) maxLng = bndry.verts[i].lon; } - return maxLon - minLon > M_PI - (M_PI / 4); + return maxLng - minLng > M_PI - (M_PI / 4); } static void fillIndex_assertions(H3Index h) { diff --git a/src/h3lib/include/polygonAlgos.h b/src/h3lib/include/polygonAlgos.h index e2555c668..a2b3f6753 100644 --- a/src/h3lib/include/polygonAlgos.h +++ b/src/h3lib/include/polygonAlgos.h @@ -145,8 +145,8 @@ void GENERIC_LOOP_ALGO(bboxFrom)(const TYPE* loop, BBox* bbox) { bbox->west = DBL_MAX; bbox->north = -DBL_MAX; bbox->east = -DBL_MAX; - double minPosLon = DBL_MAX; - double maxNegLon = -DBL_MAX; + double minPosLng = DBL_MAX; + double maxNegLng = -DBL_MAX; bool isTransmeridian = false; double lat; @@ -167,8 +167,8 @@ void GENERIC_LOOP_ALGO(bboxFrom)(const TYPE* loop, BBox* bbox) { if (lon > bbox->east) bbox->east = lon; // Save the min positive and max negative longitude for // use in the transmeridian case - if (lon > 0 && lon < minPosLon) minPosLon = lon; - if (lon < 0 && lon > maxNegLon) maxNegLon = lon; + if (lon > 0 && lon < minPosLon) minPosLng = lon; + if (lon < 0 && lon > maxNegLon) maxNegLng = lon; // check for arcs > 180 degrees longitude, flagging as transmeridian if (fabs(lon - next.lon) > M_PI) { isTransmeridian = true; From 0adad77cf1c961cfda14078a74b46f92c6a14d94 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 21:57:56 -0700 Subject: [PATCH 32/74] minPosLon and maxNegLon --- src/h3lib/include/polygonAlgos.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/h3lib/include/polygonAlgos.h b/src/h3lib/include/polygonAlgos.h index a2b3f6753..2db3f756c 100644 --- a/src/h3lib/include/polygonAlgos.h +++ b/src/h3lib/include/polygonAlgos.h @@ -167,8 +167,8 @@ void GENERIC_LOOP_ALGO(bboxFrom)(const TYPE* loop, BBox* bbox) { if (lon > bbox->east) bbox->east = lon; // Save the min positive and max negative longitude for // use in the transmeridian case - if (lon > 0 && lon < minPosLon) minPosLng = lon; - if (lon < 0 && lon > maxNegLon) maxNegLng = lon; + if (lon > 0 && lon < minPosLng) minPosLng = lon; + if (lon < 0 && lon > maxNegLng) maxNegLng = lon; // check for arcs > 180 degrees longitude, flagging as transmeridian if (fabs(lon - next.lon) > M_PI) { isTransmeridian = true; @@ -176,8 +176,8 @@ void GENERIC_LOOP_ALGO(bboxFrom)(const TYPE* loop, BBox* bbox) { } // Swap east and west if transmeridian if (isTransmeridian) { - bbox->east = maxNegLon; - bbox->west = minPosLon; + bbox->east = maxNegLng; + bbox->west = minPosLng; } } From bc11d73f702faabd861abfb4aaec49d0119bb46c Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 22:03:52 -0700 Subject: [PATCH 33/74] minLon and maxLon --- src/apps/testapps/testPolygonToCells.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/testapps/testPolygonToCells.c b/src/apps/testapps/testPolygonToCells.c index ddc5931e8..aae599ea5 100644 --- a/src/apps/testapps/testPolygonToCells.c +++ b/src/apps/testapps/testPolygonToCells.c @@ -52,8 +52,8 @@ static bool isTransmeridianCell(H3Index h) { double minLng = M_PI, maxLng = -M_PI; for (int i = 0; i < bndry.numVerts; i++) { - if (bndry.verts[i].lon < minLon) minLng = bndry.verts[i].lon; - if (bndry.verts[i].lon > maxLon) maxLng = bndry.verts[i].lon; + if (bndry.verts[i].lon < minLng) minLng = bndry.verts[i].lon; + if (bndry.verts[i].lon > maxLng) maxLng = bndry.verts[i].lon; } return maxLng - minLng > M_PI - (M_PI / 4); From fe35ec8ed9d1826907f516495f490df3fb0306a3 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 22:06:55 -0700 Subject: [PATCH 34/74] `lon`s in polygonAlgos.h --- src/h3lib/include/polygonAlgos.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/h3lib/include/polygonAlgos.h b/src/h3lib/include/polygonAlgos.h index 2db3f756c..b57d16b6c 100644 --- a/src/h3lib/include/polygonAlgos.h +++ b/src/h3lib/include/polygonAlgos.h @@ -54,8 +54,8 @@ #define GENERIC_LOOP_ALGO(func) LOOP_ALGO_TJOIN(func, TYPE) /** Macro: Normalize longitude, dealing with transmeridian arcs */ -#define NORMALIZE_LON(lon, isTransmeridian) \ - (isTransmeridian && lon < 0 ? lon + (double)M_2PI : lon) +#define NORMALIZE_LON(lng, isTransmeridian) \ + (isTransmeridian && lng < 0 ? lng + (double)M_2PI : lng) /** * pointInside is the core loop of the point-in-poly algorithm @@ -150,7 +150,7 @@ void GENERIC_LOOP_ALGO(bboxFrom)(const TYPE* loop, BBox* bbox) { bool isTransmeridian = false; double lat; - double lon; + double lng; LatLng coord; LatLng next; @@ -160,17 +160,17 @@ void GENERIC_LOOP_ALGO(bboxFrom)(const TYPE* loop, BBox* bbox) { ITERATE(loop, coord, next); lat = coord.lat; - lon = coord.lon; + lng = coord.lon; if (lat < bbox->south) bbox->south = lat; - if (lon < bbox->west) bbox->west = lon; + if (lng < bbox->west) bbox->west = lng; if (lat > bbox->north) bbox->north = lat; - if (lon > bbox->east) bbox->east = lon; + if (lng > bbox->east) bbox->east = lng; // Save the min positive and max negative longitude for // use in the transmeridian case - if (lon > 0 && lon < minPosLng) minPosLng = lon; - if (lon < 0 && lon > maxNegLng) maxNegLng = lon; + if (lng > 0 && lng < minPosLng) minPosLng = lng; + if (lng < 0 && lng > maxNegLng) maxNegLng = lng; // check for arcs > 180 degrees longitude, flagging as transmeridian - if (fabs(lon - next.lon) > M_PI) { + if (fabs(lng - next.lon) > M_PI) { isTransmeridian = true; } } From 64137a14910d25bcb9586cf138aa68fc1d069bf6 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 22:11:04 -0700 Subject: [PATCH 35/74] _LON --- src/h3lib/include/polygonAlgos.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/h3lib/include/polygonAlgos.h b/src/h3lib/include/polygonAlgos.h index b57d16b6c..f437c2adf 100644 --- a/src/h3lib/include/polygonAlgos.h +++ b/src/h3lib/include/polygonAlgos.h @@ -54,7 +54,7 @@ #define GENERIC_LOOP_ALGO(func) LOOP_ALGO_TJOIN(func, TYPE) /** Macro: Normalize longitude, dealing with transmeridian arcs */ -#define NORMALIZE_LON(lng, isTransmeridian) \ +#define NORMALIZE_LNG(lng, isTransmeridian) \ (isTransmeridian && lng < 0 ? lng + (double)M_2PI : lng) /** @@ -74,7 +74,7 @@ bool GENERIC_LOOP_ALGO(pointInside)(const TYPE* loop, const BBox* bbox, bool contains = false; double lat = coord->lat; - double lng = NORMALIZE_LON(coord->lon, isTransmeridian); + double lng = NORMALIZE_LNG(coord->lon, isTransmeridian); LatLng a; LatLng b; @@ -98,8 +98,8 @@ bool GENERIC_LOOP_ALGO(pointInside)(const TYPE* loop, const BBox* bbox, continue; } - double aLng = NORMALIZE_LON(a.lon, isTransmeridian); - double bLng = NORMALIZE_LON(b.lon, isTransmeridian); + double aLng = NORMALIZE_LNG(a.lon, isTransmeridian); + double bLng = NORMALIZE_LNG(b.lon, isTransmeridian); // Rays are cast in the longitudinal direction, in case a point // exactly matches, to decide tiebreakers, bias westerly @@ -114,7 +114,7 @@ bool GENERIC_LOOP_ALGO(pointInside)(const TYPE* loop, const BBox* bbox, // of a to b double ratio = (lat - a.lat) / (b.lat - a.lat); double testLng = - NORMALIZE_LON(aLng + (bLng - aLng) * ratio, isTransmeridian); + NORMALIZE_LNG(aLng + (bLng - aLng) * ratio, isTransmeridian); // Intersection of the ray if (testLng > lng) { @@ -202,8 +202,8 @@ static bool GENERIC_LOOP_ALGO(isClockwiseNormalized)(const TYPE* loop, if (!isTransmeridian && fabs(a.lon - b.lon) > M_PI) { return GENERIC_LOOP_ALGO(isClockwiseNormalized)(loop, true); } - sum += ((NORMALIZE_LON(b.lon, isTransmeridian) - - NORMALIZE_LON(a.lon, isTransmeridian)) * + sum += ((NORMALIZE_LNG(b.lon, isTransmeridian) - + NORMALIZE_LNG(a.lon, isTransmeridian)) * (b.lat + a.lat)); } From 67698d05c986321794e9a3ceb5339b4ba87d8217 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 22:19:14 -0700 Subject: [PATCH 36/74] stray `lon`s in latLngToCell.c --- src/apps/filters/latLngToCell.c | 30 +++++++++++++++--------------- src/apps/testapps/testLatLng.c | 2 +- src/h3lib/lib/vertexGraph.c | 2 +- website/docs/installation.mdx | 6 +++--- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/apps/filters/latLngToCell.c b/src/apps/filters/latLngToCell.c index 5e2727b41..039d6f76a 100644 --- a/src/apps/filters/latLngToCell.c +++ b/src/apps/filters/latLngToCell.c @@ -26,10 +26,10 @@ * The stdin input should have the following format (lat/lng in decimal * degrees): * - * lat0 lon0 - * lat1 lon1 + * lat0 lng0 + * lat1 lng1 * ... - * latN lonN + * latN lngN */ #include "args.h" @@ -40,12 +40,12 @@ * Convert coordinates to cell and print it. * * @param lat Degrees latitude - * @param lon Degrees longitude + * @param lng Degrees longitude * @param res Resolution */ -void doCoords(double lat, double lon, int res) { +void doCoords(double lat, double lng, int res) { LatLng g = {.lat = H3_EXPORT(degsToRads)(lat), - .lon = H3_EXPORT(degsToRads)(lon)}; + .lon = H3_EXPORT(degsToRads)(lng)}; H3Index h; H3Error e = H3_EXPORT(latLngToCell)(&g, res, &h); @@ -60,7 +60,7 @@ void doCoords(double lat, double lon, int res) { int main(int argc, char* argv[]) { int res = 0; double lat = 0; - double lon = 0; + double lng = 0; Arg helpArg = ARG_HELP; Arg resArg = {.names = {"-r", "--resolution"}, @@ -76,13 +76,13 @@ int main(int argc, char* argv[]) { .helpText = "Latitude in degrees. If not specified, \"latitude " "longitude\" pairs will be read from standard input."}; - Arg lonArg = {.names = {"--lon", "--longitude"}, + Arg lngArg = {.names = {"--lng", "--longitude"}, .scanFormat = "%lf", - .valueName = "lon", - .value = &lon, + .valueName = "lng", + .value = &lng, .helpText = "Longitude in degrees."}; - Arg* args[] = {&helpArg, &resArg, &latArg, &lonArg}; + Arg* args[] = {&helpArg, &resArg, &latArg, &lngArg}; const int numArgs = 4; const char* helpText = "Convert degrees latitude/longitude coordinates to H3 indexes."; @@ -91,7 +91,7 @@ int main(int argc, char* argv[]) { return helpArg.found ? 0 : 1; } - if (latArg.found != lonArg.found) { + if (latArg.found != lngArg.found) { // One is found but the other is not. printHelp(stderr, argv[0], helpText, numArgs, args, "Latitude and longitude must both be specified.", NULL); @@ -99,7 +99,7 @@ int main(int argc, char* argv[]) { } if (latArg.found) { - doCoords(lat, lon, res); + doCoords(lat, lng, res); } else { // process the lat/lng's on stdin char buff[BUFF_SIZE]; @@ -112,11 +112,11 @@ int main(int argc, char* argv[]) { error("reading lat/lng"); } - if (sscanf(buff, "%lf %lf", &lat, &lon) != 2) + if (sscanf(buff, "%lf %lf", &lat, &lng) != 2) error("parsing lat/lng"); // convert to H3 - doCoords(lat, lon, res); + doCoords(lat, lng, res); } } } diff --git a/src/apps/testapps/testLatLng.c b/src/apps/testapps/testLatLng.c index 2faf8f893..e51c6c808 100644 --- a/src/apps/testapps/testLatLng.c +++ b/src/apps/testapps/testLatLng.c @@ -87,7 +87,7 @@ SUITE(latLng) { b.lat = 15; b.lon = 10.00001; t_assert(!geoAlmostEqualThreshold(&a, &b, 0.000001), - "lon over threshold"); + "lng over threshold"); } TEST(constrainLatLng) { diff --git a/src/h3lib/lib/vertexGraph.c b/src/h3lib/lib/vertexGraph.c index c1f8180a0..cd4b7eddd 100644 --- a/src/h3lib/lib/vertexGraph.c +++ b/src/h3lib/lib/vertexGraph.c @@ -71,7 +71,7 @@ void destroyVertexGraph(VertexGraph* graph) { * @return Integer hash */ uint32_t _hashVertex(const LatLng* vertex, int res, int numBuckets) { - // Simple hash: Take the sum of the lat and lon with a precision level + // Simple hash: Take the sum of the lat and lng with a precision level // determined by the resolution, converted to int, modulo bucket count. return (uint32_t)fmod(fabs((vertex->lat + vertex->lon) * pow(10, 15 - res)), numBuckets); diff --git a/website/docs/installation.mdx b/website/docs/installation.mdx index 24a4e857d..6a96a3566 100644 --- a/website/docs/installation.mdx +++ b/website/docs/installation.mdx @@ -134,7 +134,7 @@ apk add cmake make gcc libtool musl-dev -```bash +```bash # Installing the bare build requirements sudo apt install cmake make gcc libtool # Installing useful tools for development @@ -146,7 +146,7 @@ sudo apt install clang-format cmake-curses-gui lcov doxygen You will need to install CMake and Visual Studio, including the Visual C++ compiler. -```bash +```bash # Installing the bare build requirements sudo apt install cmake make gcc libtool # Installing useful tools for development @@ -182,5 +182,5 @@ ctest By default, the filter applications are built when you build H3. You can confirm they are working by running: ``` -./bin/geoToH3 --lat 14 --lon -42 --resolution 2 +./bin/geoToH3 --lat 14 --lng -42 --resolution 2 ``` From f26744c44ac9c1b93f27def286235b549b08d2e9 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 22:28:12 -0700 Subject: [PATCH 37/74] posLatPosLon and negLatPosLon --- src/apps/testapps/testBBox.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/apps/testapps/testBBox.c b/src/apps/testapps/testBBox.c index e756b02db..a0a0e9c84 100644 --- a/src/apps/testapps/testBBox.c +++ b/src/apps/testapps/testBBox.c @@ -36,7 +36,7 @@ void assertBBox(const GeoLoop* geoloop, const BBox* expected, } SUITE(BBox) { - TEST(posLatPosLon) { + TEST(posLatPosLng) { LatLng verts[] = {{0.8, 0.3}, {0.7, 0.6}, {1.1, 0.7}, {1.0, 0.2}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {1.1, 0.7, 0.7, 0.2}; @@ -45,7 +45,7 @@ SUITE(BBox) { assertBBox(&geoloop, &expected, &inside, &outside); } - TEST(negLatPosLon) { + TEST(negLatPosLng) { LatLng verts[] = {{-0.3, 0.6}, {-0.4, 0.9}, {-0.2, 0.8}, {-0.1, 0.6}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {-0.1, -0.4, 0.9, 0.6}; @@ -54,7 +54,7 @@ SUITE(BBox) { assertBBox(&geoloop, &expected, &inside, &outside); } - TEST(posLatNegLon) { + TEST(posLatNegLng) { LatLng verts[] = {{0.7, -1.4}, {0.8, -0.9}, {1.0, -0.8}, {1.1, -1.3}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; const BBox expected = {1.1, 0.7, -0.8, -1.4}; @@ -63,7 +63,7 @@ SUITE(BBox) { assertBBox(&geoloop, &expected, &inside, &outside); } - TEST(negLatNegLon) { + TEST(negLatNegLng) { LatLng verts[] = { {-0.4, -1.4}, {-0.3, -1.1}, {-0.1, -1.2}, {-0.2, -1.4}}; const GeoLoop geoloop = {.numVerts = 4, .verts = verts}; From 664c00b38dd14c78f869e3ead2f3f7cbef9cfe6b Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 22:37:02 -0700 Subject: [PATCH 38/74] `lon=` and `lon;` --- dev-docs/RFCs/v4.0.0/error-handling-rfc.md | 2 +- src/apps/fuzzers/fuzzerLatLngToCell.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev-docs/RFCs/v4.0.0/error-handling-rfc.md b/dev-docs/RFCs/v4.0.0/error-handling-rfc.md index 39aaf10cc..b32749ffe 100644 --- a/dev-docs/RFCs/v4.0.0/error-handling-rfc.md +++ b/dev-docs/RFCs/v4.0.0/error-handling-rfc.md @@ -260,7 +260,7 @@ The H3 library may always add additional error messages. Error messages not reco #### Example error code results ``` -geoToH3(lat=Infinity, lon=0, res=0, &out) => E_LATLNG_DOMAIN +geoToH3(lat=Infinity, lng=0, res=0, &out) => E_LATLNG_DOMAIN geoToH3(lat=0, lat=0, res=-1, &out) => E_RES_DOMAIN h3ToGeo(index=0, &out) => E_CELL_INVALID h3IsResClassIII(index=RES_0_INDEX, &out) => E_SUCCESS diff --git a/src/apps/fuzzers/fuzzerLatLngToCell.c b/src/apps/fuzzers/fuzzerLatLngToCell.c index 34b6f24ad..9d5a844f9 100644 --- a/src/apps/fuzzers/fuzzerLatLngToCell.c +++ b/src/apps/fuzzers/fuzzerLatLngToCell.c @@ -28,7 +28,7 @@ int main(int argc, char* argv[]) { FILE* fp = fopen(filename, "rb"); struct args { double lat; - double lon; + double lng; int res; } args; if (fread(&args, sizeof(args), 1, fp) != 1) { @@ -36,7 +36,7 @@ int main(int argc, char* argv[]) { } fclose(fp); - LatLng g = {.lat = args.lat, .lon = args.lon}; + LatLng g = {.lat = args.lat, .lon = args.lng}; H3Index h; H3Error e = H3_EXPORT(latLngToCell)(&g, args.res, &h); From b1db0c7fa77fb4abf5a53e22e35edf3ebfcf8c42 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 22:41:34 -0700 Subject: [PATCH 39/74] some text locations --- src/apps/testapps/testCellToLatLng.c | 2 +- src/apps/testapps/testLatLngToCell.c | 2 +- website/docs/library/errors.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apps/testapps/testCellToLatLng.c b/src/apps/testapps/testCellToLatLng.c index 3d56fefcd..bdff8efb2 100644 --- a/src/apps/testapps/testCellToLatLng.c +++ b/src/apps/testapps/testCellToLatLng.c @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) { double latDegs, lngDegs; if (sscanf(buff, "%s %lf %lf", h3Str, &latDegs, &lngDegs) != 3) - error("parsing input (should be \"H3Index lat lon\")"); + error("parsing input (should be \"H3Index lat lng\")"); H3Index h3; h3 = H3_EXPORT(stringToH3)(h3Str); diff --git a/src/apps/testapps/testLatLngToCell.c b/src/apps/testapps/testLatLngToCell.c index fcb1087ff..22786e59a 100644 --- a/src/apps/testapps/testLatLngToCell.c +++ b/src/apps/testapps/testLatLngToCell.c @@ -61,7 +61,7 @@ int main(int argc, char* argv[]) { double latDegs, lngDegs; if (sscanf(buff, "%s %lf %lf", h3Str, &latDegs, &lngDegs) != 3) - error("parsing input (should be \"H3Index lat lon\")"); + error("parsing input (should be \"H3Index lat lng\")"); H3Index h3; h3 = H3_EXPORT(stringToH3)(h3Str); diff --git a/website/docs/library/errors.md b/website/docs/library/errors.md index 1056f04e8..07e19fb06 100644 --- a/website/docs/library/errors.md +++ b/website/docs/library/errors.md @@ -17,7 +17,7 @@ This code example checks for an error when calling an H3 function and prints a m H3Error err; H3Index result; -err = geoToH3(lat, lon, res, &result); +err = geoToH3(lat, lng, res, &result); if (err) { fprintf(stderr, "Error: %d", err); } From 5c35fe64205a6c2a22b6ae51b83fc2b78f55a952 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 22:43:21 -0700 Subject: [PATCH 40/74] in error-handling-rfc --- dev-docs/RFCs/v4.0.0/error-handling-rfc.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/dev-docs/RFCs/v4.0.0/error-handling-rfc.md b/dev-docs/RFCs/v4.0.0/error-handling-rfc.md index b32749ffe..0aa4bfbd0 100644 --- a/dev-docs/RFCs/v4.0.0/error-handling-rfc.md +++ b/dev-docs/RFCs/v4.0.0/error-handling-rfc.md @@ -43,7 +43,7 @@ Sample: H3Error err; H3Index result; -err = geoToH3(lat, lon, res, &result); +err = geoToH3(lat, lng, res, &result); if (err) { fprintf(stderr, "Error: %d", err); } @@ -53,7 +53,7 @@ Sample with errors discarded: ``` H3Index result; -geoToH3(lat, lon, res, &result); +geoToH3(lat, lng, res, &result); ``` Placing error information in the return of function calls requires that functions return two pieces of information - the error status, and the requested data. This approach does make it clear that a status code is returned and that may make it more usual that a consumer of the API does check the error status. @@ -65,7 +65,7 @@ Sample: H3Error err; H3Index result; -err = geoToH3(lat, lon, res, &result); +err = geoToH3(lat, lng, res, &result); if (err) { fprintf(stderr, "Error: %d", err); } @@ -75,7 +75,7 @@ Sample with errors discarded: ``` H3Index result; -result = unsafe_geoToH3(lat, lon, res); +result = unsafe_geoToH3(lat, lng, res); ``` This approach is the same as using return codes, but offers an "unsafe" version of some functions where there is less or no error information returned. This is intended to be used in performance critical cases where the inputs are known to be suitable ahead of time, or the caller would not do anything with the error information anyways. @@ -87,7 +87,7 @@ Sample: H3Error err; H3Index result; -err = geoToH3(lat, lon, res, &result); +err = geoToH3(lat, lng, res, &result); if (err) { const char* msg = h3GetError(); fprintf(stderr, "Error: %d (%s)", err, msg); @@ -105,7 +105,7 @@ Sample: H3Error err; H3Index result; -result = geoToH3(lat, lon, res); +result = geoToH3(lat, lng, res); if (err = h3GetError()) { fprintf(stderr, "Error: %d", err); } @@ -115,7 +115,7 @@ Sample with errors discarded: ``` H3Index result; -result = geoToH3(lat, lon, res); +result = geoToH3(lat, lng, res); ``` In this approach, the data requested is returned from the function, and the consumer is responsible for knowing when to check for errors, and how to handle them. There are a few drawbacks: @@ -131,7 +131,7 @@ Sample: H3Error err; H3Index result; -result = geoToH3(lat, lon, res, &err); +result = geoToH3(lat, lng, res, &err); if (err) { fprintf(stderr, "Error: %d", err); } @@ -140,7 +140,7 @@ if (err) { Sample with errors discarded: ``` H3Index result; -result = geoToH3(lat, lon, res, NULL); +result = geoToH3(lat, lng, res, NULL); ``` This is an inversion of the return code approach, where the error status is the reference parameter. This offers an advantage that a caller could choose to disregard the error status (for example by passing NULL) @@ -156,7 +156,7 @@ int err; if (err = setjmp(env)) { fprintf(stderr, "Error: %d", err); } else { - result = geoToH3(lat, lon, res, env); + result = geoToH3(lat, lng, res, env); } ``` @@ -178,7 +178,7 @@ error (for example, due to domain issues in its input) will return an error code The signature for `geoToH3` will look like: ``` -H3Error geoToH3(double lat, double lon, int res, H3Index *result); +H3Error geoToH3(double lat, double lng, int res, H3Index *result); ``` ### Is Valid Functions From 9e1db0b7105abb323f83ba7e804c2a347373bcf8 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 22:49:22 -0700 Subject: [PATCH 41/74] .lon --- examples/distance.c | 6 +++--- examples/edge.c | 2 +- examples/index.c | 6 +++--- src/apps/filters/cellToLatLng.c | 2 +- src/apps/filters/latLngToCell.c | 2 +- src/apps/fuzzers/fuzzerCellToLatLng.c | 2 +- src/apps/fuzzers/fuzzerLatLngToCell.c | 2 +- src/apps/testapps/testLatLng.c | 10 +++++----- src/apps/testapps/testPolygonToCells.c | 12 ++++++------ src/h3lib/include/polygonAlgos.h | 14 +++++++------- src/h3lib/lib/algos.c | 6 +++--- src/h3lib/lib/bbox.c | 6 +++--- 12 files changed, 35 insertions(+), 35 deletions(-) diff --git a/examples/distance.c b/examples/distance.c index 0ac04310e..a9d4b4176 100644 --- a/examples/distance.c +++ b/examples/distance.c @@ -61,9 +61,9 @@ int main(int argc, char *argv[]) { "destination: (%lf, %lf)\n" "grid distance: %d\n" "distance in km: %lfkm\n", - radsToDegs(geoHQ1.lat), radsToDegs(geoHQ1.lon), radsToDegs(geoHQ2.lat), - radsToDegs(geoHQ2.lon), gridDistance(h3HQ1, h3HQ2), - haversineDistance(geoHQ1.lat, geoHQ1.lon, geoHQ2.lat, geoHQ2.lon)); + radsToDegs(geoHQ1.lat), radsToDegs(geoHQ1.lng), radsToDegs(geoHQ2.lat), + radsToDegs(geoHQ2.lng), gridDistance(h3HQ1, h3HQ2), + haversineDistance(geoHQ1.lat, geoHQ1.lng, geoHQ2.lat, geoHQ2.lng)); // Output: // origin: (37.775236, -122.419755) // destination: (37.789991, -122.402121) diff --git a/examples/edge.c b/examples/edge.c index 45703a6a9..9fc2493af 100644 --- a/examples/edge.c +++ b/examples/edge.c @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) { for (int v = 0; v < boundary.numVerts; v++) { printf("Edge vertex #%d: %lf, %lf\n", v, radsToDegs(boundary.verts[v].lat), - radsToDegs(boundary.verts[v].lon)); + radsToDegs(boundary.verts[v].lng)); } // Output: // The edge is 16a2a1072b59ffff diff --git a/examples/index.c b/examples/index.c index 94e4f6ec5..50da49a77 100644 --- a/examples/index.c +++ b/examples/index.c @@ -26,7 +26,7 @@ int main(int argc, char *argv[]) { // Get the H3 index of some location and print it. LatLng location; location.lat = degsToRads(40.689167); - location.lon = degsToRads(-74.044444); + location.lng = degsToRads(-74.044444); int resolution = 10; H3Index indexed; if (latLngToCell(&location, resolution, &indexed) != E_SUCCESS) { @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) { for (int v = 0; v < boundary.numVerts; v++) { printf("Boundary vertex #%d: %lf, %lf\n", v, radsToDegs(boundary.verts[v].lat), - radsToDegs(boundary.verts[v].lon)); + radsToDegs(boundary.verts[v].lng)); } // Get the center coordinates. @@ -56,5 +56,5 @@ int main(int argc, char *argv[]) { return 1; } printf("Center coordinates: %lf, %lf\n", radsToDegs(center.lat), - radsToDegs(center.lon)); + radsToDegs(center.lng)); } diff --git a/src/apps/filters/cellToLatLng.c b/src/apps/filters/cellToLatLng.c index 32490de1e..0c4f0694f 100644 --- a/src/apps/filters/cellToLatLng.c +++ b/src/apps/filters/cellToLatLng.c @@ -59,7 +59,7 @@ void doCell(H3Index h, int isKmlOut) { outputPointKML(&g, label); } else { printf("%.10lf %.10lf\n", H3_EXPORT(radsToDegs)(g.lat), - H3_EXPORT(radsToDegs)(g.lon)); + H3_EXPORT(radsToDegs)(g.lng)); } } diff --git a/src/apps/filters/latLngToCell.c b/src/apps/filters/latLngToCell.c index 039d6f76a..487d0d93e 100644 --- a/src/apps/filters/latLngToCell.c +++ b/src/apps/filters/latLngToCell.c @@ -45,7 +45,7 @@ */ void doCoords(double lat, double lng, int res) { LatLng g = {.lat = H3_EXPORT(degsToRads)(lat), - .lon = H3_EXPORT(degsToRads)(lng)}; + .lng = H3_EXPORT(degsToRads)(lng)}; H3Index h; H3Error e = H3_EXPORT(latLngToCell)(&g, res, &h); diff --git a/src/apps/fuzzers/fuzzerCellToLatLng.c b/src/apps/fuzzers/fuzzerCellToLatLng.c index 6eb6849f8..0834fc0cb 100644 --- a/src/apps/fuzzers/fuzzerCellToLatLng.c +++ b/src/apps/fuzzers/fuzzerCellToLatLng.c @@ -34,7 +34,7 @@ int main(int argc, char* argv[]) { LatLng geo; H3_EXPORT(cellToLatLng)(index, &geo); - printf("%lf %lf\n", geo.lat, geo.lon); + printf("%lf %lf\n", geo.lat, geo.lng); CellBoundary cellBoundary; H3_EXPORT(cellToBoundary)(index, &cellBoundary); printf("%d\n", cellBoundary.numVerts); diff --git a/src/apps/fuzzers/fuzzerLatLngToCell.c b/src/apps/fuzzers/fuzzerLatLngToCell.c index 9d5a844f9..ebf29fb4b 100644 --- a/src/apps/fuzzers/fuzzerLatLngToCell.c +++ b/src/apps/fuzzers/fuzzerLatLngToCell.c @@ -36,7 +36,7 @@ int main(int argc, char* argv[]) { } fclose(fp); - LatLng g = {.lat = args.lat, .lon = args.lng}; + LatLng g = {.lat = args.lat, .lng = args.lng}; H3Index h; H3Error e = H3_EXPORT(latLngToCell)(&g, args.res, &h); diff --git a/src/apps/testapps/testLatLng.c b/src/apps/testapps/testLatLng.c index e51c6c808..5d5659498 100644 --- a/src/apps/testapps/testLatLng.c +++ b/src/apps/testapps/testLatLng.c @@ -75,17 +75,17 @@ SUITE(latLng) { t_assert(geoAlmostEqualThreshold(&a, &b, DBL_EPSILON), "same point"); b.lat = 15.00001; - b.lon = 10.00002; + b.lng = 10.00002; t_assert(geoAlmostEqualThreshold(&a, &b, 0.0001), "differences under threshold"); b.lat = 15.00001; - b.lon = 10; + b.lng = 10; t_assert(!geoAlmostEqualThreshold(&a, &b, 0.000001), "lat over threshold"); b.lat = 15; - b.lon = 10.00001; + b.lng = 10.00001; t_assert(!geoAlmostEqualThreshold(&a, &b, 0.000001), "lng over threshold"); } @@ -196,8 +196,8 @@ SUITE(latLng) { } TEST(pointDistRads_wrappedLongitude) { - const LatLng negativeLongitude = {.lat = 0, .lon = -(M_PI + M_PI_2)}; - const LatLng zero = {.lat = 0, .lon = 0}; + const LatLng negativeLongitude = {.lat = 0, .lng = -(M_PI + M_PI_2)}; + const LatLng zero = {.lat = 0, .lng = 0}; t_assert(fabs(M_PI_2 - H3_EXPORT(pointDistRads)(&negativeLongitude, &zero)) < EPSILON_RAD, diff --git a/src/apps/testapps/testPolygonToCells.c b/src/apps/testapps/testPolygonToCells.c index aae599ea5..bfff3940d 100644 --- a/src/apps/testapps/testPolygonToCells.c +++ b/src/apps/testapps/testPolygonToCells.c @@ -52,8 +52,8 @@ static bool isTransmeridianCell(H3Index h) { double minLng = M_PI, maxLng = -M_PI; for (int i = 0; i < bndry.numVerts; i++) { - if (bndry.verts[i].lon < minLng) minLng = bndry.verts[i].lon; - if (bndry.verts[i].lon > maxLng) maxLng = bndry.verts[i].lon; + if (bndry.verts[i].lng < minLng) minLng = bndry.verts[i].lng; + if (bndry.verts[i].lng > maxLng) maxLng = bndry.verts[i].lng; } return maxLng - minLng > M_PI - (M_PI / 4); @@ -322,19 +322,19 @@ SUITE(polygonToCells) { LatLng boundingTopRigt = coord; boundingTopRigt.lat += edgeLength2; - boundingTopRigt.lon += edgeLength2; + boundingTopRigt.lng += edgeLength2; LatLng boundingTopLeft = coord; boundingTopLeft.lat += edgeLength2; - boundingTopLeft.lon -= edgeLength2; + boundingTopLeft.lng -= edgeLength2; LatLng boundingBottomRight = coord; boundingBottomRight.lat -= edgeLength2; - boundingBottomRight.lon += edgeLength2; + boundingBottomRight.lng += edgeLength2; LatLng boundingBottomLeft = coord; boundingBottomLeft.lat -= edgeLength2; - boundingBottomLeft.lon -= edgeLength2; + boundingBottomLeft.lng -= edgeLength2; LatLng verts[] = {boundingBottomLeft, boundingTopLeft, boundingTopRigt, boundingBottomRight}; diff --git a/src/h3lib/include/polygonAlgos.h b/src/h3lib/include/polygonAlgos.h index f437c2adf..1c375e4c5 100644 --- a/src/h3lib/include/polygonAlgos.h +++ b/src/h3lib/include/polygonAlgos.h @@ -98,8 +98,8 @@ bool GENERIC_LOOP_ALGO(pointInside)(const TYPE* loop, const BBox* bbox, continue; } - double aLng = NORMALIZE_LNG(a.lon, isTransmeridian); - double bLng = NORMALIZE_LNG(b.lon, isTransmeridian); + double aLng = NORMALIZE_LNG(a.lng, isTransmeridian); + double bLng = NORMALIZE_LNG(b.lng, isTransmeridian); // Rays are cast in the longitudinal direction, in case a point // exactly matches, to decide tiebreakers, bias westerly @@ -160,7 +160,7 @@ void GENERIC_LOOP_ALGO(bboxFrom)(const TYPE* loop, BBox* bbox) { ITERATE(loop, coord, next); lat = coord.lat; - lng = coord.lon; + lng = coord.lng; if (lat < bbox->south) bbox->south = lat; if (lng < bbox->west) bbox->west = lng; if (lat > bbox->north) bbox->north = lat; @@ -170,7 +170,7 @@ void GENERIC_LOOP_ALGO(bboxFrom)(const TYPE* loop, BBox* bbox) { if (lng > 0 && lng < minPosLng) minPosLng = lng; if (lng < 0 && lng > maxNegLng) maxNegLng = lng; // check for arcs > 180 degrees longitude, flagging as transmeridian - if (fabs(lng - next.lon) > M_PI) { + if (fabs(lng - next.lng) > M_PI) { isTransmeridian = true; } } @@ -199,11 +199,11 @@ static bool GENERIC_LOOP_ALGO(isClockwiseNormalized)(const TYPE* loop, ITERATE(loop, a, b); // If we identify a transmeridian arc (> 180 degrees longitude), // start over with the transmeridian flag set - if (!isTransmeridian && fabs(a.lon - b.lon) > M_PI) { + if (!isTransmeridian && fabs(a.lng - b.lng) > M_PI) { return GENERIC_LOOP_ALGO(isClockwiseNormalized)(loop, true); } - sum += ((NORMALIZE_LNG(b.lon, isTransmeridian) - - NORMALIZE_LNG(a.lon, isTransmeridian)) * + sum += ((NORMALIZE_LNG(b.lng, isTransmeridian) - + NORMALIZE_LNG(a.lng, isTransmeridian)) * (b.lat + a.lat)); } diff --git a/src/h3lib/lib/algos.c b/src/h3lib/lib/algos.c index dac4ba0a5..fdf478aa5 100644 --- a/src/h3lib/lib/algos.c +++ b/src/h3lib/lib/algos.c @@ -785,9 +785,9 @@ int _getEdgeHexagons(const GeoLoop* geoloop, int numHexagons, int res, interpolate.lat = (origin.lat * (numHexesEstimate - j) / numHexesEstimate) + (destination.lat * j / numHexesEstimate); - interpolate.lon = - (origin.lon * (numHexesEstimate - j) / numHexesEstimate) + - (destination.lon * j / numHexesEstimate); + interpolate.lng = + (origin.lng * (numHexesEstimate - j) / numHexesEstimate) + + (destination.lng * j / numHexesEstimate); H3Index pointHex; H3Error e = H3_EXPORT(latLngToCell)(&interpolate, res, &pointHex); if (e) { diff --git a/src/h3lib/lib/bbox.c b/src/h3lib/lib/bbox.c index 7d87d4034..ca39f7d50 100644 --- a/src/h3lib/lib/bbox.c +++ b/src/h3lib/lib/bbox.c @@ -113,13 +113,13 @@ int bboxHexEstimate(const BBox* bbox, int res) { // Then get the area of the bounding box of the geoloop in question LatLng p1, p2; p1.lat = bbox->north; - p1.lon = bbox->east; + p1.lng = bbox->east; p2.lat = bbox->south; - p2.lon = bbox->west; + p2.lng = bbox->west; double d = H3_EXPORT(pointDistKm)(&p1, &p2); // Derived constant based on: https://math.stackexchange.com/a/1921940 // Clamped to 3 as higher values tend to rapidly drag the estimate to zero. - double a = d * d / fmin(3.0, fabs((p1.lon - p2.lon) / (p1.lat - p2.lat))); + double a = d * d / fmin(3.0, fabs((p1.lng - p2.lng) / (p1.lat - p2.lat))); // Divide the two to get an estimate of the number of hexagons needed int estimate = (int)ceil(a / pentagonAreaKm2); From 4e54a081e9de9e2ecb5abf5d4ee9889a22538c90 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 22:50:10 -0700 Subject: [PATCH 42/74] ->lon --- src/apps/applib/lib/kml.c | 2 +- src/apps/applib/lib/utility.c | 8 ++++---- src/h3lib/include/polygonAlgos.h | 2 +- src/h3lib/lib/bbox.c | 6 +++--- src/h3lib/lib/h3Index.c | 2 +- src/h3lib/lib/latLng.c | 22 +++++++++++----------- src/h3lib/lib/vec3d.c | 4 ++-- src/h3lib/lib/vertexGraph.c | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/apps/applib/lib/kml.c b/src/apps/applib/lib/kml.c index 71f62bf8d..51ac370f6 100644 --- a/src/apps/applib/lib/kml.c +++ b/src/apps/applib/lib/kml.c @@ -108,7 +108,7 @@ void kmlBoundaryFooter(void) { } void outputLatLngKML(const LatLng* g) { - printf(" %8lf,%8lf,5.0\n", H3_EXPORT(radsToDegs)(g->lon), + printf(" %8lf,%8lf,5.0\n", H3_EXPORT(radsToDegs)(g->lng), H3_EXPORT(radsToDegs)(g->lat)); } diff --git a/src/apps/applib/lib/utility.c b/src/apps/applib/lib/utility.c index d2bfaa17f..8b4698950 100644 --- a/src/apps/applib/lib/utility.c +++ b/src/apps/applib/lib/utility.c @@ -57,7 +57,7 @@ void coordIjkPrint(const CoordIJK* c) { * Assumes `str` is big enough to hold the result. */ void geoToStringRads(const LatLng* p, char* str) { - sprintf(str, "(%.4lf, %.4lf)", p->lat, p->lon); + sprintf(str, "(%.4lf, %.4lf)", p->lat, p->lng); } /** @@ -65,7 +65,7 @@ void geoToStringRads(const LatLng* p, char* str) { */ void geoToStringDegs(const LatLng* p, char* str) { sprintf(str, "(%.9lf, %.9lf)", H3_EXPORT(radsToDegs)(p->lat), - H3_EXPORT(radsToDegs)(p->lon)); + H3_EXPORT(radsToDegs)(p->lng)); } /** @@ -73,7 +73,7 @@ void geoToStringDegs(const LatLng* p, char* str) { */ void geoToStringDegsNoFmt(const LatLng* p, char* str) { sprintf(str, "%.9lf %.9lf", H3_EXPORT(radsToDegs)(p->lat), - H3_EXPORT(radsToDegs)(p->lon)); + H3_EXPORT(radsToDegs)(p->lng)); } void geoPrint(const LatLng* p) { @@ -180,7 +180,7 @@ void randomGeo(LatLng* g) { g->lat = H3_EXPORT(degsToRads)( (((float)rand() / (float)(RAND_MAX)) * 180.0) - 90.0); - g->lon = H3_EXPORT(degsToRads)((float)rand() / (float)(RAND_MAX)) * 360.0; + g->lng = H3_EXPORT(degsToRads)((float)rand() / (float)(RAND_MAX)) * 360.0; } /** diff --git a/src/h3lib/include/polygonAlgos.h b/src/h3lib/include/polygonAlgos.h index 1c375e4c5..83e700b64 100644 --- a/src/h3lib/include/polygonAlgos.h +++ b/src/h3lib/include/polygonAlgos.h @@ -74,7 +74,7 @@ bool GENERIC_LOOP_ALGO(pointInside)(const TYPE* loop, const BBox* bbox, bool contains = false; double lat = coord->lat; - double lng = NORMALIZE_LNG(coord->lon, isTransmeridian); + double lng = NORMALIZE_LNG(coord->lng, isTransmeridian); LatLng a; LatLng b; diff --git a/src/h3lib/lib/bbox.c b/src/h3lib/lib/bbox.c index ca39f7d50..fcb5840ba 100644 --- a/src/h3lib/lib/bbox.c +++ b/src/h3lib/lib/bbox.c @@ -43,7 +43,7 @@ void bboxCenter(const BBox* bbox, LatLng* center) { center->lat = (bbox->north + bbox->south) / 2.0; // If the bbox crosses the antimeridian, shift east 360 degrees double east = bboxIsTransmeridian(bbox) ? bbox->east + M_2PI : bbox->east; - center->lon = constrainLng((east + bbox->west) / 2.0); + center->lng = constrainLng((east + bbox->west) / 2.0); } /** @@ -56,10 +56,10 @@ bool bboxContains(const BBox* bbox, const LatLng* point) { return point->lat >= bbox->south && point->lat <= bbox->north && (bboxIsTransmeridian(bbox) ? // transmeridian case - (point->lon >= bbox->west || point->lon <= bbox->east) + (point->lng >= bbox->west || point->lng <= bbox->east) : // standard case - (point->lon >= bbox->west && point->lon <= bbox->east)); + (point->lng >= bbox->west && point->lng <= bbox->east)); } /** diff --git a/src/h3lib/lib/h3Index.c b/src/h3lib/lib/h3Index.c index 6c16f832a..a5a25e6e5 100644 --- a/src/h3lib/lib/h3Index.c +++ b/src/h3lib/lib/h3Index.c @@ -727,7 +727,7 @@ H3Error H3_EXPORT(latLngToCell)(const LatLng* g, int res, H3Index* out) { if (res < 0 || res > MAX_H3_RES) { return E_RES_DOMAIN; } - if (!isfinite(g->lat) || !isfinite(g->lon)) { + if (!isfinite(g->lat) || !isfinite(g->lng)) { return E_LATLNG_DOMAIN; } diff --git a/src/h3lib/lib/latLng.c b/src/h3lib/lib/latLng.c index 6af2cd1cc..7d9e5c4cc 100644 --- a/src/h3lib/lib/latLng.c +++ b/src/h3lib/lib/latLng.c @@ -51,7 +51,7 @@ double _posAngleRads(double rads) { bool geoAlmostEqualThreshold(const LatLng *p1, const LatLng *p2, double threshold) { return fabs(p1->lat - p2->lat) < threshold && - fabs(p1->lon - p2->lon) < threshold; + fabs(p1->lng - p2->lng) < threshold; } /** @@ -88,7 +88,7 @@ void setGeoDegs(LatLng *p, double latDegs, double lngDegs) { */ void _setGeoRads(LatLng *p, double latRads, double lngRads) { p->lat = latRads; - p->lon = lngRads; + p->lng = lngRads; } /** @@ -151,7 +151,7 @@ double constrainLng(double lng) { */ double H3_EXPORT(pointDistRads)(const LatLng *a, const LatLng *b) { double sinLat = sin((b->lat - a->lat) / 2.0); - double sinLng = sin((b->lon - a->lon) / 2.0); + double sinLng = sin((b->lng - a->lng) / 2.0); double A = sinLat * sinLat + cos(a->lat) * cos(b->lat) * sinLng * sinLng; @@ -180,9 +180,9 @@ double H3_EXPORT(pointDistM)(const LatLng *a, const LatLng *b) { * @return The azimuth in radians from p1 to p2. */ double _geoAzimuthRads(const LatLng *p1, const LatLng *p2) { - return atan2(cos(p2->lat) * sin(p2->lon - p1->lon), + return atan2(cos(p2->lat) * sin(p2->lng - p1->lng), cos(p1->lat) * sin(p2->lat) - - sin(p1->lat) * cos(p2->lat) * cos(p2->lon - p1->lon)); + sin(p1->lat) * cos(p2->lat) * cos(p2->lng - p1->lng)); } /** @@ -216,13 +216,13 @@ void _geoAzDistanceRads(const LatLng *p1, double az, double distance, if (fabs(p2->lat - M_PI_2) < EPSILON) // north pole { p2->lat = M_PI_2; - p2->lon = 0.0; + p2->lng = 0.0; } else if (fabs(p2->lat + M_PI_2) < EPSILON) // south pole { p2->lat = -M_PI_2; - p2->lon = 0.0; + p2->lng = 0.0; } else - p2->lon = constrainLng(p1->lon); + p2->lng = constrainLng(p1->lng); } else // not due north or south { sinlat = sin(p1->lat) * cos(distance) + @@ -233,11 +233,11 @@ void _geoAzDistanceRads(const LatLng *p1, double az, double distance, if (fabs(p2->lat - M_PI_2) < EPSILON) // north pole { p2->lat = M_PI_2; - p2->lon = 0.0; + p2->lng = 0.0; } else if (fabs(p2->lat + M_PI_2) < EPSILON) // south pole { p2->lat = -M_PI_2; - p2->lon = 0.0; + p2->lng = 0.0; } else { sinlng = sin(az) * sin(distance) / cos(p2->lat); coslng = (cos(distance) - sin(p1->lat) * sin(p2->lat)) / @@ -246,7 +246,7 @@ void _geoAzDistanceRads(const LatLng *p1, double az, double distance, if (sinlng < -1.0) sinlng = -1.0; if (coslng > 1.0) coslng = 1.0; if (coslng < -1.0) coslng = -1.0; - p2->lon = constrainLng(p1->lon + atan2(sinlng, coslng)); + p2->lng = constrainLng(p1->lng + atan2(sinlng, coslng)); } } } diff --git a/src/h3lib/lib/vec3d.c b/src/h3lib/lib/vec3d.c index a357d71b4..9e5fc5821 100644 --- a/src/h3lib/lib/vec3d.c +++ b/src/h3lib/lib/vec3d.c @@ -51,6 +51,6 @@ void _geoToVec3d(const LatLng* geo, Vec3d* v) { double r = cos(geo->lat); v->z = sin(geo->lat); - v->x = cos(geo->lon) * r; - v->y = sin(geo->lon) * r; + v->x = cos(geo->lng) * r; + v->y = sin(geo->lng) * r; } diff --git a/src/h3lib/lib/vertexGraph.c b/src/h3lib/lib/vertexGraph.c index cd4b7eddd..bbbbf39fb 100644 --- a/src/h3lib/lib/vertexGraph.c +++ b/src/h3lib/lib/vertexGraph.c @@ -73,7 +73,7 @@ void destroyVertexGraph(VertexGraph* graph) { uint32_t _hashVertex(const LatLng* vertex, int res, int numBuckets) { // Simple hash: Take the sum of the lat and lng with a precision level // determined by the resolution, converted to int, modulo bucket count. - return (uint32_t)fmod(fabs((vertex->lat + vertex->lon) * pow(10, 15 - res)), + return (uint32_t)fmod(fabs((vertex->lat + vertex->lng) * pow(10, 15 - res)), numBuckets); } From a0c3b5bb48cc2204757647bf68d11f34644e4889 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 22:51:24 -0700 Subject: [PATCH 43/74] `LatLng` struct in h3api.h.in --- src/h3lib/include/h3api.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index e33ed4f2f..42c99ffb5 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -126,7 +126,7 @@ typedef enum { */ typedef struct { double lat; ///< latitude in radians - double lon; ///< longitude in radians + double lng; ///< longitude in radians } LatLng; /** @struct CellBoundary From b6e8f49705081ba0e181bf80c37aee8fb900fdba Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 23:51:06 -0700 Subject: [PATCH 44/74] let's not change the 3.x docs --- website/versioned_docs/version-3.x/core-library/filters.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/versioned_docs/version-3.x/core-library/filters.md b/website/versioned_docs/version-3.x/core-library/filters.md index e6f3877ed..742b73644 100644 --- a/website/versioned_docs/version-3.x/core-library/filters.md +++ b/website/versioned_docs/version-3.x/core-library/filters.md @@ -14,9 +14,9 @@ All latitude/longitude coordinates are in decimal degrees. See the [H3 Index Rep | filter | input | outputs | ---------------- | --------- | ------- -| `geoToH3` | lat/lng | `H3Index` -| `h3ToGeo` | `H3Index` | cell center point in lat/lng -| `h3ToGeoBoundary`| `H3Index` | cell boundary in lat/lng +| `geoToH3` | lat/lon | `H3Index` +| `h3ToGeo` | `H3Index` | cell center point in lat/lon +| `h3ToGeoBoundary`| `H3Index` | cell boundary in lat/lon | `h3ToComponents` | `H3Index` | components | `kRing` | `H3Index` | surrounding `H3Index` | `hexRange` | `H3Index` | surrounding `H3Index`, in order From 88cdfdfe631bb5466ee2454303c66f697de4bff5 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 23:54:48 -0700 Subject: [PATCH 45/74] changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b0982280..b15b4fae0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,12 @@ The public API of this library consists of the functions declared in file ### Breaking changes - rename `maxH3ToChildrenSize` to `cellToChildrenSize` - `cellToChildrenSize` to output `int64_t` instead of `int` +- rename `GeoPoint` to `LatLng` +- rename `LinkedGeoPoint` to `LinkedLatLng` +- rename `pointToCell` to `latLngToCell` +- rename `cellToPoint` to `cellToLatLng` +- rename `vertexToPoint` to `vertexToLatLng` +- generally use `lng` instead of `lon` ## [3.7.1] - 2020-10-05 ### Fixed From 247022bb4f0ba0dedfb5cfb9e9f50b2ac2018b38 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Tue, 18 May 2021 23:59:15 -0700 Subject: [PATCH 46/74] updating the terminology rfc --- .../names_for_concepts_types_functions.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md b/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md index dd9504df4..e6832fc7c 100644 --- a/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md +++ b/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md @@ -52,7 +52,7 @@ The following technical terms should be used in the documentation, the H3 codeba - **grid**: - the graph with nodes corresponding to H3 cells, and edges given by pairs of adjacent cells - for example, `gridDistance` is the minimal number of edges in a graph path connecting two cells -- **point**: +- **lat/lng point**: - a representation of a geographic point in terms of a latitude/longitude pair - **topological**: - H3 cells are **topological** pentagons or hexagons, in the sense that they have 5 or 6 neighbors, respectively, in the H3 **grid** @@ -66,7 +66,7 @@ The following technical terms should be used in the documentation, the H3 codeba - there is a one-to-one correspondence between the "base cell number" and the `H3Index` representation of resolution `0` cells + e.g., base cell 0 has `H3Index` hexadecimal representation `'8001fffffffffff'` - **boundary**: - - all or part of the list of geometric points that enclose an H3 cell + - all or part of the list of lat/lng points that enclose an H3 cell - may include more than 6 points in the case that a cell is not a geometric hexagon, such as when a hexagon crosses an icosahedron boundary - may also be used to describe the boundary between two geometric cells, as in the case of an edge - represented in the H3 codebase with the `CellBoundary` struct (previously `GeoBoundary` before v4.0) @@ -139,8 +139,8 @@ There is some ambiguity between property, transform, and computation, so use you | `h3GetResolution` | `getResolution` | | *DNE* | `getMode` | | `h3GetFaces` | `getIcosahedronFaces` | -| `geoToH3` | `latLngToCell` | -| `h3ToGeo` | `cellToLatLng` | +| `geoToH3` | `latLngToCell` | +| `h3ToGeo` | `cellToLatLng` | | `compact` | `compactCells` | | `uncompact` | `uncompactCells` | | `polyfill` | `polygonToCells` | @@ -260,13 +260,13 @@ discussion requiring benchmarking, so we will defer that to a - rename `GeoBoundary` to `CellBoundary` to indicate it is space-limited to describing the geometry of cells -| Current name | Proposed name | Notes | -|-------------------|-------------------|-----------------------------------| +| Current name | Proposed name | Notes | +|-------------------|-------------------|---------------------------------| +| `GeoCoord` | `LatLng` | | | `GeoBoundary` | `CellBoundary` | <= 10 stack-allocated `LatLng`s | -| `GeoCoord` | `LatLng` | | | `Geofence` | `GeoLoop` | heap-allocated `LatLng`s | -| `GeoPolygon` | `GeoPolygon` | | -| `GeoMultiPolygon` | `GeoMultiPolygon` | currently not used | +| `GeoPolygon` | `GeoPolygon` | | +| `GeoMultiPolygon` | `GeoMultiPolygon` | currently not used | ### Functions From ed6204ed7eb78f066794527dba0d9ea20afb4200 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Wed, 19 May 2021 14:51:58 -0700 Subject: [PATCH 47/74] update copyright year --- examples/distance.c | 2 +- examples/edge.c | 2 +- examples/index.c | 2 +- src/apps/applib/include/kml.h | 2 +- src/apps/applib/include/test.h | 2 +- src/apps/applib/lib/kml.c | 2 +- src/apps/benchmarks/benchmarkDirectedEdge.c | 2 +- src/apps/benchmarks/benchmarkH3Api.c | 2 +- src/apps/benchmarks/benchmarkPolygon.c | 2 +- src/apps/benchmarks/benchmarkPolygonToCells.c | 2 +- src/apps/filters/cellToBoundary.c | 2 +- src/apps/filters/cellToLatLng.c | 2 +- src/apps/filters/latLngToCell.c | 2 +- src/apps/miscapps/cellToBoundaryHier.c | 2 +- src/apps/miscapps/cellToLatLngHier.c | 2 +- src/apps/testapps/mkRandGeo.c | 2 +- src/apps/testapps/testBBox.c | 2 +- src/apps/testapps/testCellToBoundary.c | 2 +- src/apps/testapps/testCellToCenterChild.c | 2 +- src/apps/testapps/testCellToLatLng.c | 2 +- src/apps/testapps/testCellToParent.c | 2 +- src/apps/testapps/testDirectedEdge.c | 2 +- src/apps/testapps/testDirectedEdgeExhaustive.c | 2 +- src/apps/testapps/testGridDisk.c | 2 +- src/apps/testapps/testGridDisksUnsafe.c | 2 +- src/apps/testapps/testH3Api.c | 2 +- src/apps/testapps/testH3CellArea.c | 2 +- src/apps/testapps/testH3Index.c | 2 +- src/apps/testapps/testH3Memory.c | 2 +- src/apps/testapps/testLatLng.c | 2 +- src/apps/testapps/testLatLngToCell.c | 2 +- src/apps/testapps/testLinkedGeo.c | 2 +- src/apps/testapps/testPolygon.c | 2 +- src/apps/testapps/testPolygonToCells.c | 2 +- src/apps/testapps/testPolygonToCellsReported.c | 2 +- src/apps/testapps/testVec3d.c | 2 +- src/apps/testapps/testVertexGraph.c | 2 +- src/h3lib/include/bbox.h | 2 +- src/h3lib/include/faceijk.h | 2 +- src/h3lib/include/latLng.h | 2 +- src/h3lib/include/linkedGeo.h | 2 +- src/h3lib/include/polygon.h | 2 +- src/h3lib/include/polygonAlgos.h | 2 +- src/h3lib/include/vec3d.h | 2 +- src/h3lib/include/vertexGraph.h | 2 +- src/h3lib/lib/bbox.c | 2 +- src/h3lib/lib/coordijk.c | 2 +- src/h3lib/lib/directedEdge.c | 2 +- src/h3lib/lib/faceijk.c | 2 +- src/h3lib/lib/latLng.c | 2 +- src/h3lib/lib/linkedGeo.c | 2 +- src/h3lib/lib/polygon.c | 2 +- src/h3lib/lib/vec3d.c | 2 +- src/h3lib/lib/vertexGraph.c | 2 +- 54 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/distance.c b/examples/distance.c index a9d4b4176..1c674d962 100644 --- a/examples/distance.c +++ b/examples/distance.c @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/examples/edge.c b/examples/edge.c index 9fc2493af..edbd877a9 100644 --- a/examples/edge.c +++ b/examples/edge.c @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/examples/index.c b/examples/index.c index 50da49a77..178bd4aa3 100644 --- a/examples/index.c +++ b/examples/index.c @@ -1,5 +1,5 @@ /* - * Copyright 2017, 2020 Uber Technologies, Inc. + * Copyright 2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/applib/include/kml.h b/src/apps/applib/include/kml.h index 45ffc09ca..0adc7aa1f 100644 --- a/src/apps/applib/include/kml.h +++ b/src/apps/applib/include/kml.h @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/applib/include/test.h b/src/apps/applib/include/test.h index 7ffbb5904..e7d568de1 100644 --- a/src/apps/applib/include/test.h +++ b/src/apps/applib/include/test.h @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/applib/lib/kml.c b/src/apps/applib/lib/kml.c index 51ac370f6..e8e46434c 100644 --- a/src/apps/applib/lib/kml.c +++ b/src/apps/applib/lib/kml.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/benchmarks/benchmarkDirectedEdge.c b/src/apps/benchmarks/benchmarkDirectedEdge.c index 25d189afa..2309da6f0 100644 --- a/src/apps/benchmarks/benchmarkDirectedEdge.c +++ b/src/apps/benchmarks/benchmarkDirectedEdge.c @@ -1,5 +1,5 @@ /* - * Copyright 2020 Uber Technologies, Inc. + * Copyright 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/benchmarks/benchmarkH3Api.c b/src/apps/benchmarks/benchmarkH3Api.c index 69aefc136..d54b66597 100644 --- a/src/apps/benchmarks/benchmarkH3Api.c +++ b/src/apps/benchmarks/benchmarkH3Api.c @@ -1,5 +1,5 @@ /* - * Copyright 2017, 2020 Uber Technologies, Inc. + * Copyright 2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/benchmarks/benchmarkPolygon.c b/src/apps/benchmarks/benchmarkPolygon.c index 8e0ec3474..461f125bd 100644 --- a/src/apps/benchmarks/benchmarkPolygon.c +++ b/src/apps/benchmarks/benchmarkPolygon.c @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/benchmarks/benchmarkPolygonToCells.c b/src/apps/benchmarks/benchmarkPolygonToCells.c index 4147fd269..faa22a964 100644 --- a/src/apps/benchmarks/benchmarkPolygonToCells.c +++ b/src/apps/benchmarks/benchmarkPolygonToCells.c @@ -1,5 +1,5 @@ /* - * Copyright 2017, 2020 Uber Technologies, Inc. + * Copyright 2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/filters/cellToBoundary.c b/src/apps/filters/cellToBoundary.c index 283ffbd4c..027fdc592 100644 --- a/src/apps/filters/cellToBoundary.c +++ b/src/apps/filters/cellToBoundary.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2019-2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2019-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/filters/cellToLatLng.c b/src/apps/filters/cellToLatLng.c index 0c4f0694f..4dded6c33 100644 --- a/src/apps/filters/cellToLatLng.c +++ b/src/apps/filters/cellToLatLng.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2019-2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2019-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/filters/latLngToCell.c b/src/apps/filters/latLngToCell.c index 487d0d93e..7d745428c 100644 --- a/src/apps/filters/latLngToCell.c +++ b/src/apps/filters/latLngToCell.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2019-2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2019-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/miscapps/cellToBoundaryHier.c b/src/apps/miscapps/cellToBoundaryHier.c index 2061fdb45..b41178fc9 100644 --- a/src/apps/miscapps/cellToBoundaryHier.c +++ b/src/apps/miscapps/cellToBoundaryHier.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2019-2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2019-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/miscapps/cellToLatLngHier.c b/src/apps/miscapps/cellToLatLngHier.c index 2612cd2e3..3e6a55d1a 100644 --- a/src/apps/miscapps/cellToLatLngHier.c +++ b/src/apps/miscapps/cellToLatLngHier.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2019-2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2019-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/mkRandGeo.c b/src/apps/testapps/mkRandGeo.c index a2f38ad8c..b8c13b923 100644 --- a/src/apps/testapps/mkRandGeo.c +++ b/src/apps/testapps/mkRandGeo.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testBBox.c b/src/apps/testapps/testBBox.c index a0a0e9c84..69e32f3cb 100644 --- a/src/apps/testapps/testBBox.c +++ b/src/apps/testapps/testBBox.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2018, 2020 Uber Technologies, Inc. + * Copyright 2016-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testCellToBoundary.c b/src/apps/testapps/testCellToBoundary.c index 4909bb361..2c0a600b6 100644 --- a/src/apps/testapps/testCellToBoundary.c +++ b/src/apps/testapps/testCellToBoundary.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testCellToCenterChild.c b/src/apps/testapps/testCellToCenterChild.c index 49a2bd11a..1e64c21fc 100644 --- a/src/apps/testapps/testCellToCenterChild.c +++ b/src/apps/testapps/testCellToCenterChild.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 Uber Technologies, Inc. + * Copyright 2019-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testCellToLatLng.c b/src/apps/testapps/testCellToLatLng.c index bdff8efb2..c64328ecc 100644 --- a/src/apps/testapps/testCellToLatLng.c +++ b/src/apps/testapps/testCellToLatLng.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testCellToParent.c b/src/apps/testapps/testCellToParent.c index 774b0ad4f..89bd4999c 100644 --- a/src/apps/testapps/testCellToParent.c +++ b/src/apps/testapps/testCellToParent.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testDirectedEdge.c b/src/apps/testapps/testDirectedEdge.c index 35ee7b7c0..9415ccb4b 100644 --- a/src/apps/testapps/testDirectedEdge.c +++ b/src/apps/testapps/testDirectedEdge.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Uber Technologies, Inc. + * Copyright 2017-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testDirectedEdgeExhaustive.c b/src/apps/testapps/testDirectedEdgeExhaustive.c index adbdc6720..84af131a3 100644 --- a/src/apps/testapps/testDirectedEdgeExhaustive.c +++ b/src/apps/testapps/testDirectedEdgeExhaustive.c @@ -1,5 +1,5 @@ /* - * Copyright 2020 Uber Technologies, Inc. + * Copyright 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testGridDisk.c b/src/apps/testapps/testGridDisk.c index 29880a28a..6832c1ff1 100644 --- a/src/apps/testapps/testGridDisk.c +++ b/src/apps/testapps/testGridDisk.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testGridDisksUnsafe.c b/src/apps/testapps/testGridDisksUnsafe.c index 9ac2fdbc8..75d584436 100644 --- a/src/apps/testapps/testGridDisksUnsafe.c +++ b/src/apps/testapps/testGridDisksUnsafe.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testH3Api.c b/src/apps/testapps/testH3Api.c index 691cda104..afa6ab920 100644 --- a/src/apps/testapps/testH3Api.c +++ b/src/apps/testapps/testH3Api.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testH3CellArea.c b/src/apps/testapps/testH3CellArea.c index cd774a4b6..340e059aa 100644 --- a/src/apps/testapps/testH3CellArea.c +++ b/src/apps/testapps/testH3CellArea.c @@ -1,5 +1,5 @@ /* - * Copyright 2020 Uber Technologies, Inc. + * Copyright 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testH3Index.c b/src/apps/testapps/testH3Index.c index 18a43efc1..5e4bd6e59 100644 --- a/src/apps/testapps/testH3Index.c +++ b/src/apps/testapps/testH3Index.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testH3Memory.c b/src/apps/testapps/testH3Memory.c index f494be9bf..755f09358 100644 --- a/src/apps/testapps/testH3Memory.c +++ b/src/apps/testapps/testH3Memory.c @@ -1,5 +1,5 @@ /* - * Copyright 2020 Uber Technologies, Inc. + * Copyright 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testLatLng.c b/src/apps/testapps/testLatLng.c index 5d5659498..e382c4133 100644 --- a/src/apps/testapps/testLatLng.c +++ b/src/apps/testapps/testLatLng.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Uber Technologies, Inc. + * Copyright 2017-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testLatLngToCell.c b/src/apps/testapps/testLatLngToCell.c index 22786e59a..8e074d41e 100644 --- a/src/apps/testapps/testLatLngToCell.c +++ b/src/apps/testapps/testLatLngToCell.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2018, 2020 Uber Technologies, Inc. + * Copyright 2016-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testLinkedGeo.c b/src/apps/testapps/testLinkedGeo.c index 9b9660e54..db9f923de 100644 --- a/src/apps/testapps/testLinkedGeo.c +++ b/src/apps/testapps/testLinkedGeo.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testPolygon.c b/src/apps/testapps/testPolygon.c index 413896b6b..2c6609c59 100644 --- a/src/apps/testapps/testPolygon.c +++ b/src/apps/testapps/testPolygon.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Uber Technologies, Inc. + * Copyright 2017-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testPolygonToCells.c b/src/apps/testapps/testPolygonToCells.c index bfff3940d..fa9367655 100644 --- a/src/apps/testapps/testPolygonToCells.c +++ b/src/apps/testapps/testPolygonToCells.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testPolygonToCellsReported.c b/src/apps/testapps/testPolygonToCellsReported.c index a34a7281e..de2889af8 100644 --- a/src/apps/testapps/testPolygonToCellsReported.c +++ b/src/apps/testapps/testPolygonToCellsReported.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Uber Technologies, Inc. + * Copyright 2017-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testVec3d.c b/src/apps/testapps/testVec3d.c index 056700807..1e3ea1664 100644 --- a/src/apps/testapps/testVec3d.c +++ b/src/apps/testapps/testVec3d.c @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testVertexGraph.c b/src/apps/testapps/testVertexGraph.c index cf3aeb544..e6a66a9c6 100644 --- a/src/apps/testapps/testVertexGraph.c +++ b/src/apps/testapps/testVertexGraph.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/bbox.h b/src/h3lib/include/bbox.h index e31948bb8..7614bf3de 100644 --- a/src/h3lib/include/bbox.h +++ b/src/h3lib/include/bbox.h @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/faceijk.h b/src/h3lib/include/faceijk.h index 9c474a2dd..1dab11811 100644 --- a/src/h3lib/include/faceijk.h +++ b/src/h3lib/include/faceijk.h @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 Uber Technologies, Inc. + * Copyright 2016-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/latLng.h b/src/h3lib/include/latLng.h index bc885ce64..2dc674efa 100644 --- a/src/h3lib/include/latLng.h +++ b/src/h3lib/include/latLng.h @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 Uber Technologies, Inc. + * Copyright 2016-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/linkedGeo.h b/src/h3lib/include/linkedGeo.h index 8f3ba5054..578574f6c 100644 --- a/src/h3lib/include/linkedGeo.h +++ b/src/h3lib/include/linkedGeo.h @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/polygon.h b/src/h3lib/include/polygon.h index 492045412..6d5de2118 100644 --- a/src/h3lib/include/polygon.h +++ b/src/h3lib/include/polygon.h @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/polygonAlgos.h b/src/h3lib/include/polygonAlgos.h index 83e700b64..b812ccef7 100644 --- a/src/h3lib/include/polygonAlgos.h +++ b/src/h3lib/include/polygonAlgos.h @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/vec3d.h b/src/h3lib/include/vec3d.h index f5902b523..68f0b65d4 100644 --- a/src/h3lib/include/vec3d.h +++ b/src/h3lib/include/vec3d.h @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/vertexGraph.h b/src/h3lib/include/vertexGraph.h index f2676bd79..be10d7c17 100644 --- a/src/h3lib/include/vertexGraph.h +++ b/src/h3lib/include/vertexGraph.h @@ -1,5 +1,5 @@ /* - * Copyright 2017, 2020 Uber Technologies, Inc. + * Copyright 2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/bbox.c b/src/h3lib/lib/bbox.c index fcb5840ba..00e6a331b 100644 --- a/src/h3lib/lib/bbox.c +++ b/src/h3lib/lib/bbox.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 Uber Technologies, Inc. + * Copyright 2016-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/coordijk.c b/src/h3lib/lib/coordijk.c index 70b085b0e..7062a6d2d 100644 --- a/src/h3lib/lib/coordijk.c +++ b/src/h3lib/lib/coordijk.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2018, 2020 Uber Technologies, Inc. + * Copyright 2016-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/directedEdge.c b/src/h3lib/lib/directedEdge.c index b190c2e1d..d66bcf7fe 100644 --- a/src/h3lib/lib/directedEdge.c +++ b/src/h3lib/lib/directedEdge.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/faceijk.c b/src/h3lib/lib/faceijk.c index 66470b175..e1ceeb219 100644 --- a/src/h3lib/lib/faceijk.c +++ b/src/h3lib/lib/faceijk.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 Uber Technologies, Inc. + * Copyright 2016-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/latLng.c b/src/h3lib/lib/latLng.c index 7d9e5c4cc..a87e68e0a 100644 --- a/src/h3lib/lib/latLng.c +++ b/src/h3lib/lib/latLng.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 Uber Technologies, Inc. + * Copyright 2016-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/linkedGeo.c b/src/h3lib/lib/linkedGeo.c index e2dd23eac..ef1b085b2 100644 --- a/src/h3lib/lib/linkedGeo.c +++ b/src/h3lib/lib/linkedGeo.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/polygon.c b/src/h3lib/lib/polygon.c index 3d28f5095..5d8348702 100644 --- a/src/h3lib/lib/polygon.c +++ b/src/h3lib/lib/polygon.c @@ -1,5 +1,5 @@ /* - * Copyright 2018-2020 Uber Technologies, Inc. + * Copyright 2018-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/vec3d.c b/src/h3lib/lib/vec3d.c index 9e5fc5821..470462c99 100644 --- a/src/h3lib/lib/vec3d.c +++ b/src/h3lib/lib/vec3d.c @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/vertexGraph.c b/src/h3lib/lib/vertexGraph.c index bbbbf39fb..38d56c0c7 100644 --- a/src/h3lib/lib/vertexGraph.c +++ b/src/h3lib/lib/vertexGraph.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From f200e0ffb607a726635734ea66feef737616320a Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Wed, 19 May 2021 14:51:58 -0700 Subject: [PATCH 48/74] update copyright year --- examples/distance.c | 2 +- examples/edge.c | 2 +- examples/index.c | 2 +- src/apps/applib/include/kml.h | 2 +- src/apps/applib/include/test.h | 2 +- src/apps/applib/lib/kml.c | 2 +- src/apps/benchmarks/benchmarkDirectedEdge.c | 2 +- src/apps/benchmarks/benchmarkH3Api.c | 2 +- src/apps/benchmarks/benchmarkPolygon.c | 2 +- src/apps/benchmarks/benchmarkPolygonToCells.c | 2 +- src/apps/filters/cellToBoundary.c | 2 +- src/apps/filters/cellToLatLng.c | 2 +- src/apps/filters/latLngToCell.c | 2 +- src/apps/miscapps/cellToBoundaryHier.c | 2 +- src/apps/miscapps/cellToLatLngHier.c | 2 +- src/apps/testapps/mkRandGeo.c | 2 +- src/apps/testapps/testBBox.c | 2 +- src/apps/testapps/testCellToBoundary.c | 2 +- src/apps/testapps/testCellToCenterChild.c | 2 +- src/apps/testapps/testCellToLatLng.c | 2 +- src/apps/testapps/testCellToParent.c | 2 +- src/apps/testapps/testDirectedEdge.c | 2 +- src/apps/testapps/testDirectedEdgeExhaustive.c | 2 +- src/apps/testapps/testGridDisk.c | 2 +- src/apps/testapps/testGridDisksUnsafe.c | 2 +- src/apps/testapps/testH3Api.c | 2 +- src/apps/testapps/testH3CellArea.c | 2 +- src/apps/testapps/testH3Index.c | 2 +- src/apps/testapps/testH3Memory.c | 2 +- src/apps/testapps/testLatLng.c | 2 +- src/apps/testapps/testLatLngToCell.c | 2 +- src/apps/testapps/testLinkedGeo.c | 2 +- src/apps/testapps/testPolygon.c | 2 +- src/apps/testapps/testPolygonToCells.c | 2 +- src/apps/testapps/testPolygonToCellsReported.c | 2 +- src/apps/testapps/testVec3d.c | 2 +- src/apps/testapps/testVertexGraph.c | 2 +- src/h3lib/include/bbox.h | 2 +- src/h3lib/include/faceijk.h | 2 +- src/h3lib/include/latLng.h | 2 +- src/h3lib/include/linkedGeo.h | 2 +- src/h3lib/include/polygon.h | 2 +- src/h3lib/include/polygonAlgos.h | 2 +- src/h3lib/include/vec3d.h | 2 +- src/h3lib/include/vertexGraph.h | 2 +- src/h3lib/lib/bbox.c | 2 +- src/h3lib/lib/coordijk.c | 2 +- src/h3lib/lib/directedEdge.c | 2 +- src/h3lib/lib/faceijk.c | 2 +- src/h3lib/lib/latLng.c | 2 +- src/h3lib/lib/linkedGeo.c | 2 +- src/h3lib/lib/polygon.c | 2 +- src/h3lib/lib/vec3d.c | 2 +- src/h3lib/lib/vertexGraph.c | 2 +- 54 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/distance.c b/examples/distance.c index a9d4b4176..1c674d962 100644 --- a/examples/distance.c +++ b/examples/distance.c @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/examples/edge.c b/examples/edge.c index 9fc2493af..edbd877a9 100644 --- a/examples/edge.c +++ b/examples/edge.c @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/examples/index.c b/examples/index.c index 50da49a77..178bd4aa3 100644 --- a/examples/index.c +++ b/examples/index.c @@ -1,5 +1,5 @@ /* - * Copyright 2017, 2020 Uber Technologies, Inc. + * Copyright 2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/applib/include/kml.h b/src/apps/applib/include/kml.h index 45ffc09ca..0adc7aa1f 100644 --- a/src/apps/applib/include/kml.h +++ b/src/apps/applib/include/kml.h @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/applib/include/test.h b/src/apps/applib/include/test.h index 7ffbb5904..e7d568de1 100644 --- a/src/apps/applib/include/test.h +++ b/src/apps/applib/include/test.h @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/applib/lib/kml.c b/src/apps/applib/lib/kml.c index 51ac370f6..e8e46434c 100644 --- a/src/apps/applib/lib/kml.c +++ b/src/apps/applib/lib/kml.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/benchmarks/benchmarkDirectedEdge.c b/src/apps/benchmarks/benchmarkDirectedEdge.c index 25d189afa..2309da6f0 100644 --- a/src/apps/benchmarks/benchmarkDirectedEdge.c +++ b/src/apps/benchmarks/benchmarkDirectedEdge.c @@ -1,5 +1,5 @@ /* - * Copyright 2020 Uber Technologies, Inc. + * Copyright 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/benchmarks/benchmarkH3Api.c b/src/apps/benchmarks/benchmarkH3Api.c index 69aefc136..d54b66597 100644 --- a/src/apps/benchmarks/benchmarkH3Api.c +++ b/src/apps/benchmarks/benchmarkH3Api.c @@ -1,5 +1,5 @@ /* - * Copyright 2017, 2020 Uber Technologies, Inc. + * Copyright 2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/benchmarks/benchmarkPolygon.c b/src/apps/benchmarks/benchmarkPolygon.c index 8e0ec3474..461f125bd 100644 --- a/src/apps/benchmarks/benchmarkPolygon.c +++ b/src/apps/benchmarks/benchmarkPolygon.c @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/benchmarks/benchmarkPolygonToCells.c b/src/apps/benchmarks/benchmarkPolygonToCells.c index 4147fd269..faa22a964 100644 --- a/src/apps/benchmarks/benchmarkPolygonToCells.c +++ b/src/apps/benchmarks/benchmarkPolygonToCells.c @@ -1,5 +1,5 @@ /* - * Copyright 2017, 2020 Uber Technologies, Inc. + * Copyright 2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/filters/cellToBoundary.c b/src/apps/filters/cellToBoundary.c index 283ffbd4c..027fdc592 100644 --- a/src/apps/filters/cellToBoundary.c +++ b/src/apps/filters/cellToBoundary.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2019-2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2019-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/filters/cellToLatLng.c b/src/apps/filters/cellToLatLng.c index 0c4f0694f..4dded6c33 100644 --- a/src/apps/filters/cellToLatLng.c +++ b/src/apps/filters/cellToLatLng.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2019-2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2019-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/filters/latLngToCell.c b/src/apps/filters/latLngToCell.c index 487d0d93e..7d745428c 100644 --- a/src/apps/filters/latLngToCell.c +++ b/src/apps/filters/latLngToCell.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2019-2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2019-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/miscapps/cellToBoundaryHier.c b/src/apps/miscapps/cellToBoundaryHier.c index 2061fdb45..b41178fc9 100644 --- a/src/apps/miscapps/cellToBoundaryHier.c +++ b/src/apps/miscapps/cellToBoundaryHier.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2019-2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2019-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/miscapps/cellToLatLngHier.c b/src/apps/miscapps/cellToLatLngHier.c index 2612cd2e3..3e6a55d1a 100644 --- a/src/apps/miscapps/cellToLatLngHier.c +++ b/src/apps/miscapps/cellToLatLngHier.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2019-2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2019-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/mkRandGeo.c b/src/apps/testapps/mkRandGeo.c index a2f38ad8c..b8c13b923 100644 --- a/src/apps/testapps/mkRandGeo.c +++ b/src/apps/testapps/mkRandGeo.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testBBox.c b/src/apps/testapps/testBBox.c index a0a0e9c84..69e32f3cb 100644 --- a/src/apps/testapps/testBBox.c +++ b/src/apps/testapps/testBBox.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2018, 2020 Uber Technologies, Inc. + * Copyright 2016-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testCellToBoundary.c b/src/apps/testapps/testCellToBoundary.c index 4909bb361..2c0a600b6 100644 --- a/src/apps/testapps/testCellToBoundary.c +++ b/src/apps/testapps/testCellToBoundary.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testCellToCenterChild.c b/src/apps/testapps/testCellToCenterChild.c index 49a2bd11a..1e64c21fc 100644 --- a/src/apps/testapps/testCellToCenterChild.c +++ b/src/apps/testapps/testCellToCenterChild.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 Uber Technologies, Inc. + * Copyright 2019-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testCellToLatLng.c b/src/apps/testapps/testCellToLatLng.c index bdff8efb2..c64328ecc 100644 --- a/src/apps/testapps/testCellToLatLng.c +++ b/src/apps/testapps/testCellToLatLng.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testCellToParent.c b/src/apps/testapps/testCellToParent.c index 774b0ad4f..89bd4999c 100644 --- a/src/apps/testapps/testCellToParent.c +++ b/src/apps/testapps/testCellToParent.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testDirectedEdge.c b/src/apps/testapps/testDirectedEdge.c index 35ee7b7c0..9415ccb4b 100644 --- a/src/apps/testapps/testDirectedEdge.c +++ b/src/apps/testapps/testDirectedEdge.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Uber Technologies, Inc. + * Copyright 2017-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testDirectedEdgeExhaustive.c b/src/apps/testapps/testDirectedEdgeExhaustive.c index adbdc6720..84af131a3 100644 --- a/src/apps/testapps/testDirectedEdgeExhaustive.c +++ b/src/apps/testapps/testDirectedEdgeExhaustive.c @@ -1,5 +1,5 @@ /* - * Copyright 2020 Uber Technologies, Inc. + * Copyright 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testGridDisk.c b/src/apps/testapps/testGridDisk.c index 29880a28a..6832c1ff1 100644 --- a/src/apps/testapps/testGridDisk.c +++ b/src/apps/testapps/testGridDisk.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testGridDisksUnsafe.c b/src/apps/testapps/testGridDisksUnsafe.c index 9ac2fdbc8..75d584436 100644 --- a/src/apps/testapps/testGridDisksUnsafe.c +++ b/src/apps/testapps/testGridDisksUnsafe.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testH3Api.c b/src/apps/testapps/testH3Api.c index 691cda104..afa6ab920 100644 --- a/src/apps/testapps/testH3Api.c +++ b/src/apps/testapps/testH3Api.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testH3CellArea.c b/src/apps/testapps/testH3CellArea.c index cd774a4b6..340e059aa 100644 --- a/src/apps/testapps/testH3CellArea.c +++ b/src/apps/testapps/testH3CellArea.c @@ -1,5 +1,5 @@ /* - * Copyright 2020 Uber Technologies, Inc. + * Copyright 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testH3Index.c b/src/apps/testapps/testH3Index.c index 18a43efc1..5e4bd6e59 100644 --- a/src/apps/testapps/testH3Index.c +++ b/src/apps/testapps/testH3Index.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testH3Memory.c b/src/apps/testapps/testH3Memory.c index f494be9bf..755f09358 100644 --- a/src/apps/testapps/testH3Memory.c +++ b/src/apps/testapps/testH3Memory.c @@ -1,5 +1,5 @@ /* - * Copyright 2020 Uber Technologies, Inc. + * Copyright 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testLatLng.c b/src/apps/testapps/testLatLng.c index 5d5659498..e382c4133 100644 --- a/src/apps/testapps/testLatLng.c +++ b/src/apps/testapps/testLatLng.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Uber Technologies, Inc. + * Copyright 2017-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testLatLngToCell.c b/src/apps/testapps/testLatLngToCell.c index 22786e59a..8e074d41e 100644 --- a/src/apps/testapps/testLatLngToCell.c +++ b/src/apps/testapps/testLatLngToCell.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2018, 2020 Uber Technologies, Inc. + * Copyright 2016-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testLinkedGeo.c b/src/apps/testapps/testLinkedGeo.c index 9b9660e54..db9f923de 100644 --- a/src/apps/testapps/testLinkedGeo.c +++ b/src/apps/testapps/testLinkedGeo.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testPolygon.c b/src/apps/testapps/testPolygon.c index 413896b6b..2c6609c59 100644 --- a/src/apps/testapps/testPolygon.c +++ b/src/apps/testapps/testPolygon.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Uber Technologies, Inc. + * Copyright 2017-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testPolygonToCells.c b/src/apps/testapps/testPolygonToCells.c index bfff3940d..fa9367655 100644 --- a/src/apps/testapps/testPolygonToCells.c +++ b/src/apps/testapps/testPolygonToCells.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testPolygonToCellsReported.c b/src/apps/testapps/testPolygonToCellsReported.c index a34a7281e..de2889af8 100644 --- a/src/apps/testapps/testPolygonToCellsReported.c +++ b/src/apps/testapps/testPolygonToCellsReported.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Uber Technologies, Inc. + * Copyright 2017-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testVec3d.c b/src/apps/testapps/testVec3d.c index 056700807..1e3ea1664 100644 --- a/src/apps/testapps/testVec3d.c +++ b/src/apps/testapps/testVec3d.c @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/apps/testapps/testVertexGraph.c b/src/apps/testapps/testVertexGraph.c index cf3aeb544..e6a66a9c6 100644 --- a/src/apps/testapps/testVertexGraph.c +++ b/src/apps/testapps/testVertexGraph.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/bbox.h b/src/h3lib/include/bbox.h index e31948bb8..7614bf3de 100644 --- a/src/h3lib/include/bbox.h +++ b/src/h3lib/include/bbox.h @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, 2020 Uber Technologies, Inc. + * Copyright 2016-2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/faceijk.h b/src/h3lib/include/faceijk.h index 9c474a2dd..1dab11811 100644 --- a/src/h3lib/include/faceijk.h +++ b/src/h3lib/include/faceijk.h @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 Uber Technologies, Inc. + * Copyright 2016-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/latLng.h b/src/h3lib/include/latLng.h index bc885ce64..2dc674efa 100644 --- a/src/h3lib/include/latLng.h +++ b/src/h3lib/include/latLng.h @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 Uber Technologies, Inc. + * Copyright 2016-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/linkedGeo.h b/src/h3lib/include/linkedGeo.h index 8f3ba5054..578574f6c 100644 --- a/src/h3lib/include/linkedGeo.h +++ b/src/h3lib/include/linkedGeo.h @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/polygon.h b/src/h3lib/include/polygon.h index 492045412..6d5de2118 100644 --- a/src/h3lib/include/polygon.h +++ b/src/h3lib/include/polygon.h @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/polygonAlgos.h b/src/h3lib/include/polygonAlgos.h index 83e700b64..b812ccef7 100644 --- a/src/h3lib/include/polygonAlgos.h +++ b/src/h3lib/include/polygonAlgos.h @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/vec3d.h b/src/h3lib/include/vec3d.h index f5902b523..68f0b65d4 100644 --- a/src/h3lib/include/vec3d.h +++ b/src/h3lib/include/vec3d.h @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/include/vertexGraph.h b/src/h3lib/include/vertexGraph.h index f2676bd79..be10d7c17 100644 --- a/src/h3lib/include/vertexGraph.h +++ b/src/h3lib/include/vertexGraph.h @@ -1,5 +1,5 @@ /* - * Copyright 2017, 2020 Uber Technologies, Inc. + * Copyright 2017, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/bbox.c b/src/h3lib/lib/bbox.c index fcb5840ba..00e6a331b 100644 --- a/src/h3lib/lib/bbox.c +++ b/src/h3lib/lib/bbox.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 Uber Technologies, Inc. + * Copyright 2016-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/coordijk.c b/src/h3lib/lib/coordijk.c index 70b085b0e..7062a6d2d 100644 --- a/src/h3lib/lib/coordijk.c +++ b/src/h3lib/lib/coordijk.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2018, 2020 Uber Technologies, Inc. + * Copyright 2016-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/directedEdge.c b/src/h3lib/lib/directedEdge.c index b190c2e1d..d66bcf7fe 100644 --- a/src/h3lib/lib/directedEdge.c +++ b/src/h3lib/lib/directedEdge.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/faceijk.c b/src/h3lib/lib/faceijk.c index 66470b175..e1ceeb219 100644 --- a/src/h3lib/lib/faceijk.c +++ b/src/h3lib/lib/faceijk.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 Uber Technologies, Inc. + * Copyright 2016-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/latLng.c b/src/h3lib/lib/latLng.c index 7d9e5c4cc..a87e68e0a 100644 --- a/src/h3lib/lib/latLng.c +++ b/src/h3lib/lib/latLng.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 Uber Technologies, Inc. + * Copyright 2016-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/linkedGeo.c b/src/h3lib/lib/linkedGeo.c index e2dd23eac..ef1b085b2 100644 --- a/src/h3lib/lib/linkedGeo.c +++ b/src/h3lib/lib/linkedGeo.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/polygon.c b/src/h3lib/lib/polygon.c index 3d28f5095..5d8348702 100644 --- a/src/h3lib/lib/polygon.c +++ b/src/h3lib/lib/polygon.c @@ -1,5 +1,5 @@ /* - * Copyright 2018-2020 Uber Technologies, Inc. + * Copyright 2018-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/vec3d.c b/src/h3lib/lib/vec3d.c index 9e5fc5821..470462c99 100644 --- a/src/h3lib/lib/vec3d.c +++ b/src/h3lib/lib/vec3d.c @@ -1,5 +1,5 @@ /* - * Copyright 2018, 2020 Uber Technologies, Inc. + * Copyright 2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/h3lib/lib/vertexGraph.c b/src/h3lib/lib/vertexGraph.c index bbbbf39fb..38d56c0c7 100644 --- a/src/h3lib/lib/vertexGraph.c +++ b/src/h3lib/lib/vertexGraph.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018, 2020 Uber Technologies, Inc. + * Copyright 2017-2018, 2020-2021 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 2756d9d59ddbbf8004f89e518ed79d20607e5be3 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 13:35:05 -0700 Subject: [PATCH 49/74] cite terminology RFC --- CHANGELOG.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b15b4fae0..f5de2b6fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,13 +16,10 @@ The public API of this library consists of the functions declared in file - closed-form implementation of `numHexagons` ### Breaking changes -- rename `maxH3ToChildrenSize` to `cellToChildrenSize` +- rename functions according to the terminology RFC (#403, #466) - `cellToChildrenSize` to output `int64_t` instead of `int` -- rename `GeoPoint` to `LatLng` -- rename `LinkedGeoPoint` to `LinkedLatLng` -- rename `pointToCell` to `latLngToCell` -- rename `cellToPoint` to `cellToLatLng` -- rename `vertexToPoint` to `vertexToLatLng` + +### Other changes - generally use `lng` instead of `lon` ## [3.7.1] - 2020-10-05 From 1dd4be08273de3bdcfc76e22f8e2bf08bea1ff97 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 13:39:56 -0700 Subject: [PATCH 50/74] lat/lng in docs terminology page --- website/docs/library/terminology.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/website/docs/library/terminology.md b/website/docs/library/terminology.md index 63489b7b8..5f46e617e 100644 --- a/website/docs/library/terminology.md +++ b/website/docs/library/terminology.md @@ -30,8 +30,9 @@ The following are technical terms used by H3. - **grid**: - the graph with nodes corresponding to H3 cells, and edges given by pairs of adjacent cells - for example, `gridDistance` is the minimal number of edges in a graph path connecting two cells -- **point**: +- **lat/lng point**: - a representation of a geographic point in terms of a latitude/longitude pair + - when abbreviating, we use "lng" (instead of "lon") for longitude - **topological**: - H3 cells are **topological** pentagons or hexagons, in the sense that they have 5 or 6 neighbors, respectively, in the H3 **grid** - the majority of **hexagons** are also **geometric** hexagons (similarly with **pentagons**), in that they have 6 edges and vertices when represented as polygons of lat/lng points @@ -63,4 +64,4 @@ In the codebase and in the documentation, strictly correct terminology should *a ## References -* [Technical RFC for naming concepts](https://github.com/uber/h3/blob/master/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md) \ No newline at end of file +* [Technical RFC for naming concepts](https://github.com/uber/h3/blob/master/dev-docs/RFCs/v4.0.0/names_for_concepts_types_functions.md) From 0d6b2f73a0983d3af2aeef7ac5184aee62bc5b01 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 13:47:51 -0700 Subject: [PATCH 51/74] placeholder python names --- website/docs/api/indexing.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/api/indexing.mdx b/website/docs/api/indexing.mdx index 1d39b9e52..71b39b949 100644 --- a/website/docs/api/indexing.mdx +++ b/website/docs/api/indexing.mdx @@ -32,7 +32,7 @@ H3Error latLngToCell(const LatLng *g, int res, H3Index *out); ```py -h3.point_to_cell(lat, lng, resolution) +h3.latlng_to_cell(lat, lng, resolution) ``` @@ -88,7 +88,7 @@ H3Error cellToLatLng(H3Index cell, LatLng *g); ```py -h3.cell_to_point(cell) +h3.cell_to_latlng(cell) ``` From 44ff6099216f4ac1f3469069d45ee89a5c060c1a Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 14:07:53 -0700 Subject: [PATCH 52/74] some dangling GeoCoord changes --- dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md | 2 +- website/docs/api/misc.mdx | 18 +++++++++--------- website/docs/api/regions.mdx | 8 ++++---- website/docs/api/uniedge.mdx | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md b/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md index 6ea01da91..c7bf23715 100644 --- a/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md +++ b/dev-docs/RFCs/v4.0.0/vertex-mode-rfc.md @@ -47,4 +47,4 @@ Proposed simple algorithm for determining ownership: * `void getCellVertexes(H3Index cell, H3Vertex *vertices)` * `H3Vertex getCellVertex(H3Index cell, int vertIndex)` -* `GeoCoord vertexToLatLng(H3Vertex vertex)` +* `LatLng vertexToLatLng(H3Vertex vertex)` diff --git a/website/docs/api/misc.mdx b/website/docs/api/misc.mdx index 3c796f2b9..b62727df9 100644 --- a/website/docs/api/misc.mdx +++ b/website/docs/api/misc.mdx @@ -857,7 +857,7 @@ Number of pentagon H3 indexes per resolution. This is always 12, but provided as ```c -double pointDistKm(const GeoCoord *a, const GeoCoord *b); +double pointDistKm(const LatLng *a, const LatLng *b); ``` @@ -871,7 +871,7 @@ h3.point_dist(point1, point2, unit='km') ```java -double pointDist(GeoCoord point1, GeoCoord point2, LengthUnit unit); +double pointDist(LatLng point1, LatLng point2, LengthUnit unit); ``` @@ -893,7 +893,7 @@ function example() { Gives the "great circle" or "haversine" distance between pairs of -GeoCoord points (lat/lng pairs) in kilometers. +LatLng points (lat/lng pairs) in kilometers. ## pointDistM @@ -910,7 +910,7 @@ GeoCoord points (lat/lng pairs) in kilometers. ```c -double pointDistM(const GeoCoord *a, const GeoCoord *b); +double pointDistM(const LatLng *a, const LatLng *b); ``` @@ -924,7 +924,7 @@ h3.point_dist(point1, point2, unit='m') ```java -double pointDist(GeoCoord point1, GeoCoord point2, LengthUnit unit); +double pointDist(LatLng point1, LatLng point2, LengthUnit unit); ``` @@ -946,7 +946,7 @@ function example() { Gives the "great circle" or "haversine" distance between pairs of -GeoCoord points (lat/lng pairs) in meters. +LatLng points (lat/lng pairs) in meters. ## pointDistRads @@ -963,7 +963,7 @@ GeoCoord points (lat/lng pairs) in meters. ```c -double pointDistRads(const GeoCoord *a, const GeoCoord *b); +double pointDistRads(const LatLng *a, const LatLng *b); ``` @@ -977,7 +977,7 @@ h3.point_dist(point1, point2, unit='rads') ```java -double pointDist(GeoCoord point1, GeoCoord point2, LengthUnit unit); +double pointDist(LatLng point1, LatLng point2, LengthUnit unit); ``` @@ -999,4 +999,4 @@ function example() { Gives the "great circle" or "haversine" distance between pairs of -GeoCoord points (lat/lng pairs) in radians. +LatLng points (lat/lng pairs) in radians. diff --git a/website/docs/api/regions.mdx b/website/docs/api/regions.mdx index 8a3f6eda5..8058eb3a7 100644 --- a/website/docs/api/regions.mdx +++ b/website/docs/api/regions.mdx @@ -39,8 +39,8 @@ h3.polyfill(polygons, res, geo_json_conformant=False) ```java -List polyfill(List points, List> holes, int res); -List polyfillAddress(List points, List> holes, int res); +List polyfill(List points, List> holes, int res); +List polyfillAddress(List points, List> holes, int res); ``` @@ -154,8 +154,8 @@ h3.h3_set_to_multi_polygon(hexes, geo_json=False) ```java -List>> h3SetToMultiPolygon(Collection h3, boolean geoJson); -List>> h3AddressSetToMultiPolygon(Collection h3Addresses, boolean geoJson); +List>> h3SetToMultiPolygon(Collection h3, boolean geoJson); +List>> h3AddressSetToMultiPolygon(Collection h3Addresses, boolean geoJson); ``` diff --git a/website/docs/api/uniedge.mdx b/website/docs/api/uniedge.mdx index f20365743..63307df83 100644 --- a/website/docs/api/uniedge.mdx +++ b/website/docs/api/uniedge.mdx @@ -414,8 +414,8 @@ h3.get_h3_unidirectional_edge_boundary(edge, geo_json=False) ```java -List getH3UnidirectionalEdgeBoundary(long edge); -List getH3UnidirectionalEdgeBoundary(String edgeAddress); +List getH3UnidirectionalEdgeBoundary(long edge); +List getH3UnidirectionalEdgeBoundary(String edgeAddress); ``` From a3204ffbb17972e5dfb5be2cfdfc7069afa2e5f2 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 14:11:23 -0700 Subject: [PATCH 53/74] meh --- CHANGELOG.md | 3 +++ dev-docs/RFCs/v4.0.0/error-handling-rfc.md | 2 +- src/apps/testapps/testH3CellAreaExhaustive.c | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5de2b6fb..d0223603c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ The public API of this library consists of the functions declared in file ### Breaking changes - rename functions according to the terminology RFC (#403, #466) - `cellToChildrenSize` to output `int64_t` instead of `int` +- `pointDistRads` to `distanceRads` +- `pointDistKm` to `distanceKm` +- `pointDistM` to `distanceM` ### Other changes - generally use `lng` instead of `lon` diff --git a/dev-docs/RFCs/v4.0.0/error-handling-rfc.md b/dev-docs/RFCs/v4.0.0/error-handling-rfc.md index 0aa4bfbd0..103a5f408 100644 --- a/dev-docs/RFCs/v4.0.0/error-handling-rfc.md +++ b/dev-docs/RFCs/v4.0.0/error-handling-rfc.md @@ -272,7 +272,7 @@ hexRange(origin=AN_INDEX, k=-1, &out) => E_DOMAIN hexRange(origin=PENTAGON_INDEX, k=1, &out) => E_PENTAGON # Failed to allocate internal buffer: kRing(origin=AN_INDEX, k=1, &out) => E_MEMORY -pointDistRads({Infinity, Infinity}, {0, 0}, &out) => E_LATLNG_DOMAIN +distanceRads({Infinity, Infinity}, {0, 0}, &out) => E_LATLNG_DOMAIN hexAreaKm2(res=-1) => E_RES_DOMAIN # Cannot parse: stringToH3(str="zzzz", &out) => E_FAILED diff --git a/src/apps/testapps/testH3CellAreaExhaustive.c b/src/apps/testapps/testH3CellAreaExhaustive.c index 7b51c3b69..f5a9bb674 100644 --- a/src/apps/testapps/testH3CellAreaExhaustive.c +++ b/src/apps/testapps/testH3CellAreaExhaustive.c @@ -34,9 +34,9 @@ * neighboring cells. Tests positivity and commutativity. * * Tests the functions: - * pointDistRads - * pointDistKm - * pointDistM + * distanceRads + * distanceKm + * distanceM * * @param edge H3 directed edge denoting neighboring cells */ From 72b9b8eb3c1b3fc77df388042d0d0cfee1bed047 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 14:13:22 -0700 Subject: [PATCH 54/74] distanceRads --- src/apps/testapps/testH3CellAreaExhaustive.c | 6 +++--- src/apps/testapps/testLatLng.c | 16 ++++++++-------- src/h3lib/include/h3api.h.in | 2 +- src/h3lib/lib/latLng.c | 12 ++++++------ website/docs/api/misc.mdx | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/apps/testapps/testH3CellAreaExhaustive.c b/src/apps/testapps/testH3CellAreaExhaustive.c index f5a9bb674..07b96bfe1 100644 --- a/src/apps/testapps/testH3CellAreaExhaustive.c +++ b/src/apps/testapps/testH3CellAreaExhaustive.c @@ -55,8 +55,8 @@ static void haversine_assert(H3Index edge) { double ab, ba; - ab = H3_EXPORT(pointDistRads)(&a, &b); - ba = H3_EXPORT(pointDistRads)(&b, &a); + ab = H3_EXPORT(distanceRads)(&a, &b); + ba = H3_EXPORT(distanceRads)(&b, &a); t_assert(ab > 0, pos); t_assert(ab == ba, comm); @@ -70,7 +70,7 @@ static void haversine_assert(H3Index edge) { t_assert(ab > 0, pos); t_assert(ab == ba, comm); - t_assert(H3_EXPORT(pointDistKm)(&a, &b) > H3_EXPORT(pointDistRads)(&a, &b), + t_assert(H3_EXPORT(pointDistKm)(&a, &b) > H3_EXPORT(distanceRads)(&a, &b), "measurement in kilometers should be greater than in radians"); t_assert(H3_EXPORT(pointDistM)(&a, &b) > H3_EXPORT(pointDistKm)(&a, &b), "measurement in meters should be greater than in kilometers"); diff --git a/src/apps/testapps/testLatLng.c b/src/apps/testapps/testLatLng.c index e382c4133..0332046fd 100644 --- a/src/apps/testapps/testLatLng.c +++ b/src/apps/testapps/testLatLng.c @@ -55,16 +55,16 @@ SUITE(latLng) { "radsToDegs/degsToRads invertible"); } - TEST(pointDistRads) { + TEST(distanceRads) { LatLng p1; setGeoDegs(&p1, 10, 10); LatLng p2; setGeoDegs(&p2, 0, 10); // TODO: Epsilon is relatively large - t_assert(H3_EXPORT(pointDistRads)(&p1, &p1) < EPSILON_RAD * 1000, + t_assert(H3_EXPORT(distanceRads)(&p1, &p1) < EPSILON_RAD * 1000, "0 distance as expected"); - t_assert(fabs(H3_EXPORT(pointDistRads)(&p1, &p2) - + t_assert(fabs(H3_EXPORT(distanceRads)(&p1, &p2) - H3_EXPORT(degsToRads)(10)) < EPSILON_RAD * 1000, "distance along longitude as expected"); } @@ -184,25 +184,25 @@ SUITE(latLng) { double distance = H3_EXPORT(degsToRads)(15); _geoAzDistanceRads(&start, azimuth, distance, &out); - t_assert(fabs(H3_EXPORT(pointDistRads)(&start, &out) - distance) < + t_assert(fabs(H3_EXPORT(distanceRads)(&start, &out) - distance) < EPSILON_RAD, "moved distance is as expected"); LatLng start2 = out; _geoAzDistanceRads(&start2, azimuth + degrees180, distance, &out); // TODO: Epsilon is relatively large - t_assert(H3_EXPORT(pointDistRads)(&start, &out) < 0.01, + t_assert(H3_EXPORT(distanceRads)(&start, &out) < 0.01, "moved back to origin"); } - TEST(pointDistRads_wrappedLongitude) { + TEST(distanceRads_wrappedLongitude) { const LatLng negativeLongitude = {.lat = 0, .lng = -(M_PI + M_PI_2)}; const LatLng zero = {.lat = 0, .lng = 0}; - t_assert(fabs(M_PI_2 - H3_EXPORT(pointDistRads)(&negativeLongitude, + t_assert(fabs(M_PI_2 - H3_EXPORT(distanceRads)(&negativeLongitude, &zero)) < EPSILON_RAD, "Distance with wrapped longitude"); - t_assert(fabs(M_PI_2 - H3_EXPORT(pointDistRads)( + t_assert(fabs(M_PI_2 - H3_EXPORT(distanceRads)( &zero, &negativeLongitude)) < EPSILON_RAD, "Distance with wrapped longitude and swapped arguments"); } diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index 42c99ffb5..cac58bd3b 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -321,7 +321,7 @@ DECLSPEC double H3_EXPORT(radsToDegs)(double radians); * @{ */ /** @brief "great circle distance" between pairs of LatLng points in radians*/ -double H3_EXPORT(pointDistRads)(const LatLng *a, const LatLng *b); +double H3_EXPORT(distanceRads)(const LatLng *a, const LatLng *b); /** @brief "great circle distance" between pairs of LatLng points in * kilometers*/ diff --git a/src/h3lib/lib/latLng.c b/src/h3lib/lib/latLng.c index a87e68e0a..1db85fbbb 100644 --- a/src/h3lib/lib/latLng.c +++ b/src/h3lib/lib/latLng.c @@ -149,7 +149,7 @@ double constrainLng(double lng) { * * @return the great circle distance in radians between a and b */ -double H3_EXPORT(pointDistRads)(const LatLng *a, const LatLng *b) { +double H3_EXPORT(distanceRads)(const LatLng *a, const LatLng *b) { double sinLat = sin((b->lat - a->lat) / 2.0); double sinLng = sin((b->lng - a->lng) / 2.0); @@ -162,7 +162,7 @@ double H3_EXPORT(pointDistRads)(const LatLng *a, const LatLng *b) { * The great circle distance in kilometers between two spherical coordinates. */ double H3_EXPORT(pointDistKm)(const LatLng *a, const LatLng *b) { - return H3_EXPORT(pointDistRads)(a, b) * EARTH_RADIUS_KM; + return H3_EXPORT(distanceRads)(a, b) * EARTH_RADIUS_KM; } /** @@ -330,9 +330,9 @@ double triangleEdgeLengthsToArea(double a, double b, double c) { * @return area of triangle on unit sphere, in radians^2 */ double triangleArea(const LatLng *a, const LatLng *b, const LatLng *c) { - return triangleEdgeLengthsToArea(H3_EXPORT(pointDistRads)(a, b), - H3_EXPORT(pointDistRads)(b, c), - H3_EXPORT(pointDistRads)(c, a)); + return triangleEdgeLengthsToArea(H3_EXPORT(distanceRads)(a, b), + H3_EXPORT(distanceRads)(b, c), + H3_EXPORT(distanceRads)(c, a)); } /** @@ -391,7 +391,7 @@ double H3_EXPORT(exactEdgeLengthRads)(H3Index edge) { double length = 0.0; for (int i = 0; i < cb.numVerts - 1; i++) { - length += H3_EXPORT(pointDistRads)(&cb.verts[i], &cb.verts[i + 1]); + length += H3_EXPORT(distanceRads)(&cb.verts[i], &cb.verts[i + 1]); } return length; diff --git a/website/docs/api/misc.mdx b/website/docs/api/misc.mdx index b62727df9..1bf114c03 100644 --- a/website/docs/api/misc.mdx +++ b/website/docs/api/misc.mdx @@ -948,7 +948,7 @@ function example() { Gives the "great circle" or "haversine" distance between pairs of LatLng points (lat/lng pairs) in meters. -## pointDistRads +## distanceRads ```c -double pointDistRads(const LatLng *a, const LatLng *b); +double distanceRads(const LatLng *a, const LatLng *b); ``` From 6230bb448f61a00516d35ff0d1155f66569c986b Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 14:14:13 -0700 Subject: [PATCH 55/74] pointDistKm --- src/apps/testapps/testH3CellAreaExhaustive.c | 8 ++++---- src/h3lib/include/h3api.h.in | 2 +- src/h3lib/lib/bbox.c | 6 +++--- src/h3lib/lib/latLng.c | 4 ++-- website/docs/api/misc.mdx | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/apps/testapps/testH3CellAreaExhaustive.c b/src/apps/testapps/testH3CellAreaExhaustive.c index 07b96bfe1..e1b34c6d8 100644 --- a/src/apps/testapps/testH3CellAreaExhaustive.c +++ b/src/apps/testapps/testH3CellAreaExhaustive.c @@ -60,8 +60,8 @@ static void haversine_assert(H3Index edge) { t_assert(ab > 0, pos); t_assert(ab == ba, comm); - ab = H3_EXPORT(pointDistKm)(&a, &b); - ba = H3_EXPORT(pointDistKm)(&b, &a); + ab = H3_EXPORT(distanceKm)(&a, &b); + ba = H3_EXPORT(distanceKm)(&b, &a); t_assert(ab > 0, pos); t_assert(ab == ba, comm); @@ -70,9 +70,9 @@ static void haversine_assert(H3Index edge) { t_assert(ab > 0, pos); t_assert(ab == ba, comm); - t_assert(H3_EXPORT(pointDistKm)(&a, &b) > H3_EXPORT(distanceRads)(&a, &b), + t_assert(H3_EXPORT(distanceKm)(&a, &b) > H3_EXPORT(distanceRads)(&a, &b), "measurement in kilometers should be greater than in radians"); - t_assert(H3_EXPORT(pointDistM)(&a, &b) > H3_EXPORT(pointDistKm)(&a, &b), + t_assert(H3_EXPORT(pointDistM)(&a, &b) > H3_EXPORT(distanceKm)(&a, &b), "measurement in meters should be greater than in kilometers"); } diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index cac58bd3b..341d67370 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -325,7 +325,7 @@ double H3_EXPORT(distanceRads)(const LatLng *a, const LatLng *b); /** @brief "great circle distance" between pairs of LatLng points in * kilometers*/ -double H3_EXPORT(pointDistKm)(const LatLng *a, const LatLng *b); +double H3_EXPORT(distanceKm)(const LatLng *a, const LatLng *b); /** @brief "great circle distance" between pairs of LatLng points in meters*/ double H3_EXPORT(pointDistM)(const LatLng *a, const LatLng *b); diff --git a/src/h3lib/lib/bbox.c b/src/h3lib/lib/bbox.c index 00e6a331b..ebabc9c11 100644 --- a/src/h3lib/lib/bbox.c +++ b/src/h3lib/lib/bbox.c @@ -86,7 +86,7 @@ double _hexRadiusKm(H3Index h3Index) { CellBoundary h3Boundary; H3_EXPORT(cellToLatLng)(h3Index, &h3Center); H3_EXPORT(cellToBoundary)(h3Index, &h3Boundary); - return H3_EXPORT(pointDistKm)(&h3Center, h3Boundary.verts); + return H3_EXPORT(distanceKm)(&h3Center, h3Boundary.verts); } /** @@ -116,7 +116,7 @@ int bboxHexEstimate(const BBox* bbox, int res) { p1.lng = bbox->east; p2.lat = bbox->south; p2.lng = bbox->west; - double d = H3_EXPORT(pointDistKm)(&p1, &p2); + double d = H3_EXPORT(distanceKm)(&p1, &p2); // Derived constant based on: https://math.stackexchange.com/a/1921940 // Clamped to 3 as higher values tend to rapidly drag the estimate to zero. double a = d * d / fmin(3.0, fabs((p1.lng - p2.lng) / (p1.lat - p2.lat))); @@ -142,7 +142,7 @@ int lineHexEstimate(const LatLng* origin, const LatLng* destination, int res) { H3_EXPORT(getPentagons)(res, pentagons); double pentagonRadiusKm = _hexRadiusKm(pentagons[0]); - double dist = H3_EXPORT(pointDistKm)(origin, destination); + double dist = H3_EXPORT(distanceKm)(origin, destination); int estimate = (int)ceil(dist / (2 * pentagonRadiusKm)); if (estimate == 0) estimate = 1; return estimate; diff --git a/src/h3lib/lib/latLng.c b/src/h3lib/lib/latLng.c index 1db85fbbb..f903260a0 100644 --- a/src/h3lib/lib/latLng.c +++ b/src/h3lib/lib/latLng.c @@ -161,7 +161,7 @@ double H3_EXPORT(distanceRads)(const LatLng *a, const LatLng *b) { /** * The great circle distance in kilometers between two spherical coordinates. */ -double H3_EXPORT(pointDistKm)(const LatLng *a, const LatLng *b) { +double H3_EXPORT(distanceKm)(const LatLng *a, const LatLng *b) { return H3_EXPORT(distanceRads)(a, b) * EARTH_RADIUS_KM; } @@ -169,7 +169,7 @@ double H3_EXPORT(pointDistKm)(const LatLng *a, const LatLng *b) { * The great circle distance in meters between two spherical coordinates. */ double H3_EXPORT(pointDistM)(const LatLng *a, const LatLng *b) { - return H3_EXPORT(pointDistKm)(a, b) * 1000; + return H3_EXPORT(distanceKm)(a, b) * 1000; } /** diff --git a/website/docs/api/misc.mdx b/website/docs/api/misc.mdx index 1bf114c03..cedce6de4 100644 --- a/website/docs/api/misc.mdx +++ b/website/docs/api/misc.mdx @@ -842,7 +842,7 @@ This function exists for memory management and is not exposed. Number of pentagon H3 indexes per resolution. This is always 12, but provided as a convenience. -## pointDistKm +## distanceKm ```c -double pointDistKm(const LatLng *a, const LatLng *b); +double distanceKm(const LatLng *a, const LatLng *b); ``` From a6bfd720bc5ef18af3e55bd87348b63dc9a99e7b Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 14:14:47 -0700 Subject: [PATCH 56/74] pointDistM --- src/apps/testapps/testH3CellAreaExhaustive.c | 6 +++--- src/h3lib/include/h3api.h.in | 2 +- src/h3lib/lib/latLng.c | 2 +- website/docs/api/misc.mdx | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/apps/testapps/testH3CellAreaExhaustive.c b/src/apps/testapps/testH3CellAreaExhaustive.c index e1b34c6d8..342c7e45a 100644 --- a/src/apps/testapps/testH3CellAreaExhaustive.c +++ b/src/apps/testapps/testH3CellAreaExhaustive.c @@ -65,14 +65,14 @@ static void haversine_assert(H3Index edge) { t_assert(ab > 0, pos); t_assert(ab == ba, comm); - ab = H3_EXPORT(pointDistM)(&a, &b); - ba = H3_EXPORT(pointDistM)(&b, &a); + ab = H3_EXPORT(distanceM)(&a, &b); + ba = H3_EXPORT(distanceM)(&b, &a); t_assert(ab > 0, pos); t_assert(ab == ba, comm); t_assert(H3_EXPORT(distanceKm)(&a, &b) > H3_EXPORT(distanceRads)(&a, &b), "measurement in kilometers should be greater than in radians"); - t_assert(H3_EXPORT(pointDistM)(&a, &b) > H3_EXPORT(distanceKm)(&a, &b), + t_assert(H3_EXPORT(distanceM)(&a, &b) > H3_EXPORT(distanceKm)(&a, &b), "measurement in meters should be greater than in kilometers"); } diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index 341d67370..b68b337d6 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -328,7 +328,7 @@ double H3_EXPORT(distanceRads)(const LatLng *a, const LatLng *b); double H3_EXPORT(distanceKm)(const LatLng *a, const LatLng *b); /** @brief "great circle distance" between pairs of LatLng points in meters*/ -double H3_EXPORT(pointDistM)(const LatLng *a, const LatLng *b); +double H3_EXPORT(distanceM)(const LatLng *a, const LatLng *b); /** @} */ /** @defgroup getHexagonAreaAvg getHexagonAreaAvg diff --git a/src/h3lib/lib/latLng.c b/src/h3lib/lib/latLng.c index f903260a0..0589bd6d3 100644 --- a/src/h3lib/lib/latLng.c +++ b/src/h3lib/lib/latLng.c @@ -168,7 +168,7 @@ double H3_EXPORT(distanceKm)(const LatLng *a, const LatLng *b) { /** * The great circle distance in meters between two spherical coordinates. */ -double H3_EXPORT(pointDistM)(const LatLng *a, const LatLng *b) { +double H3_EXPORT(distanceM)(const LatLng *a, const LatLng *b) { return H3_EXPORT(distanceKm)(a, b) * 1000; } diff --git a/website/docs/api/misc.mdx b/website/docs/api/misc.mdx index cedce6de4..f9357c0fd 100644 --- a/website/docs/api/misc.mdx +++ b/website/docs/api/misc.mdx @@ -895,7 +895,7 @@ function example() { Gives the "great circle" or "haversine" distance between pairs of LatLng points (lat/lng pairs) in kilometers. -## pointDistM +## distanceM ```c -double pointDistM(const LatLng *a, const LatLng *b); +double distanceM(const LatLng *a, const LatLng *b); ``` From ffafe192495b57ce3f69c644fffea19643c22415 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 14:21:01 -0700 Subject: [PATCH 57/74] docs --- src/apps/testapps/testLatLng.c | 2 +- src/h3lib/include/h3api.h.in | 4 ++-- website/docs/api/misc.mdx | 24 ++++++++++++------------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/apps/testapps/testLatLng.c b/src/apps/testapps/testLatLng.c index 0332046fd..313fd2ca6 100644 --- a/src/apps/testapps/testLatLng.c +++ b/src/apps/testapps/testLatLng.c @@ -200,7 +200,7 @@ SUITE(latLng) { const LatLng zero = {.lat = 0, .lng = 0}; t_assert(fabs(M_PI_2 - H3_EXPORT(distanceRads)(&negativeLongitude, - &zero)) < EPSILON_RAD, + &zero)) < EPSILON_RAD, "Distance with wrapped longitude"); t_assert(fabs(M_PI_2 - H3_EXPORT(distanceRads)( &zero, &negativeLongitude)) < EPSILON_RAD, diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index b68b337d6..78f7f6c35 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -316,8 +316,8 @@ DECLSPEC double H3_EXPORT(degsToRads)(double degrees); DECLSPEC double H3_EXPORT(radsToDegs)(double radians); /** @} */ -/** @defgroup pointDist pointDist - * Functions for pointDist +/** @defgroup distance distance + * Functions for distance * @{ */ /** @brief "great circle distance" between pairs of LatLng points in radians*/ diff --git a/website/docs/api/misc.mdx b/website/docs/api/misc.mdx index f9357c0fd..fe7a78937 100644 --- a/website/docs/api/misc.mdx +++ b/website/docs/api/misc.mdx @@ -864,28 +864,28 @@ double distanceKm(const LatLng *a, const LatLng *b); ```py -h3.point_dist(point1, point2, unit='km') +h3.distance(point1, point2, unit='km') ``` ```java -double pointDist(LatLng point1, LatLng point2, LengthUnit unit); +double distance(LatLng point1, LatLng point2, LengthUnit unit); ``` ```js -h3.pointDist(point1, point2, h3.UNITS.km) +h3.distance(point1, point2, h3.UNITS.km) ``` ```js live function example() { const point1 = [-10, 0]; const point2 = [10, 0]; - return h3.pointDist(point1, point2, h3.UNITS.km) + return h3.distance(point1, point2, h3.UNITS.km) } ``` @@ -917,28 +917,28 @@ double distanceM(const LatLng *a, const LatLng *b); ```py -h3.point_dist(point1, point2, unit='m') +h3.distance(point1, point2, unit='m') ``` ```java -double pointDist(LatLng point1, LatLng point2, LengthUnit unit); +double distance(LatLng point1, LatLng point2, LengthUnit unit); ``` ```js -h3.pointDist(point1, point2, h3.UNITS.m) +h3.distance(point1, point2, h3.UNITS.m) ``` ```js live function example() { const point1 = [-10, 0]; const point2 = [10, 0]; - return h3.pointDist(point1, point2, h3.UNITS.m) + return h3.distance(point1, point2, h3.UNITS.m) } ``` @@ -970,28 +970,28 @@ double distanceRads(const LatLng *a, const LatLng *b); ```py -h3.point_dist(point1, point2, unit='rads') +h3.distance(point1, point2, unit='rads') ``` ```java -double pointDist(LatLng point1, LatLng point2, LengthUnit unit); +double distance(LatLng point1, LatLng point2, LengthUnit unit); ``` ```js -h3.pointDist(point1, point2, h3.UNITS.rads) +h3.distance(point1, point2, h3.UNITS.rads) ``` ```js live function example() { const point1 = [-10, 0]; const point2 = [10, 0]; - return h3.pointDist(point1, point2, h3.UNITS.rads) + return h3.distance(point1, point2, h3.UNITS.rads) } ``` From 6dee8b9bde7a7930ef21e047822985c04da9c7f7 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 14:29:55 -0700 Subject: [PATCH 58/74] filter names --- website/docs/core-library/filters.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/website/docs/core-library/filters.md b/website/docs/core-library/filters.md index e6f3877ed..259e46f6f 100644 --- a/website/docs/core-library/filters.md +++ b/website/docs/core-library/filters.md @@ -12,14 +12,14 @@ Filters are experimental and are not part of the semantic version of the H3 libr All latitude/longitude coordinates are in decimal degrees. See the [H3 Index Representations](/docs/core-library/h3indexing) page for information on the integer `H3Index`. -| filter | input | outputs -| ---------------- | --------- | ------- -| `geoToH3` | lat/lng | `H3Index` -| `h3ToGeo` | `H3Index` | cell center point in lat/lng -| `h3ToGeoBoundary`| `H3Index` | cell boundary in lat/lng -| `h3ToComponents` | `H3Index` | components -| `kRing` | `H3Index` | surrounding `H3Index` -| `hexRange` | `H3Index` | surrounding `H3Index`, in order +| filter | input | outputs | +|------------------|-----------|---------------------------------| +| `latLngToCell` | lat/lng | `H3Index` | +| `cellToLatLng` | `H3Index` | cell center point in lat/lng | +| `cellToBoundary` | `H3Index` | cell boundary in lat/lng | +| `h3ToComponents` | `H3Index` | components | +| `gridDisk` | `H3Index` | surrounding `H3Index` | +| `gridDiskUnsafe` | `H3Index` | surrounding `H3Index`, in order | Unix Command Line Examples --- From 7dae21f40d4e974dcd83f11f2c8df454dbb6ee85 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 14:35:38 -0700 Subject: [PATCH 59/74] latLngToCell in docs in a few more places --- README.md | 2 +- dev-docs/RFCs/v4.0.0/error-handling-rfc.md | 28 +++++++++++----------- src/apps/testapps/testCellToLatLng.c | 2 +- src/h3lib/include/h3api.h.in | 2 +- website/docs/core-library/filters.md | 2 +- website/docs/core-library/geoToH3desc.md | 6 ++--- website/docs/installation.mdx | 2 +- website/docs/library/errors.md | 2 +- website/docs/quickstart.md | 2 +- website/sidebars.js | 2 +- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 93f766d09..51d58e0cb 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ To build the documentation website, see the [website/](./website/) directory. To get the H3 index for some location: ``` -./bin/geoToH3 --resolution 10 --latitude 40.689167 --longitude -74.044444 +./bin/latLngToCell --resolution 10 --latitude 40.689167 --longitude -74.044444 ``` 10 is the H3 resolution, between 0 (coarsest) and 15 (finest). The coordinates entered are the latitude and longitude, in degrees, you want the index for (these coordinates are the Statue of Liberty). You should get an H3 index as output, like `8a2a1072b59ffff`. diff --git a/dev-docs/RFCs/v4.0.0/error-handling-rfc.md b/dev-docs/RFCs/v4.0.0/error-handling-rfc.md index 103a5f408..85a22c6f4 100644 --- a/dev-docs/RFCs/v4.0.0/error-handling-rfc.md +++ b/dev-docs/RFCs/v4.0.0/error-handling-rfc.md @@ -43,7 +43,7 @@ Sample: H3Error err; H3Index result; -err = geoToH3(lat, lng, res, &result); +err = latLngToCell(lat, lng, res, &result); if (err) { fprintf(stderr, "Error: %d", err); } @@ -53,7 +53,7 @@ Sample with errors discarded: ``` H3Index result; -geoToH3(lat, lng, res, &result); +latLngToCell(lat, lng, res, &result); ``` Placing error information in the return of function calls requires that functions return two pieces of information - the error status, and the requested data. This approach does make it clear that a status code is returned and that may make it more usual that a consumer of the API does check the error status. @@ -65,7 +65,7 @@ Sample: H3Error err; H3Index result; -err = geoToH3(lat, lng, res, &result); +err = latLngToCell(lat, lng, res, &result); if (err) { fprintf(stderr, "Error: %d", err); } @@ -75,7 +75,7 @@ Sample with errors discarded: ``` H3Index result; -result = unsafe_geoToH3(lat, lng, res); +result = unsafe_latLngToCell(lat, lng, res); ``` This approach is the same as using return codes, but offers an "unsafe" version of some functions where there is less or no error information returned. This is intended to be used in performance critical cases where the inputs are known to be suitable ahead of time, or the caller would not do anything with the error information anyways. @@ -87,7 +87,7 @@ Sample: H3Error err; H3Index result; -err = geoToH3(lat, lng, res, &result); +err = latLngToCell(lat, lng, res, &result); if (err) { const char* msg = h3GetError(); fprintf(stderr, "Error: %d (%s)", err, msg); @@ -105,7 +105,7 @@ Sample: H3Error err; H3Index result; -result = geoToH3(lat, lng, res); +result = latLngToCell(lat, lng, res); if (err = h3GetError()) { fprintf(stderr, "Error: %d", err); } @@ -115,7 +115,7 @@ Sample with errors discarded: ``` H3Index result; -result = geoToH3(lat, lng, res); +result = latLngToCell(lat, lng, res); ``` In this approach, the data requested is returned from the function, and the consumer is responsible for knowing when to check for errors, and how to handle them. There are a few drawbacks: @@ -131,7 +131,7 @@ Sample: H3Error err; H3Index result; -result = geoToH3(lat, lng, res, &err); +result = latLngToCell(lat, lng, res, &err); if (err) { fprintf(stderr, "Error: %d", err); } @@ -140,7 +140,7 @@ if (err) { Sample with errors discarded: ``` H3Index result; -result = geoToH3(lat, lng, res, NULL); +result = latLngToCell(lat, lng, res, NULL); ``` This is an inversion of the return code approach, where the error status is the reference parameter. This offers an advantage that a caller could choose to disregard the error status (for example by passing NULL) @@ -156,7 +156,7 @@ int err; if (err = setjmp(env)) { fprintf(stderr, "Error: %d", err); } else { - result = geoToH3(lat, lng, res, env); + result = latLngToCell(lat, lng, res, env); } ``` @@ -176,9 +176,9 @@ It would be good to use a single pattern for error handling, so that callers do It is proposed that errors will be indicated by the return code of the function. Any public function that can return an error (for example, due to domain issues in its input) will return an error code. -The signature for `geoToH3` will look like: +The signature for `latLngToCell` will look like: ``` -H3Error geoToH3(double lat, double lng, int res, H3Index *result); +H3Error latLngToCell(double lat, double lng, int res, H3Index *result); ``` ### Is Valid Functions @@ -260,8 +260,8 @@ The H3 library may always add additional error messages. Error messages not reco #### Example error code results ``` -geoToH3(lat=Infinity, lng=0, res=0, &out) => E_LATLNG_DOMAIN -geoToH3(lat=0, lat=0, res=-1, &out) => E_RES_DOMAIN +latLngToCell(lat=Infinity, lng=0, res=0, &out) => E_LATLNG_DOMAIN +latLngToCell(lat=0, lat=0, res=-1, &out) => E_RES_DOMAIN h3ToGeo(index=0, &out) => E_CELL_INVALID h3IsResClassIII(index=RES_0_INDEX, &out) => E_SUCCESS h3IsResClassIII(index=RES_1_INDEX, &out) => E_SUCCESS diff --git a/src/apps/testapps/testCellToLatLng.c b/src/apps/testapps/testCellToLatLng.c index c64328ecc..571ae020d 100644 --- a/src/apps/testapps/testCellToLatLng.c +++ b/src/apps/testapps/testCellToLatLng.c @@ -46,7 +46,7 @@ void assertExpected(H3Index h1, const LatLng* g1) { int res = H3_EXPORT(getResolution)(h1); H3Index h2; t_assertSuccess(H3_EXPORT(latLngToCell)(&g2, res, &h2)); - t_assert(h1 == h2, "got expected geoToH3 output"); + t_assert(h1 == h2, "got expected latLngToCell output"); } int main(int argc, char* argv[]) { diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index 78f7f6c35..2702e2525 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -69,7 +69,7 @@ extern "C" { typedef uint64_t H3Index; /** - * Invalid index used to indicate an error from geoToH3 and related functions + * Invalid index used to indicate an error from latLngToCell and related functions * or missing data in arrays of H3 indices. Analogous to NaN in floating point. */ #define H3_NULL 0 diff --git a/website/docs/core-library/filters.md b/website/docs/core-library/filters.md index 259e46f6f..d219f19e7 100644 --- a/website/docs/core-library/filters.md +++ b/website/docs/core-library/filters.md @@ -26,7 +26,7 @@ Unix Command Line Examples * find the index for coordinates at resolution 5 - `geoToH3 --resolution 5 --latitude 40.689167 --longitude -74.044444` + `latLngToCell --resolution 5 --latitude 40.689167 --longitude -74.044444` * output the cell center point for `H3Index` 845ad1bffffffff diff --git a/website/docs/core-library/geoToH3desc.md b/website/docs/core-library/geoToH3desc.md index 25c4cf5d0..570653c8e 100644 --- a/website/docs/core-library/geoToH3desc.md +++ b/website/docs/core-library/geoToH3desc.md @@ -1,11 +1,11 @@ --- -id: geoToH3desc +id: latLngToCelldesc title: Conversion from latitude/longitude to containing H3 cell index sidebar_label: Conversion from latitude/longitude to containing H3 cell index -slug: /core-library/geoToH3desc +slug: /core-library/latLngToCelldesc --- -This operation is performed by function `geoToH3`. See the comments in the function for more detail. +This operation is performed by function `latLngToCell`. See the comments in the function for more detail. The conversion is performed as a series of coordinate system conversions described below. See the page [Coordinate Systems used by the H3 Core Library](/docs/core-library/coordsystems) for more information on each of these coordinate systems. diff --git a/website/docs/installation.mdx b/website/docs/installation.mdx index 6a96a3566..35744520c 100644 --- a/website/docs/installation.mdx +++ b/website/docs/installation.mdx @@ -182,5 +182,5 @@ ctest By default, the filter applications are built when you build H3. You can confirm they are working by running: ``` -./bin/geoToH3 --lat 14 --lng -42 --resolution 2 +./bin/latLngToCell --lat 14 --lng -42 --resolution 2 ``` diff --git a/website/docs/library/errors.md b/website/docs/library/errors.md index 07e19fb06..4b5afdc9e 100644 --- a/website/docs/library/errors.md +++ b/website/docs/library/errors.md @@ -17,7 +17,7 @@ This code example checks for an error when calling an H3 function and prints a m H3Error err; H3Index result; -err = geoToH3(lat, lng, res, &result); +err = latLngToCell(lat, lng, res, &result); if (err) { fprintf(stderr, "Error: %d", err); } diff --git a/website/docs/quickstart.md b/website/docs/quickstart.md index 9258ca94d..16f215214 100644 --- a/website/docs/quickstart.md +++ b/website/docs/quickstart.md @@ -18,7 +18,7 @@ function example() { const lat = 37.7955; const lng = -122.3937; const res = 10; - return h3.geoToH3(lat, lng, res); + return h3.latLngToCell(lat, lng, res); } ``` diff --git a/website/sidebars.js b/website/sidebars.js index 9db0fecfa..5d5086eb1 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -68,7 +68,7 @@ module.exports = { type: "category", label: "Algorithms", items: [ - "core-library/geoToH3desc", + "core-library/latLngToCelldesc", "core-library/h3ToGeoDesc", "core-library/h3ToGeoBoundaryDesc", ], From 2fcbe64c753e227357edfe66bf0d9fb68a7b68c3 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 14:37:26 -0700 Subject: [PATCH 60/74] docs filenames for latLngToCell --- .../docs/core-library/{geoToH3desc.md => latLngToCellDesc.md} | 0 website/versioned_sidebars/version-3.x-sidebars.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename website/docs/core-library/{geoToH3desc.md => latLngToCellDesc.md} (100%) diff --git a/website/docs/core-library/geoToH3desc.md b/website/docs/core-library/latLngToCellDesc.md similarity index 100% rename from website/docs/core-library/geoToH3desc.md rename to website/docs/core-library/latLngToCellDesc.md diff --git a/website/versioned_sidebars/version-3.x-sidebars.json b/website/versioned_sidebars/version-3.x-sidebars.json index 153336813..5c688d376 100644 --- a/website/versioned_sidebars/version-3.x-sidebars.json +++ b/website/versioned_sidebars/version-3.x-sidebars.json @@ -175,7 +175,7 @@ "items": [ { "type": "doc", - "id": "version-3.x/core-library/geoToH3desc" + "id": "version-3.x/core-library/geoToH3Desc" }, { "type": "doc", From 1d49bb720e37764c69bad5493c059ca531becd42 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 14:42:28 -0700 Subject: [PATCH 61/74] h3ToGeoBoundary to cellToBoundary --- README.md | 2 +- .../{h3ToGeoBoundaryDesc.md => cellToBoundaryDesc.md} | 6 +++--- website/docs/core-library/filters.md | 4 ++-- website/docs/quickstart.md | 2 +- website/sidebars.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) rename website/docs/core-library/{h3ToGeoBoundaryDesc.md => cellToBoundaryDesc.md} (89%) diff --git a/README.md b/README.md index 51d58e0cb..d86beee1f 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,7 @@ To get the H3 index for some location: You can then take this index and get some information about it, for example: ``` -./bin/h3ToGeoBoundary --index 8a2a1072b59ffff +./bin/cellToBoundary --index 8a2a1072b59ffff ``` This will produce the vertices of the hexagon at this location: diff --git a/website/docs/core-library/h3ToGeoBoundaryDesc.md b/website/docs/core-library/cellToBoundaryDesc.md similarity index 89% rename from website/docs/core-library/h3ToGeoBoundaryDesc.md rename to website/docs/core-library/cellToBoundaryDesc.md index 6bffaae9d..ad795ae2d 100644 --- a/website/docs/core-library/h3ToGeoBoundaryDesc.md +++ b/website/docs/core-library/cellToBoundaryDesc.md @@ -1,11 +1,11 @@ --- -id: h3ToGeoBoundaryDesc +id: cellToBoundaryDesc title: Generate the cell boundary in latitude/longitude coordinates of an H3Index cell sidebar_label: Generate the cell boundary in latitude/longitude coordinates of an H3Index cell -slug: /core-library/h3ToGeoBoundaryDesc +slug: /core-library/cellToBoundaryDesc --- -This operation is performed by function `h3ToGeoBoundary`. See the comments in the function source code for more detail. +This operation is performed by function `cellToBoundary`. See the comments in the function source code for more detail. The conversion is performed as a series of coordinate system conversions described below. See the page [Coordinate Systems used by the H3 Core Library](/docs/core-library/coordsystems) for more information on each of these coordinate systems. diff --git a/website/docs/core-library/filters.md b/website/docs/core-library/filters.md index d219f19e7..cfccfbec0 100644 --- a/website/docs/core-library/filters.md +++ b/website/docs/core-library/filters.md @@ -34,7 +34,7 @@ Unix Command Line Examples * output the cell boundary for `H3Index` 845ad1bffffffff - `h3ToGeoBoundary --index 845ad1bffffffff` + `cellToBoundary --index 845ad1bffffffff` * find the components for the `H3Index` 845ad1bffffffff @@ -48,4 +48,4 @@ Unix Command Line Examples `hexRange -k 2 --origin 845ad1bffffffff` -Note that the filters `h3ToGeo` and `h3ToGeoBoundary` take optional arguments that allow them to generate `kml` output. See the header comments in the corresponding source code files for details. +Note that the filters `h3ToGeo` and `cellToBoundary` take optional arguments that allow them to generate `kml` output. See the header comments in the corresponding source code files for details. diff --git a/website/docs/quickstart.md b/website/docs/quickstart.md index 16f215214..ec249465c 100644 --- a/website/docs/quickstart.md +++ b/website/docs/quickstart.md @@ -36,6 +36,6 @@ Note that the result of this example is not our original coordinates. That's bec ```js live function example() { const h = '8a283082a677fff'; - return h3.h3ToGeoBoundary(h); + return h3.cellToBoundary(h); } ``` diff --git a/website/sidebars.js b/website/sidebars.js index 5d5086eb1..e8bbb55dd 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -70,7 +70,7 @@ module.exports = { items: [ "core-library/latLngToCelldesc", "core-library/h3ToGeoDesc", - "core-library/h3ToGeoBoundaryDesc", + "core-library/cellToBoundaryDesc", ], }, ], From 4781fe4fa873c2beebbe68f487369af1eff20a2f Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 14:44:55 -0700 Subject: [PATCH 62/74] h3ToGeoDesc --- website/docs/core-library/cellToBoundaryDesc.md | 2 +- website/docs/core-library/h3ToGeoDesc.md | 4 ++-- website/sidebars.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/website/docs/core-library/cellToBoundaryDesc.md b/website/docs/core-library/cellToBoundaryDesc.md index ad795ae2d..58d7433c3 100644 --- a/website/docs/core-library/cellToBoundaryDesc.md +++ b/website/docs/core-library/cellToBoundaryDesc.md @@ -15,5 +15,5 @@ The conversion is performed as a series of coordinate system conversions describ -* The function `_faceIjkToGeoBoundary` calculates the *ijk* coordinates of the cell center point in the appropriate substrate grid (determined in the last step), and each of the substrate vertices is translated using the cell center point *ijk*. Each vertex *ijk* is then transformed onto the appropriate face and *Hex2d* coordinate system using the approach taken in [finding a cell center point](/docs/core-library/h3ToGeoDesc). If adjacent vertices lie on different icosahedron faces a point is introduced at the intersection of the cell edge and icosahedron face edge. +* The function `_faceIjkToGeoBoundary` calculates the *ijk* coordinates of the cell center point in the appropriate substrate grid (determined in the last step), and each of the substrate vertices is translated using the cell center point *ijk*. Each vertex *ijk* is then transformed onto the appropriate face and *Hex2d* coordinate system using the approach taken in [finding a cell center point](/docs/core-library/cellToLatLngDesc). If adjacent vertices lie on different icosahedron faces a point is introduced at the intersection of the cell edge and icosahedron face edge. * The *Hex2d* coordinates are then converted to latitude/longitude using `_hex2dToGeo`. diff --git a/website/docs/core-library/h3ToGeoDesc.md b/website/docs/core-library/h3ToGeoDesc.md index 7ec24e550..12f7dbc5f 100644 --- a/website/docs/core-library/h3ToGeoDesc.md +++ b/website/docs/core-library/h3ToGeoDesc.md @@ -1,8 +1,8 @@ --- -id: h3ToGeoDesc +id: cellToLatLngDesc title: Determine the latitude/longitude coordinates of the center point of an H3Index cell sidebar_label: Determine the latitude/longitude coordinates of the center point of an H3Index cell -slug: /core-library/h3ToGeoDesc +slug: /core-library/cellToLatLngDesc --- This operation is performed by function `h3ToGeo`. See the comments in the function source code for more detail. diff --git a/website/sidebars.js b/website/sidebars.js index e8bbb55dd..184bf6647 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -69,7 +69,7 @@ module.exports = { label: "Algorithms", items: [ "core-library/latLngToCelldesc", - "core-library/h3ToGeoDesc", + "core-library/cellToLatLngDesc", "core-library/cellToBoundaryDesc", ], }, From 4b647e3a119978cb13933a1656780da9ec72e8b3 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 14:45:58 -0700 Subject: [PATCH 63/74] h3ToGeoDesc.md to cellToLatLngDesc.md --- website/docs/core-library/{h3ToGeoDesc.md => cellToLatLngDesc.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename website/docs/core-library/{h3ToGeoDesc.md => cellToLatLngDesc.md} (100%) diff --git a/website/docs/core-library/h3ToGeoDesc.md b/website/docs/core-library/cellToLatLngDesc.md similarity index 100% rename from website/docs/core-library/h3ToGeoDesc.md rename to website/docs/core-library/cellToLatLngDesc.md From ada5322a528b0230da8ef6b5529ec76035ae4258 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 14:47:00 -0700 Subject: [PATCH 64/74] formatting --- src/h3lib/include/h3api.h.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/h3lib/include/h3api.h.in b/src/h3lib/include/h3api.h.in index 2702e2525..097682d77 100644 --- a/src/h3lib/include/h3api.h.in +++ b/src/h3lib/include/h3api.h.in @@ -69,8 +69,9 @@ extern "C" { typedef uint64_t H3Index; /** - * Invalid index used to indicate an error from latLngToCell and related functions - * or missing data in arrays of H3 indices. Analogous to NaN in floating point. + * Invalid index used to indicate an error from latLngToCell and related + * functions or missing data in arrays of H3 indices. Analogous to NaN in + * floating point. */ #define H3_NULL 0 From ea97ff22e9b4ea83ce6e42693fd17e062f506a58 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 15:03:57 -0700 Subject: [PATCH 65/74] h3ToGeo in a few more places --- README.md | 2 +- dev-docs/RFCs/v4.0.0/error-handling-rfc.md | 2 +- src/apps/testapps/testH3Api.c | 2 +- website/docs/core-library/cellToLatLngDesc.md | 2 +- website/docs/core-library/filters.md | 4 ++-- website/docs/quickstart.md | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d86beee1f..fba470d1b 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,7 @@ This will produce the vertices of the hexagon at this location: You can get the center coordinate of the hexagon like so: ``` -./bin/h3ToGeo --index 8a2a1072b59ffff +./bin/cellToLatLng --index 8a2a1072b59ffff ``` This will produce some coordinate: diff --git a/dev-docs/RFCs/v4.0.0/error-handling-rfc.md b/dev-docs/RFCs/v4.0.0/error-handling-rfc.md index 85a22c6f4..1a771b011 100644 --- a/dev-docs/RFCs/v4.0.0/error-handling-rfc.md +++ b/dev-docs/RFCs/v4.0.0/error-handling-rfc.md @@ -262,7 +262,7 @@ The H3 library may always add additional error messages. Error messages not reco ``` latLngToCell(lat=Infinity, lng=0, res=0, &out) => E_LATLNG_DOMAIN latLngToCell(lat=0, lat=0, res=-1, &out) => E_RES_DOMAIN -h3ToGeo(index=0, &out) => E_CELL_INVALID +cellToLatLng(index=0, &out) => E_CELL_INVALID h3IsResClassIII(index=RES_0_INDEX, &out) => E_SUCCESS h3IsResClassIII(index=RES_1_INDEX, &out) => E_SUCCESS h3IsResClassIII(index=0, &out) => E_CELL_INVALID diff --git a/src/apps/testapps/testH3Api.c b/src/apps/testapps/testH3Api.c index afa6ab920..ab12886ac 100644 --- a/src/apps/testapps/testH3Api.c +++ b/src/apps/testapps/testH3Api.c @@ -112,7 +112,7 @@ SUITE(h3Api) { "cellToBoundary fails on invalid index"); } - TEST(h3ToGeoInvalid) { + TEST(cellToLatLngInvalid) { LatLng coord; H3_EXPORT(cellToLatLng)(0x7fffffffffffffff, &coord); // Test is this should not crash (should return an error in the future) diff --git a/website/docs/core-library/cellToLatLngDesc.md b/website/docs/core-library/cellToLatLngDesc.md index 12f7dbc5f..f35feaae7 100644 --- a/website/docs/core-library/cellToLatLngDesc.md +++ b/website/docs/core-library/cellToLatLngDesc.md @@ -5,7 +5,7 @@ sidebar_label: Determine the latitude/longitude coordinates of the center point slug: /core-library/cellToLatLngDesc --- -This operation is performed by function `h3ToGeo`. See the comments in the function source code for more detail. +This operation is performed by function `cellToLatLng`. See the comments in the function source code for more detail. The conversion is performed as a series of coordinate system conversions described below. See the page [Coordinate Systems used by the H3 Core Library](/docs/core-library/coordsystems) for more information on each of these coordinate systems. diff --git a/website/docs/core-library/filters.md b/website/docs/core-library/filters.md index cfccfbec0..33915f656 100644 --- a/website/docs/core-library/filters.md +++ b/website/docs/core-library/filters.md @@ -30,7 +30,7 @@ Unix Command Line Examples * output the cell center point for `H3Index` 845ad1bffffffff - `h3ToGeo --index 845ad1bffffffff` + `cellToLatLng --index 845ad1bffffffff` * output the cell boundary for `H3Index` 845ad1bffffffff @@ -48,4 +48,4 @@ Unix Command Line Examples `hexRange -k 2 --origin 845ad1bffffffff` -Note that the filters `h3ToGeo` and `cellToBoundary` take optional arguments that allow them to generate `kml` output. See the header comments in the corresponding source code files for details. +Note that the filters `cellToLatLng` and `cellToBoundary` take optional arguments that allow them to generate `kml` output. See the header comments in the corresponding source code files for details. diff --git a/website/docs/quickstart.md b/website/docs/quickstart.md index ec249465c..00d0ed9e2 100644 --- a/website/docs/quickstart.md +++ b/website/docs/quickstart.md @@ -27,7 +27,7 @@ The result is the identifier of the hexagonal cell in H3 containing this point. ```js live function example() { const h = '8a283082a677fff'; - return h3.h3ToGeo(h); + return h3.cellToLatLng(h); } ``` From 25cb2c3bd678e387d9f7d1fa658229efcd6b3fc4 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 15:16:36 -0700 Subject: [PATCH 66/74] can't change the "js live" examples before the JS bindings update --- website/docs/quickstart.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/quickstart.md b/website/docs/quickstart.md index 00d0ed9e2..9258ca94d 100644 --- a/website/docs/quickstart.md +++ b/website/docs/quickstart.md @@ -18,7 +18,7 @@ function example() { const lat = 37.7955; const lng = -122.3937; const res = 10; - return h3.latLngToCell(lat, lng, res); + return h3.geoToH3(lat, lng, res); } ``` @@ -27,7 +27,7 @@ The result is the identifier of the hexagonal cell in H3 containing this point. ```js live function example() { const h = '8a283082a677fff'; - return h3.cellToLatLng(h); + return h3.h3ToGeo(h); } ``` @@ -36,6 +36,6 @@ Note that the result of this example is not our original coordinates. That's bec ```js live function example() { const h = '8a283082a677fff'; - return h3.cellToBoundary(h); + return h3.h3ToGeoBoundary(h); } ``` From c77992013777f3b34ad7932ed99b6373d19860d7 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 15:26:45 -0700 Subject: [PATCH 67/74] D -> d in version-3.x sidebards --- website/versioned_sidebars/version-3.x-sidebars.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/versioned_sidebars/version-3.x-sidebars.json b/website/versioned_sidebars/version-3.x-sidebars.json index 5c688d376..153336813 100644 --- a/website/versioned_sidebars/version-3.x-sidebars.json +++ b/website/versioned_sidebars/version-3.x-sidebars.json @@ -175,7 +175,7 @@ "items": [ { "type": "doc", - "id": "version-3.x/core-library/geoToH3Desc" + "id": "version-3.x/core-library/geoToH3desc" }, { "type": "doc", From e2a0008bea4570dddb4768f2734fe18956a345bb Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 15:41:06 -0700 Subject: [PATCH 68/74] relative path seems to fix `Error: Docusaurus found broken links!` --- website/docs/core-library/cellToBoundaryDesc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/core-library/cellToBoundaryDesc.md b/website/docs/core-library/cellToBoundaryDesc.md index 58d7433c3..e5ef83b01 100644 --- a/website/docs/core-library/cellToBoundaryDesc.md +++ b/website/docs/core-library/cellToBoundaryDesc.md @@ -15,5 +15,5 @@ The conversion is performed as a series of coordinate system conversions describ -* The function `_faceIjkToGeoBoundary` calculates the *ijk* coordinates of the cell center point in the appropriate substrate grid (determined in the last step), and each of the substrate vertices is translated using the cell center point *ijk*. Each vertex *ijk* is then transformed onto the appropriate face and *Hex2d* coordinate system using the approach taken in [finding a cell center point](/docs/core-library/cellToLatLngDesc). If adjacent vertices lie on different icosahedron faces a point is introduced at the intersection of the cell edge and icosahedron face edge. +* The function `_faceIjkToGeoBoundary` calculates the *ijk* coordinates of the cell center point in the appropriate substrate grid (determined in the last step), and each of the substrate vertices is translated using the cell center point *ijk*. Each vertex *ijk* is then transformed onto the appropriate face and *Hex2d* coordinate system using the approach taken in [finding a cell center point](./cellToLatLngDesc). If adjacent vertices lie on different icosahedron faces a point is introduced at the intersection of the cell edge and icosahedron face edge. * The *Hex2d* coordinates are then converted to latitude/longitude using `_hex2dToGeo`. From 19f80559aa0995ed3a71c4be9874fe8a296b1c76 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 15:44:33 -0700 Subject: [PATCH 69/74] Revert "can't change the "js live" examples before the JS bindings update" This reverts commit 25cb2c3bd678e387d9f7d1fa658229efcd6b3fc4. --- website/docs/quickstart.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/quickstart.md b/website/docs/quickstart.md index 9258ca94d..00d0ed9e2 100644 --- a/website/docs/quickstart.md +++ b/website/docs/quickstart.md @@ -18,7 +18,7 @@ function example() { const lat = 37.7955; const lng = -122.3937; const res = 10; - return h3.geoToH3(lat, lng, res); + return h3.latLngToCell(lat, lng, res); } ``` @@ -27,7 +27,7 @@ The result is the identifier of the hexagonal cell in H3 containing this point. ```js live function example() { const h = '8a283082a677fff'; - return h3.h3ToGeo(h); + return h3.cellToLatLng(h); } ``` @@ -36,6 +36,6 @@ Note that the result of this example is not our original coordinates. That's bec ```js live function example() { const h = '8a283082a677fff'; - return h3.h3ToGeoBoundary(h); + return h3.cellToBoundary(h); } ``` From 5c9a752a36e743059d204cca2b9bebf764ea96a0 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Sun, 30 May 2021 16:26:45 -0700 Subject: [PATCH 70/74] notes on cleaning up the website --- website/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/website/README.md b/website/README.md index 836c31678..9144fef29 100644 --- a/website/README.md +++ b/website/README.md @@ -18,6 +18,13 @@ yarn start You will then be able to open http://localhost:3000 in your browser. +To clean any generated files, you can run: + +``` +yarn clear +rm -rf node_modules +``` + ## Updating the H3 Website Deployment is done via [Docusaurus](https://docusaurus.io/docs/deployment#deploy). You will need From 19a95670ccd8b7caed236035cfe74b3422f5fd25 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Thu, 3 Jun 2021 17:43:34 -0700 Subject: [PATCH 71/74] outputLngLatKML --- src/apps/applib/include/kml.h | 2 +- src/apps/applib/lib/kml.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/apps/applib/include/kml.h b/src/apps/applib/include/kml.h index 0adc7aa1f..715c8bb21 100644 --- a/src/apps/applib/include/kml.h +++ b/src/apps/applib/include/kml.h @@ -31,7 +31,7 @@ void kmlPtsFooter(void); void kmlBoundaryFooter(void); // output KML individual points or polygons -void outputLatLngKML(const LatLng* g); +void outputLngLatKML(const LatLng* g); void outputPointKML(const LatLng* g, const char* name); void outputTriKML(const LatLng* v1, const LatLng* v2, const LatLng* v3, const char* name); diff --git a/src/apps/applib/lib/kml.c b/src/apps/applib/lib/kml.c index e8e46434c..a403b24cf 100644 --- a/src/apps/applib/lib/kml.c +++ b/src/apps/applib/lib/kml.c @@ -107,7 +107,7 @@ void kmlBoundaryFooter(void) { printf("\n"); } -void outputLatLngKML(const LatLng* g) { +void outputLngLatKML(const LatLng* g) { printf(" %8lf,%8lf,5.0\n", H3_EXPORT(radsToDegs)(g->lng), H3_EXPORT(radsToDegs)(g->lat)); } @@ -119,7 +119,7 @@ void outputPointKML(const LatLng* g, const char* name) { printf(" \n"); printf(" relativeToGround\n"); printf(" \n"); - outputLatLngKML(g); + outputLngLatKML(g); printf(" \n"); printf(" \n"); printf("\n"); @@ -133,10 +133,10 @@ void outputTriKML(const LatLng* v1, const LatLng* v2, const LatLng* v3, printf(" \n"); printf(" 1\n"); printf(" \n"); - outputLatLngKML(v1); - outputLatLngKML(v2); - outputLatLngKML(v3); - outputLatLngKML(v1); + outputLngLatKML(v1); + outputLngLatKML(v2); + outputLngLatKML(v3); + outputLngLatKML(v1); printf(" \n"); printf(" \n"); printf("\n"); @@ -155,8 +155,8 @@ void outputPolyKML(const LatLng geoVerts[], int numVerts, const char* name) { printf(" 1\n"); printf(" \n"); - for (int v = 0; v < numVerts; v++) outputLatLngKML(&geoVerts[v]); - outputLatLngKML(&geoVerts[0]); + for (int v = 0; v < numVerts; v++) outputLngLatKML(&geoVerts[v]); + outputLngLatKML(&geoVerts[0]); printf(" \n"); printf(" \n"); From f55640417c390e199e1fdaffb1d28a107a9d8e33 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Thu, 3 Jun 2021 17:50:15 -0700 Subject: [PATCH 72/74] change weird LatLng variable name --- src/apps/testapps/testH3Index.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/apps/testapps/testH3Index.c b/src/apps/testapps/testH3Index.c index 5e4bd6e59..3537ceeaa 100644 --- a/src/apps/testapps/testH3Index.c +++ b/src/apps/testapps/testH3Index.c @@ -68,9 +68,9 @@ SUITE(h3Index) { TEST(isValidCellAtResolution) { for (int i = 0; i <= MAX_H3_RES; i++) { - LatLng LatLng = {0, 0}; + LatLng g = {0, 0}; H3Index h3; - t_assertSuccess(H3_EXPORT(latLngToCell)(&LatLng, i, &h3)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&g, i, &h3)); char failureMessage[BUFF_SIZE]; sprintf(failureMessage, "isValidCell failed on resolution %d", i); t_assert(H3_EXPORT(isValidCell)(h3), failureMessage); @@ -78,9 +78,9 @@ SUITE(h3Index) { } TEST(isValidCellDigits) { - LatLng LatLng = {0, 0}; + LatLng g = {0, 0}; H3Index h3; - t_assertSuccess(H3_EXPORT(latLngToCell)(&LatLng, 1, &h3)); + t_assertSuccess(H3_EXPORT(latLngToCell)(&g, 1, &h3)); // Set a bit for an unused digit to something else. h3 ^= 1; t_assert(!H3_EXPORT(isValidCell)(h3), From a6ac3b4b5c8b11d855c198dded4dff693da932e4 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Thu, 3 Jun 2021 17:55:02 -0700 Subject: [PATCH 73/74] latLngToCellDesc --- website/docs/core-library/latLngToCellDesc.md | 4 ++-- website/sidebars.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/core-library/latLngToCellDesc.md b/website/docs/core-library/latLngToCellDesc.md index 570653c8e..88f90d24d 100644 --- a/website/docs/core-library/latLngToCellDesc.md +++ b/website/docs/core-library/latLngToCellDesc.md @@ -1,8 +1,8 @@ --- -id: latLngToCelldesc +id: latLngToCellDesc title: Conversion from latitude/longitude to containing H3 cell index sidebar_label: Conversion from latitude/longitude to containing H3 cell index -slug: /core-library/latLngToCelldesc +slug: /core-library/latLngToCellDesc --- This operation is performed by function `latLngToCell`. See the comments in the function for more detail. diff --git a/website/sidebars.js b/website/sidebars.js index 184bf6647..4e76ba6ae 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -68,7 +68,7 @@ module.exports = { type: "category", label: "Algorithms", items: [ - "core-library/latLngToCelldesc", + "core-library/latLngToCellDesc", "core-library/cellToLatLngDesc", "core-library/cellToBoundaryDesc", ], From 5b679ca7c076c2c18665a9109364188d5ec3b39b Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Fri, 4 Jun 2021 17:07:09 -0700 Subject: [PATCH 74/74] remove website cleanup notes --- website/README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/website/README.md b/website/README.md index 9144fef29..836c31678 100644 --- a/website/README.md +++ b/website/README.md @@ -18,13 +18,6 @@ yarn start You will then be able to open http://localhost:3000 in your browser. -To clean any generated files, you can run: - -``` -yarn clear -rm -rf node_modules -``` - ## Updating the H3 Website Deployment is done via [Docusaurus](https://docusaurus.io/docs/deployment#deploy). You will need