ManevilleF / hexx

Hexagonal tools lib in rust
Apache License 2.0
288 stars 23 forks source link

Pointy Top and Flat Top EdgeDirections are swapped #161

Closed msparkles closed 6 months ago

msparkles commented 6 months ago

This broke our game using the library.

According to https://www.redblobgames.com/grids/hexagons/ ... image

Yet...

    /// Direction to (1, -1)
    ///
    /// Represents "Top right" edge in flat orientation
    pub const FLAT_TOP_RIGHT: Self = Self(5);
ManevilleF commented 6 months ago

The screenshot is of pointy orientation, what is the expected behaviour?

msparkles commented 6 months ago

The FLAT_TOP_RIGHT direction has (supposedly, according to the docs) the value of POINTY_TOP_RIGHT

msparkles commented 6 months ago

As in, looking at the hexagon guide, it seems that 1, -1 should be pointy's top right, not flat's

ManevilleF commented 6 months ago

Thanks for noticing this, I guess I got confused by all const variants. Could you review #162 ? I'll release a fix afterwards

msparkles commented 6 months ago

We're bad at the math ourselves :P We only know if our game works or not. For a patch for our game we just used values directly from the article, if you want someone to review the math you'll need someone else....

msparkles commented 6 months ago

Or we suppose we can also patch the dep with the branch, if you want that we can also do that :+1:

ManevilleF commented 6 months ago

Or we suppose we can also patch the dep with the branch, if you want that we can also do that 👍

Yes that's what I mean. Btw the math was correct, the issue was the name of some const values

msparkles commented 6 months ago

@ManevilleF Congratulations that fixes it!