uber / uber/h3

originToDirectedEdges does not return edges in clock-wise/sorted order ?

Open
#695 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
6.5k
Forks
627
Avg merge
3d 21h
Merged PRs (30d)
6

Description

I was expecting this function/api:

originToDirectedEdges

to return the edges in sorted order, for example clockwise.

But it does not seem to do that ???

Is there a way to fix this, perhaps compute angles and re-sort the array ? I could use some math help here ! ;) :)

"
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.
"

Later I use this function/api to get the destination H3Index:

getDirectedEdgeDestination
"
Returns the destination hexagon from the unidirectional edge H3Index.
"

Additional notes to describe the problem:

The first api call does not sort the edges in clock-wise order... so it seems to be unsorted... this is a problem when trying to visualize the triangles between the centers.

I want to create a triangle from center of hexagon, to center of neighbour hexagon, and then to next neighbour hexagon.
(So these 3 points for a triangle)

The next neighbour hexagon should be in clock-wise order to get a nice triangle.

Otherwise 180 degree triangles could occur and this looks bad.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the originToDirectedEdges and getDirectedEdgeDestination API behavior described in the issue, including how the six output slots and zero entries are handled. Trace the implementation and existing API tests, then establish the expected clockwise ordering for neighboring destinations. Done means the returned directed edges have a defined, verified order that supports the requested center-to-neighbor triangle construction.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.