+
Skip to content

H3 4.0.0 Part 1: Renaming otherwise unchanged functions #403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 48 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
6dcbf30
Rename the is* functions
dfellis Oct 8, 2020
9cf759d
areNeighborCells
dfellis Oct 8, 2020
6fc012f
cellToParent
dfellis Oct 8, 2020
bfe1ba6
cellToCenterChild
dfellis Oct 8, 2020
a6e55e9
cellToChildren and maxCellToChildrenSize
dfellis Oct 8, 2020
b385f11
getNumCells
dfellis Oct 8, 2020
ab7094a
getRes0Cells and res0CellCount
dfellis Oct 8, 2020
ab8fd03
getPentagons and pentagonCount
dfellis Oct 8, 2020
eedb812
getBaseCellNumber
dfellis Oct 8, 2020
9de32bb
getResolution
dfellis Oct 8, 2020
fa75214
getIcosahedronFaces
dfellis Oct 8, 2020
b59b2ff
pointToCell
dfellis Oct 8, 2020
491de72
cellToPoint
dfellis Oct 8, 2020
421ad74
compactCells, uncompactCells, and maxUncompactCellsSize
dfellis Oct 8, 2020
3e07223
polygonToCells and maxPolygonToCellsSize
dfellis Oct 8, 2020
260110f
gridDistance
dfellis Oct 8, 2020
29c3363
gridPathCells and gridPathCellsSize
dfellis Oct 8, 2020
4283798
gridDiskDistancesSafe
dfellis Oct 8, 2020
1a38c97
gridDiskDistances
dfellis Oct 8, 2020
e672d79
gridDiskUnsafe and gridDisksUnsafe
dfellis Oct 8, 2020
9e91fbb
gridDisk
dfellis Oct 8, 2020
6e3c2a0
gridRingUnsafe
dfellis Oct 8, 2020
1f99d6b
cellsToDirectedEdge
dfellis Oct 8, 2020
bd6171e
directedEdgeToCells
dfellis Oct 8, 2020
ed7fa00
I didn't even know we had these example files
dfellis Oct 8, 2020
8b9e79d
Fix another example
dfellis Oct 8, 2020
f634ab8
originToDirectedEdges
dfellis Oct 9, 2020
4e2f44c
directedEdgeToBoundary
dfellis Oct 9, 2020
cbd4c63
getDirectedEdgeOrigin
dfellis Oct 9, 2020
2bed242
getDirectedEdgeDestination
dfellis Oct 9, 2020
4769e72
getHexagonAreaAvgKm2 and getHexagonAreaAvgM2
dfellis Oct 9, 2020
e5606e7
getHexagonEdgeLengthAvgKm and getHexagonEdgeLengthAvgM
dfellis Oct 9, 2020
554c1d7
cellToBoundary
dfellis Oct 9, 2020
d0e017d
maxGridDiskSize
dfellis Oct 9, 2020
7257492
Remove 'unidirectional' from source code
dfellis Oct 9, 2020
01582e2
CellBoundary
dfellis Oct 9, 2020
c509d42
GeoPoint and LinkedGeoPoint
dfellis Oct 9, 2020
51b3ff9
GeoLoop
dfellis Oct 9, 2020
486cc6e
geoloop
dfellis Oct 9, 2020
741d705
Rename some benchmarks
dfellis Oct 9, 2020
ea05df3
Rename a bunch of tests
dfellis Oct 9, 2020
e14e7ab
Rename several filter apps
dfellis Oct 9, 2020
1d9a4f0
Rename a couple misc apps
dfellis Oct 9, 2020
a021943
geoPoint.h
dfellis Oct 9, 2020
6763b88
directedEdge.h
dfellis Oct 9, 2020
62eebdc
Address many comments
dfellis Mar 10, 2021
04910c2
Fix mistakes by the rebase algorithm and other changes needed to get …
dfellis Mar 10, 2021
1f6a7e4
pentagon -> isPent
dfellis Mar 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 77 additions & 77 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ set(LIB_SOURCE_FILES
src/h3lib/include/polygon.h
src/h3lib/include/polygonAlgos.h
src/h3lib/include/h3Index.h
src/h3lib/include/h3UniEdge.h
src/h3lib/include/geoCoord.h
src/h3lib/include/directedEdge.h
src/h3lib/include/geoPoint.h
src/h3lib/include/vec2d.h
src/h3lib/include/vec3d.h
src/h3lib/include/linkedGeo.h
Expand All @@ -128,8 +128,8 @@ set(LIB_SOURCE_FILES
src/h3lib/lib/vertex.c
src/h3lib/lib/linkedGeo.c
src/h3lib/lib/localij.c
src/h3lib/lib/geoCoord.c
src/h3lib/lib/h3UniEdge.c
src/h3lib/lib/geoPoint.c
src/h3lib/lib/directedEdge.c
src/h3lib/lib/mathExtensions.c
src/h3lib/lib/vertexGraph.c
src/h3lib/lib/faceijk.c
Expand All @@ -152,73 +152,73 @@ set(EXAMPLE_SOURCE_FILES
examples/compact.c
examples/edge.c)
set(OTHER_SOURCE_FILES
src/apps/filters/h3ToGeo.c
src/apps/filters/cellToPoint.c
src/apps/filters/h3ToLocalIj.c
src/apps/filters/localIjToH3.c
src/apps/filters/h3ToComponents.c
src/apps/filters/geoToH3.c
src/apps/filters/h3ToGeoBoundary.c
src/apps/filters/kRing.c
src/apps/filters/hexRange.c
src/apps/filters/pointToCell.c
src/apps/filters/cellToBoundary.c
src/apps/filters/gridDisk.c
src/apps/filters/gridDiskUnsafe.c
Comment on lines +155 to +162
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest leaving the names of the filters as-is and they can be refactored in a subsequent PR. I don't think this needs to be removed from this PR though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isaacbrodsky Could you make a follow-up issue? Or is this covered by #415?

src/apps/testapps/testVertexGraph.c
src/apps/testapps/testCompact.c
src/apps/testapps/testPolyfill.c
src/apps/testapps/testPolyfillReported.c
src/apps/testapps/testCompactCells.c
src/apps/testapps/testPolygonToCells.c
src/apps/testapps/testPolygonToCellsReported.c
src/apps/testapps/testPentagonIndexes.c
src/apps/testapps/testKRing.c
src/apps/testapps/testH3ToGeoBoundary.c
src/apps/testapps/testH3ToParent.c
src/apps/testapps/testGridDisk.c
src/apps/testapps/testCellToBoundary.c
src/apps/testapps/testCellToParent.c
src/apps/testapps/testH3Index.c
src/apps/testapps/mkRandGeoBoundary.c
src/apps/testapps/testGeoToH3.c
src/apps/testapps/testPointToCell.c
src/apps/testapps/testH3NeighborRotations.c
src/apps/testapps/testMaxH3ToChildrenSize.c
src/apps/testapps/testHexRanges.c
src/apps/testapps/testH3ToGeo.c
src/apps/testapps/testH3ToCenterChild.c
src/apps/testapps/testH3ToChildren.c
src/apps/testapps/testH3GetFaces.c
src/apps/testapps/testGeoCoord.c
src/apps/testapps/testHexRing.c
src/apps/testapps/testMaxCellToChildrenSize.c
src/apps/testapps/testGridDisksUnsafe.c
src/apps/testapps/testCellToPoint.c
src/apps/testapps/testCellToCenterChild.c
src/apps/testapps/testCellToChildren.c
src/apps/testapps/testGetIcosahedronFaces.c
src/apps/testapps/testGeoPoint.c
src/apps/testapps/testGridRingUnsafe.c
src/apps/testapps/testH3SetToVertexGraph.c
src/apps/testapps/testBBox.c
src/apps/testapps/testVertex.c
src/apps/testapps/testVertexExhaustive.c
src/apps/testapps/testPolygon.c
src/apps/testapps/testVec2d.c
src/apps/testapps/testVec3d.c
src/apps/testapps/testH3UniEdge.c
src/apps/testapps/testH3UniEdgeExhaustive.c
src/apps/testapps/testDirectedEdge.c
src/apps/testapps/testDirectedEdgeExhaustive.c
src/apps/testapps/testLinkedGeo.c
src/apps/testapps/mkRandGeo.c
src/apps/testapps/testH3Api.c
src/apps/testapps/testH3SetToLinkedGeo.c
src/apps/testapps/testH3ToLocalIj.c
src/apps/testapps/testH3ToLocalIjExhaustive.c
src/apps/testapps/testH3Distance.c
src/apps/testapps/testH3DistanceExhaustive.c
src/apps/testapps/testH3Line.c
src/apps/testapps/testH3LineExhaustive.c
src/apps/testapps/testGridDistance.c
src/apps/testapps/testGridDistanceExhaustive.c
src/apps/testapps/testGridPathCells.c
src/apps/testapps/testGridPathCellsExhaustive.c
src/apps/testapps/testH3CellArea.c
src/apps/testapps/testH3CellAreaExhaustive.c
src/apps/testapps/testCoordIj.c
src/apps/testapps/testCoordIjk.c
src/apps/testapps/testH3Memory.c
src/apps/miscapps/h3ToGeoBoundaryHier.c
src/apps/miscapps/h3ToGeoHier.c
src/apps/miscapps/cellToBoundaryHier.c
src/apps/miscapps/cellToPointHier.c
src/apps/miscapps/generateBaseCellNeighbors.c
src/apps/miscapps/generatePentagonDirectionFaces.c
src/apps/miscapps/generateFaceCenterPoint.c
src/apps/miscapps/h3ToHier.c
src/apps/fuzzers/fuzzerGeoToH3.c
src/apps/fuzzers/fuzzerH3ToGeo.c
src/apps/fuzzers/fuzzerKRing.c
src/apps/benchmarks/benchmarkPolyfill.c
src/apps/fuzzers/fuzzerPointToCell.c
src/apps/fuzzers/fuzzerCellToPoint.c
src/apps/fuzzers/fuzzerGridDisk.c
src/apps/benchmarks/benchmarkPolygonToCells.c
src/apps/benchmarks/benchmarkPolygon.c
src/apps/benchmarks/benchmarkH3SetToLinkedGeo.c
src/apps/benchmarks/benchmarkKRing.c
src/apps/benchmarks/benchmarkH3Line.c
src/apps/benchmarks/benchmarkH3UniEdge.c
src/apps/benchmarks/benchmarkGridDiskCells.c
src/apps/benchmarks/benchmarkGridPathCells.c
src/apps/benchmarks/benchmarkDirectedEdge.c
src/apps/benchmarks/benchmarkVertex.c
src/apps/benchmarks/benchmarkH3Api.c)

Expand Down Expand Up @@ -381,16 +381,16 @@ if(BUILD_FILTERS)
list(APPEND INSTALL_TARGETS ${name})
endmacro()

add_h3_filter(geoToH3 src/apps/filters/geoToH3.c ${APP_SOURCE_FILES})
add_h3_filter(pointToCell src/apps/filters/pointToCell.c ${APP_SOURCE_FILES})
add_h3_filter(h3ToComponents src/apps/filters/h3ToComponents.c ${APP_SOURCE_FILES})
add_h3_filter(h3ToGeo src/apps/filters/h3ToGeo.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})
add_h3_filter(localIjToH3 src/apps/filters/localIjToH3.c ${APP_SOURCE_FILES})
add_h3_filter(h3ToGeoBoundary src/apps/filters/h3ToGeoBoundary.c ${APP_SOURCE_FILES})
add_h3_filter(hexRange src/apps/filters/hexRange.c ${APP_SOURCE_FILES})
add_h3_filter(kRing src/apps/filters/kRing.c ${APP_SOURCE_FILES})
add_h3_filter(h3ToGeoBoundaryHier src/apps/miscapps/h3ToGeoBoundaryHier.c ${APP_SOURCE_FILES})
add_h3_filter(h3ToGeoHier src/apps/miscapps/h3ToGeoHier.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(h3ToHier src/apps/miscapps/h3ToHier.c ${APP_SOURCE_FILES})

# Generate KML files for visualizing the H3 grid
Expand All @@ -404,11 +404,11 @@ if(BUILD_FILTERS)
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "KML/res${resolution}cells.kml")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "KML/res${resolution}centers.kml")
add_custom_target(kml_cells_${resolution}
COMMAND ${SHELL} "$<TARGET_FILE:h3ToHier> -r ${resolution} | $<TARGET_FILE:h3ToGeoBoundary> --kml --kml-name res${resolution}cells.kml --kml-description \"Res ${resolution} Cells\" > KML/res${resolution}cells.kml"
COMMAND ${SHELL} "$<TARGET_FILE:h3ToHier> -r ${resolution} | $<TARGET_FILE:cellToBoundary> --kml --kml-name res${resolution}cells.kml --kml-description \"Res ${resolution} Cells\" > KML/res${resolution}cells.kml"
VERBATIM
DEPENDS create-kml-dir)
add_custom_target(kml_centers_${resolution}
COMMAND ${SHELL} "$<TARGET_FILE:h3ToHier> -r ${resolution} | $<TARGET_FILE:h3ToGeo> --kml --kml-name res${resolution}centers.kml --kml-description \"Res ${resolution} Centers\" > KML/res${resolution}centers.kml"
COMMAND ${SHELL} "$<TARGET_FILE:h3ToHier> -r ${resolution} | $<TARGET_FILE:cellToPoint> --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
Expand Down Expand Up @@ -553,51 +553,51 @@ 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(testH3ToGeo src/apps/testapps/testH3ToGeo.c ${file})
add_h3_test_with_file(testPointToCell src/apps/testapps/testPointToCell.c ${file})
endforeach()

file(GLOB all_ic_files tests/inputfiles/res*ic.txt)
foreach(file ${all_ic_files})
add_h3_test_with_file(testH3ToGeo src/apps/testapps/testH3ToGeo.c ${file})
add_h3_test_with_file(testCellToPoint src/apps/testapps/testCellToPoint.c ${file})
endforeach()

file(GLOB all_centers tests/inputfiles/rand*centers.txt)
foreach(file ${all_centers})
add_h3_test_with_file(testGeoToH3 src/apps/testapps/testGeoToH3.c ${file})
add_h3_test_with_file(testPointToCell src/apps/testapps/testPointToCell.c ${file})
endforeach()

file(GLOB all_cells tests/inputfiles/*cells.txt)
foreach(file ${all_cells})
add_h3_test_with_file(testH3ToGeoBoundary src/apps/testapps/testH3ToGeoBoundary.c ${file})
add_h3_test_with_file(testCellToBoundary src/apps/testapps/testCellToBoundary.c ${file})
endforeach()

add_h3_test(testCompact src/apps/testapps/testCompact.c)
add_h3_test(testKRing src/apps/testapps/testKRing.c)
add_h3_test(testHexRing src/apps/testapps/testHexRing.c)
add_h3_test(testHexRanges src/apps/testapps/testHexRanges.c)
add_h3_test(testH3ToParent src/apps/testapps/testH3ToParent.c)
add_h3_test(testH3ToCenterChild src/apps/testapps/testH3ToCenterChild.c)
add_h3_test(testH3ToChildren src/apps/testapps/testH3ToChildren.c)
add_h3_test(testH3GetFaces src/apps/testapps/testH3GetFaces.c)
add_h3_test(testMaxH3ToChildrenSize src/apps/testapps/testMaxH3ToChildrenSize.c)
add_h3_test(testCompactCells src/apps/testapps/testCompactCells.c)
add_h3_test(testGridDisk src/apps/testapps/testGridDisk.c)
add_h3_test(testGridRingUnsafe src/apps/testapps/testGridRingUnsafe.c)
add_h3_test(testGridDisksUnsafe src/apps/testapps/testGridDisksUnsafe.c)
add_h3_test(testCellToParent src/apps/testapps/testCellToParent.c)
add_h3_test(testCellToCenterChild src/apps/testapps/testCellToCenterChild.c)
add_h3_test(testCellToChildren src/apps/testapps/testCellToChildren.c)
add_h3_test(testGetIcosahedronFaces src/apps/testapps/testGetIcosahedronFaces.c)
add_h3_test(testMaxCellToChildrenSize src/apps/testapps/testMaxCellToChildrenSize.c)
add_h3_test(testH3Index src/apps/testapps/testH3Index.c)
add_h3_test(testH3Api src/apps/testapps/testH3Api.c)
add_h3_test(testH3SetToLinkedGeo src/apps/testapps/testH3SetToLinkedGeo.c)
add_h3_test(testH3SetToVertexGraph src/apps/testapps/testH3SetToVertexGraph.c)
add_h3_test(testLinkedGeo src/apps/testapps/testLinkedGeo.c)
add_h3_test(testPolyfill src/apps/testapps/testPolyfill.c)
add_h3_test(testPolyfillReported src/apps/testapps/testPolyfillReported.c)
add_h3_test(testPolygonToCells src/apps/testapps/testPolygonToCells.c)
add_h3_test(testPolygonToCellsReported src/apps/testapps/testPolygonToCellsReported.c)
add_h3_test(testVertexGraph src/apps/testapps/testVertexGraph.c)
add_h3_test(testH3UniEdge src/apps/testapps/testH3UniEdge.c)
add_h3_test(testGeoCoord src/apps/testapps/testGeoCoord.c)
add_h3_test(testDirectedEdge src/apps/testapps/testDirectedEdge.c)
add_h3_test(testGeoPoint src/apps/testapps/testGeoPoint.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)
add_h3_test(testVec2d src/apps/testapps/testVec2d.c)
add_h3_test(testVec3d src/apps/testapps/testVec3d.c)
add_h3_test(testH3ToLocalIj src/apps/testapps/testH3ToLocalIj.c)
add_h3_test(testH3Distance src/apps/testapps/testH3Distance.c)
add_h3_test(testH3Line src/apps/testapps/testH3Line.c)
add_h3_test(testGridDistance src/apps/testapps/testGridDistance.c)
add_h3_test(testGridPathCells src/apps/testapps/testGridPathCells.c)
add_h3_test(testH3CellArea src/apps/testapps/testH3CellArea.c)
add_h3_test(testCoordIj src/apps/testapps/testCoordIj.c)
add_h3_test(testCoordIjk src/apps/testapps/testCoordIjk.c)
Expand All @@ -610,11 +610,11 @@ if(H3_IS_ROOT_PROJECT AND BUILD_TESTING)

# The "Exhaustive" part of the test name is used by the test-fast to exclude these files.
# test-fast exists so that Travis CI can run Valgrind on tests without taking a very long time.
add_h3_test(testH3UniEdgeExhaustive src/apps/testapps/testH3UniEdgeExhaustive.c)
add_h3_test(testDirectedEdgeExhaustive src/apps/testapps/testDirectedEdgeExhaustive.c)
add_h3_test(testVertexExhaustive src/apps/testapps/testVertexExhaustive.c)
add_h3_test(testH3ToLocalIjExhaustive src/apps/testapps/testH3ToLocalIjExhaustive.c)
add_h3_test(testH3LineExhaustive src/apps/testapps/testH3LineExhaustive.c)
add_h3_test(testH3DistanceExhaustive src/apps/testapps/testH3DistanceExhaustive.c)
add_h3_test(testGridPathCellsExhaustive src/apps/testapps/testGridPathCellsExhaustive.c)
add_h3_test(testGridDistanceExhaustive src/apps/testapps/testGridDistanceExhaustive.c)
add_h3_test(testH3CellAreaExhaustive src/apps/testapps/testH3CellAreaExhaustive.c)

if(BUILD_ALLOC_TESTS)
Expand All @@ -634,9 +634,9 @@ if(BUILD_FUZZERS)
add_dependencies(fuzzers ${name})
endmacro()

add_h3_fuzzer(fuzzerGeoToH3 src/apps/fuzzers/fuzzerGeoToH3.c)
add_h3_fuzzer(fuzzerH3ToGeo src/apps/fuzzers/fuzzerH3ToGeo.c)
add_h3_fuzzer(fuzzerKRing src/apps/fuzzers/fuzzerKRing.c)
add_h3_fuzzer(fuzzerPointToCell src/apps/fuzzers/fuzzerPointToCell.c)
add_h3_fuzzer(fuzzerCellToPoint src/apps/fuzzers/fuzzerCellToPoint.c)
add_h3_fuzzer(fuzzerGridDisk src/apps/fuzzers/fuzzerGridDisk.c)
endif()

if(BUILD_BENCHMARKS)
Expand All @@ -650,12 +650,12 @@ if(BUILD_BENCHMARKS)
endmacro()

add_h3_benchmark(benchmarkH3Api src/apps/benchmarks/benchmarkH3Api.c)
add_h3_benchmark(benchmarkKRing src/apps/benchmarks/benchmarkKRing.c)
add_h3_benchmark(benchmarkH3Line src/apps/benchmarks/benchmarkH3Line.c)
add_h3_benchmark(benchmarkH3UniEdge src/apps/benchmarks/benchmarkH3UniEdge.c)
add_h3_benchmark(benchmarkGridDiskCells src/apps/benchmarks/benchmarkGridDiskCells.c)
add_h3_benchmark(benchmarkGridPathCells src/apps/benchmarks/benchmarkGridPathCells.c)
add_h3_benchmark(benchmarkDirectedEdge src/apps/benchmarks/benchmarkDirectedEdge.c)
add_h3_benchmark(benchmarkVertex src/apps/benchmarks/benchmarkVertex.c)
add_h3_benchmark(benchmarkH3SetToLinkedGeo src/apps/benchmarks/benchmarkH3SetToLinkedGeo.c)
add_h3_benchmark(benchmarkPolyfill src/apps/benchmarks/benchmarkPolyfill.c)
add_h3_benchmark(benchmarkPolygonToCells src/apps/benchmarks/benchmarkPolygonToCells.c)
if(ENABLE_REQUIRES_ALL_SYMBOLS)
add_h3_benchmark(benchmarkPolygon src/apps/benchmarks/benchmarkPolygon.c)
endif()
Expand Down
11 changes: 6 additions & 5 deletions examples/compact.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018 Uber Technologies, Inc.
* Copyright 2018, 2020 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.
Expand Down Expand Up @@ -35,7 +35,7 @@ int main(int argc, char* argv[]) {
printf("Starting with %d indexes.\n", inputSize);

H3Index* compacted = calloc(inputSize, sizeof(H3Index));
int err = compact(input, compacted, inputSize);
int err = compactCells(input, compacted, inputSize);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had forgotten all about the example files - do these not need H3_EXPORT wrapping?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They use H3 as a library, so H3_EXPORT is not available, and the test compiles it with an empty prefix so this works (or the test suite would be complaining ;) )

// An error case can occur on e.g. duplicate input.
assert(err == 0);

Expand All @@ -50,10 +50,11 @@ int main(int argc, char* argv[]) {
printf("Compacted to %d indexes.\n", compactedCount);

int uncompactRes = 10;
int uncompactedSize = maxUncompactSize(compacted, inputSize, uncompactRes);
int uncompactedSize =
maxUncompactCellsSize(compacted, inputSize, uncompactRes);
H3Index* uncompacted = calloc(uncompactedSize, sizeof(H3Index));
int err2 = uncompact(compacted, compactedCount, uncompacted,
uncompactedSize, uncompactRes);
int err2 = uncompactCells(compacted, compactedCount, uncompacted,
uncompactedSize, uncompactRes);
// An error case could happen if the output array is too small, or indexes
// have a higher resolution than uncompactRes.
assert(err2 == 0);
Expand Down
10 changes: 5 additions & 5 deletions examples/distance.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018 Uber Technologies, Inc.
* Copyright 2018, 2020 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.
Expand Down Expand Up @@ -52,17 +52,17 @@ int main(int argc, char *argv[]) {
// 555 Market St @ resolution 15
H3Index h3HQ2 = stringToH3("8f283082a30e623");

GeoCoord geoHQ1, geoHQ2;
h3ToGeo(h3HQ1, &geoHQ1);
h3ToGeo(h3HQ2, &geoHQ2);
GeoPoint geoHQ1, geoHQ2;
cellToPoint(h3HQ1, &geoHQ1);
cellToPoint(h3HQ2, &geoHQ2);

printf(
"origin: (%lf, %lf)\n"
"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), h3Distance(h3HQ1, h3HQ2),
radsToDegs(geoHQ2.lon), gridDistance(h3HQ1, h3HQ2),
haversineDistance(geoHQ1.lat, geoHQ1.lon, geoHQ2.lat, geoHQ2.lon));
// Output:
// origin: (37.775236, -122.419755)
Expand Down
8 changes: 4 additions & 4 deletions examples/edge.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018 Uber Technologies, Inc.
* Copyright 2018, 2020 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.
Expand All @@ -26,11 +26,11 @@ int main(int argc, char *argv[]) {
H3Index origin = 0x8a2a1072b59ffffL;
H3Index destination = 0x8a2a1072b597fffL; // north of the origin

H3Index edge = getH3UnidirectionalEdge(origin, destination);
H3Index edge = cellsToDirectedEdge(origin, destination);
printf("The edge is %" PRIx64 "\n", edge);

GeoBoundary boundary;
getH3UnidirectionalEdgeBoundary(edge, &boundary);
CellBoundary boundary;
directedEdgeToBoundary(edge, &boundary);
for (int v = 0; v < boundary.numVerts; v++) {
printf("Edge vertex #%d: %lf, %lf\n", v,
radsToDegs(boundary.verts[v].lat),
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载