How do I do geometry with hex-coordinates?

Our Grids library provides many useful functions for working with hex-coordinates in Unity, but you may want to go beyond this and implement your own algorithms. In the article Geometry with Hex-Coordinates, I explain the basic hex-coordinate system that we use, and how to solve geometric problems with it by thinking in terms of vectors. It also gives many useful facts about hex-space. Did you know that all triangles are regular? Or all quadrangles are trapezoids? That you can write equations for polygons with inspection? These geometric insights make it easier to devise algorithms that are correct, elegant, and fast.

(It also gives you some insight on what Grids do behind the scenes).

The article covers:

  • distances
  • equations for lines, triangles, trapezoids, and other polygons
  • finding intersections of lines
  • finding vertices of a triangle
  • finding the side-lengths of a triangle
  • rotating and reflecting points
Scroll to Top