Determining hexes intersected by a line between two hexes on a hex grid Given two hexes within a hex grid of tiles, is it possible to determine all the hexes which are intersected by a line draw from the centre of first hex to the centre of the second if you are only given the row and column number of each?

For example, if you have some hexes h1 and h2 in the grid of tiles and you know h1 is located at (r1, c1) and h2 is located at (r2, c2) can all the hexes that will be intersected by a line draw from the centre of h1 to the centre of h2 be determine without any further information?

The reference image on this question may be helpful in visualizing the hex grid and the (x, y) coordinate system employed may make a possible solution easier.
Let $s$ be the slope of the line. Let us consider, by simplicity, only the case where $s$ is positive (the solution for the case with $s$ negative is similar and symmetric). Thus, we have two hexes with coordinates $r1, c1$ and $r2, c2$, with $r1\leq r2$ and $c1\leq c2$. Also, let us define $r$ and $c$ as the Cartesian coordinates (with standard horizontal and vertical lines) shown in the Figure posted in the previous question. Note that, according to this coordinate system, the vertices of all hexes in the plane have integer coordinates on the x-axis, whereas they can have coordinates of the form $i$, $i+1/3$, or $i-1/3$ (with $i$ integer) on the y-axis. Also assume that "crossing" a hex includes the possibility that the line overlaps with one of the hex's sides or even that the line crosses a vertex.    

In the row where $y=r1$, the hex with center in $c1+2$ is crossed by the line if $s\leq\frac{2/3}{2}=1/3$. The hex with center in $c1+4$ is crossed if $s\leq\frac{2/3}{4}=1/6$. Continuing in this way, we get that any hex with center in $c1+2k$ is crossed if $s\leq\frac{2/3}{2k}=\frac{1}{3k}$.

In the upper row, where $y=r1+1$, the hex with center in $c1+1$ is crossed if $\frac {1/3}{1}&lt;s$. The hex with center in $c1+3$ is crossed if $\frac{1/3}{3}&lt;s\leq \frac{4/3}{2}$. However, for the next hex the formula changes because a line with decreasing slope crosses the hex at its upper vertex instead than at the left upper one. Thus, the hex with center in $c1+5$ is crossed if $\frac{1/3}{5}\leq s\leq \frac{5/3}{5}$, the hex with center in $c1+7$ is crossed if $\frac{1/3}{7}\leq s \leq \frac{5/3}{7}$, and so on. Continuing in this way we get that  any hex with center in $c1+(2k-1)$ is crossed if:


$\frac{1/3}{(2k-1)} \leq s \leq \frac{4/3}{(2k-2)}$, when the slope $s&gt;1/3$ (note that for $k=1$ it gives $1/3&lt;s&lt;\infty$);
$\frac{1/3}{(2k-1)} \leq s \leq \frac{5/3}{(2k-1)}$, when the slope $s\leq1/3$.


In the row $r1+2$, similar considerations allow to obtain that  any hex with center in $c1+2k$ is crossed if:


$\frac{5/3}{(2k+1)}\leq s\leq \frac{7/3}{(2k-1)}$, when the slope $s&gt;1/3$;
$\frac{4/3}{(2k)}\leq s\leq \frac{8/3}{2k}$, when the slope $s\leq 1/3$.


Generalizing, we have that, in the row $r1+j$ with $j$ odd,  any hex with center in $c1+(2k-1)$ is crossed if:


$\frac{(j-1/3)}{2k}\leq s\leq \frac{(j+1/3)}{(2k-2)}$, when the slope $s&gt;1/3$;
$\frac{(j-2/3)}{(2k-1)}\leq s\leq \frac{(j+2/3)}{(2k-1)}$, when the slope $s\leq1/3$.


On the other hand, when $j$ is even, any hex with center in $c1+2k$ is crossed if:


$\frac{(j-1/3)}{(2k+1)}\leq s\leq \frac{(j+1/3)}{(2k-1)}$, when the slope $s&gt;1/3$;
$\frac{(j-2/3)}{(2k)}\leq s\leq \frac{(j+2/3)}{2k}$, when the slope $s\leq1/3$.
Of course the number of intersected hexes can be determined from the information you mention, since it forms a complete description of the problem. What further information might there be to affect that count?

That doesn't mean that I know a simple formula to do that computation, though. I'm merely pointing out that you could certainly come up with a stupid algorithm which moves from one hex to the next and keeps track of the count. If you multiply row numbers by $3$, then all corners of the hexes would even be on integer coordinates, in which case the algorithm could operate on integers only as well, avoiding numeric issues.