Skip to content
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

trivial fix to bboxHexRadius to guarantee containment #279

Merged
merged 7 commits into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The public API of this library consists of the functions declared in file
## [Unreleased]
### Fixed
- `compact` handles zero length input correctly. (#278)
- `bboxHexRadius` scaling factor adjusted to guarantee containment for `polyfill`. (#279)

## [3.6.0] - 2019-08-12
### Added
Expand Down
4 changes: 2 additions & 2 deletions src/apps/testapps/testPolyfill.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ SUITE(polyfill) {

TEST(maxPolyfillSize) {
int numHexagons = H3_EXPORT(maxPolyfillSize)(&sfGeoPolygon, 9);
t_assert(numHexagons == 3169, "got expected max polyfill size");
t_assert(numHexagons == 7057, "got expected max polyfill size");
kwmsmith marked this conversation as resolved.
Show resolved Hide resolved

numHexagons = H3_EXPORT(maxPolyfillSize)(&holeGeoPolygon, 9);
t_assert(numHexagons == 3169, "got expected max polyfill size (hole)");
t_assert(numHexagons == 7057, "got expected max polyfill size (hole)");

numHexagons = H3_EXPORT(maxPolyfillSize)(&emptyGeoPolygon, 9);
t_assert(numHexagons == 1, "got expected max polyfill size (empty)");
Expand Down
2 changes: 1 addition & 1 deletion src/h3lib/lib/bbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,5 @@ int bboxHexRadius(const BBox* bbox, int res) {
// any orientation of the GeoJSON encased in a circle defined by the
// bounding box radius and center, it is guaranteed to fit in this k-ring
// Rounded *up* to guarantee containment
return (int)ceil(bboxRadiusKm / (1.5 * centerHexRadiusKm));
return (int)ceil(bboxRadiusKm / (1.0 * centerHexRadiusKm));
kwmsmith marked this conversation as resolved.
Show resolved Hide resolved
}