in h3_directedEdge.c [258:294]
H3Error H3_EXPORT(directedEdgeToBoundary)(H3Index edge, CellBoundary *cb) {
// Get the origin and neighbor direction from the edge
Direction direction = H3_GET_RESERVED_BITS(edge);
H3Index origin;
H3Error originResult = H3_EXPORT(getDirectedEdgeOrigin)(edge, &origin);
if (originResult) {
return originResult;
}
// Get the start vertex for the edge
int startVertex = vertexNumForDirection(origin, direction);
if (startVertex == INVALID_VERTEX_NUM) {
// This is not actually an edge (i.e. no valid direction),
// so return no vertices.
cb->numVerts = 0;
return E_DIR_EDGE_INVALID;
}
// Get the geo boundary for the appropriate vertexes of the origin. Note
// that while there are always 2 topological vertexes per edge, the
// resulting edge boundary may have an additional distortion vertex if it
// crosses an edge of the icosahedron.
FaceIJK fijk;
H3Error fijkResult = _h3ToFaceIjk(origin, &fijk);
if (NEVER(fijkResult)) {
return fijkResult;
}
int res = H3_GET_RESOLUTION(origin);
int isPent = H3_EXPORT(isPentagon)(origin);
if (isPent) {
_faceIjkPentToCellBoundary(&fijk, res, startVertex, 2, cb);
} else {
_faceIjkToCellBoundary(&fijk, res, startVertex, 2, cb);
}
return E_SUCCESS;
}