ManevilleF / hexx

Hexagonal tools lib in rust
Apache License 2.0
276 stars 22 forks source link

Ord wrappers for Hex #147

Closed ManevilleF closed 3 months ago

ManevilleF commented 5 months ago

Proposal to implement ordering for Hex coordinates (See #146)

Add wrappers around Hex implementing PartialOrd and Ord

EDIT: I added an explicative section in the README

alice-i-cecile commented 5 months ago

Hmm. I think this is mildly useful, but not worth including in the library. These are really trivial to add to end user code.

I would consider adding the OrderByLength impl to Hex itself (since it's a good default + in many cases you don't care what the ordering is, just that it is orderable).

ManevilleF commented 5 months ago

I'm not sure if there is a good default, like if you retrieve a hex ring around zero all coordinates will have the same length while not being equal, only YX or XY would give consistent results with Equality comparison