Previous Entry Share Next Entry
How would you...
...round an x/y value pair to the nearest center of a hexagonal (honeycomb) grid?

Sample Hexagonal Grid

Input: 18,4
Output: 15,6

Input: 15,11
Output: 15,6

Input: 15,12
Output: 10,15

In other words, any input value rounds or "snaps" to the nearest value marked by a red dot above. Can this be done with a ridiculously simple formula?


Log in

No account? Create an account