The next major piece of functionality we need is a way to convert between hex coordinates and screen coordinates. There’s a pointy top layout and a flat top hex layout. The conversion uses a matrix as well as the inverse of the matrix, so we need a way to store those. Also, for drawing the corners, pointy top starts at 30° and flat top starts at 0°, so we need a place to store that too.
See http://www.redblobgames.com/grids/hexagons/implementation.html for reference.
Orientation helper type to store these: the 2×2 forward matrix, the 2×2 inverse matrix, and the starting angle
Composite layout definition
Contant definition of pointy hexagon orientation
Turn Hex coordinates into a Point location on a Layout
Turn Point coordinates on a Layout into a Hex coordinates
Once we know where the corners are relative to the center, we can calculate the corners in screen locations by adding the center to each corner, and putting the coordinates into a list.
Drawing the line between hexes using the linear interpolation
Point on screen (pixel)