Hacker News new | ask | show | jobs
by aidenn0 2024 days ago
> The equivalent loose approximation on a hex grid would seem to be long direction minus 1/4 short direction, which doesn't seem any harder.

As promised in a sibling comment I would work it out on paper. By my path, using the 7/4 approximation for sqrt(3), the ratio between X and Y directions is 12:21 which is much harder to do in your head than the 3:2 that a square grid gives you. However, a simpler approximation of (5:3) with acceptably low error came out.

Math (see diagram below)

Normalizing your 1.75 approximation to 7 "units" then the sides of the hexagon are of length 7, the distance from center to corner is length 7, and the distance from center to side is 6. This gives a distance from A to other points as:

B: 12 (Center -> Side -> Center)

C: 12 (Center -> Side -> Center)

D: 21 (Center -> Corner -> Corner -> Center)

Given that the actual value of A->D is ~20.784 that suggests approximating A->D = 20 alowing us to reduce as follows:

B: 3

C: 3

D: 5

This has a ~3.7% error in the horizontal direction.

       ______            ______      
      /      \          /      \     
    /    B     \______/          \___
    \          /      \          /   
      \      /          \      /     
        ----      C       ----       
      /      \          /      \     
    /    A     \______/    D     \___
    \          /      \          /   
      \      /          \      /     
        ----              ----       
      /      \          /      \     
    /          \______/          \___
    \          /      \          /   
      \      /          \      /     
        ----              ----
1 comments

> As promised in a sibling comment I would work it out on paper. By my path, using the 7/4 approximation for sqrt(3), the ratio between X and Y directions is 12:21

Well, yes, 4:7 is 12:21.

But I think 4:7 is a lot easier to do in your head than 12:21 (3:5 is a little easier, at the expense of being less accurate); not sure why you did all that work to make it more complicated when you started with a fraction that gave you the ratio in its simplest form.