Skip to content

Commit 5ecee88

Browse files
authored
documenting num hexagon recurence (#375)
1 parent 56cafd1 commit 5ecee88

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/h3lib/lib/geoCoord.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,16 @@ double H3_EXPORT(edgeLengthM)(int res) {
304304

305305
/** @brief Number of unique valid H3Indexes at given resolution. */
306306
int64_t H3_EXPORT(numHexagons)(int res) {
307+
/**
308+
* Note: this *actually* returns the number of *cells*
309+
* (which includes the 12 pentagons) at each resolution.
310+
*
311+
* This table comes from the recurrence:
312+
*
313+
* num_cells(0) = 122
314+
* num_cells(i+1) = (num_cells(i)-12)*7 + 12*6
315+
*
316+
*/
307317
static const int64_t nums[] = {122L,
308318
842L,
309319
5882L,

0 commit comments

Comments
 (0)