The direction enums, Direction and DiagonalDirection were confusing users, because their variants had orientation based names.
For example Direction::Top made sense in flat orientation, but in pointy orientation with the 30 degrees shift, it lost its meaning.
Multiple users thought directions were related to HexOrientation when they are not, due to this unfortunate naming.
Solution
First the Direction enum was renamed to EdgeDirection , and DiagonalDirection to VertexDirection. This naming is more consistent on what those directions actually represent.
EdgeDirection represents the vector to reach an edge-adjacent neigbor of a given coordinate
Then, instead of an enum, which forced me to name the directions, they are now structs storing a u8 index between 0 and 5, 6 possibilities. The enum way was also repr(u8) mimicking this index way
To keep the ability to use directions directly with orientation based names I added a bunch of const values for both flat and pointy orientation
Notes
If this PR is a huge breaking change, there should not be any lost feature, I kept all methods available before to both direction enums, and all the tests were adapted
The idea for the renaming comes from #154 , where I realized that directions are edge related, and diagonals vertex related
Problem
The direction enums,
Direction
andDiagonalDirection
were confusing users, because their variants had orientation based names.For example
Direction::Top
made sense in flat orientation, but in pointy orientation with the 30 degrees shift, it lost its meaning. Multiple users thought directions were related toHexOrientation
when they are not, due to this unfortunate naming.Solution
First the
Direction
enum was renamed toEdgeDirection
, andDiagonalDirection
toVertexDirection
. This naming is more consistent on what those directions actually represent.EdgeDirection
represents the vector to reach an edge-adjacent neigbor of a given coordinateVertexDirection
represents the vector to reach a diagonal neibhor following the vertex/corner of the hexagonThen, instead of an enum, which forced me to name the directions, they are now structs storing a
u8
index between 0 and 5, 6 possibilities. The enum way was alsorepr(u8)
mimicking this index wayTo keep the ability to use directions directly with orientation based names I added a bunch of const values for both flat and pointy orientation
Notes
If this PR is a huge breaking change, there should not be any lost feature, I kept all methods available before to both direction enums, and all the tests were adapted
The idea for the renaming comes from #154 , where I realized that directions are edge related, and diagonals vertex related