ext/h3/src/src/h3lib/lib/baseCells.c in h3-3.3.1 vs ext/h3/src/src/h3lib/lib/baseCells.c in h3-3.4.0
- old
+ new
@@ -16,10 +16,11 @@
/** @file baseCells.c
* @brief Base cell related lookup tables and access functions.
*/
#include "baseCells.h"
+#include "h3Index.h"
/** @struct BaseCellOrient
* @brief base cell at a given ijk and required rotations into its system
*/
typedef struct {
@@ -884,5 +885,27 @@
return dir;
}
}
return INVALID_DIGIT;
}
+
+/**
+ * res0IndexCount returns the number of resolution 0 indexes
+ *
+ * @return int count of resolution 0 indexes
+ */
+int H3_EXPORT(res0IndexCount)() { return NUM_BASE_CELLS; }
+
+/**
+ * getRes0Indexes generates all base cells storing them into the provided
+ * memory pointer. Buffer must be of size NUM_BASE_CELLS * sizeof(H3Index).
+ *
+ * @param out H3Index* the memory to store the resulting base cells in
+ */
+void H3_EXPORT(getRes0Indexes)(H3Index* out) {
+ for (int bc = 0; bc < NUM_BASE_CELLS; bc++) {
+ H3Index baseCell = H3_INIT;
+ H3_SET_MODE(baseCell, H3_HEXAGON_MODE);
+ H3_SET_BASE_CELL(baseCell, bc);
+ out[bc] = baseCell;
+ }
+}
\ No newline at end of file