in h3_vertex.c [173:192]
Direction directionForVertexNum(const H3Index origin, const int vertexNum) {
int isPent = H3_EXPORT(isPentagon)(origin);
// Check for invalid vertexes
if (vertexNum < 0 ||
vertexNum > (isPent ? NUM_PENT_VERTS : NUM_HEX_VERTS) - 1)
return INVALID_DIGIT;
// Determine the vertex rotations for this cell
int rotations;
H3Error err = vertexRotations(origin, &rotations);
if (err) {
return INVALID_DIGIT;
}
// Find the appropriate direction, rotating CW if necessary
return isPent ? vertexNumToDirectionPent[(vertexNum + rotations) %
NUM_PENT_VERTS]
: vertexNumToDirectionHex[(vertexNum + rotations) %
NUM_HEX_VERTS];
}