Skip to main content
Version: 4.x

Directed edge functions

Directed edges allow encoding the directed (that is, which cell is the origin and which is the destination can be determined) edge from one cell to a neighboring cell.

areNeighborCells

H3Error areNeighborCells(H3Index origin, H3Index destination, int *out);

Returns whether or not the provided H3 cell indexes are neighbors.

out will be 1 if the indexes are neighbors, 0 otherwise.

cellsToDirectedEdge

H3Error cellsToDirectedEdge(H3Index origin, H3Index destination, H3Index *out);

Returns a unidirectional edge H3 index based on the provided origin and destination.

Returns 0 on success.

isValidDirectedEdge

int isValidDirectedEdge(H3Index edge);

Determines if the provided H3Index is a valid unidirectional edge index.

Returns 1 if it is a unidirectional edge H3Index, otherwise 0.

getDirectedEdgeOrigin

H3Error getDirectedEdgeOrigin(H3Index edge, H3Index *out);

Returns the origin hexagon from the unidirectional edge H3Index.

getDirectedEdgeDestination

H3Error getDirectedEdgeDestination(H3Index edge, H3Index *out);

Returns the destination hexagon from the unidirectional edge H3Index.

directedEdgeToCells

H3Error directedEdgeToCells(H3Index edge, H3Index* originDestination);

Returns the origin, destination pair of hexagon IDs for the given edge ID, which are placed at originDestination[0] and originDestination[1] respectively.

originToDirectedEdges

H3Error originToDirectedEdges(H3Index origin, H3Index* edges);

Provides all of the directed edges from the current H3Index. edges must be of length 6, and the number of directed edges placed in the array may be less than 6. If this is the case, one of the members of the array will be 0.

directedEdgeToBoundary

H3Error directedEdgeToBoundary(H3Index edge, CellBoundary* gb);

Provides the coordinates defining the unidirectional edge.