Dan Price (thwack) wrote,
Dan Price
thwack

  • Mood:

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?
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments