There are two media and they are stacked vertically like the figure below.
Medium 1 - height : h, refractive index : $n_1$
Medium 2 - height : h, refractive index : $n_2$
A laser beam travels through these media from the left-top corner with the initital incident angle $\theta_1$.
Is it possible to analytically determine the horizontal distance the laser beam moves forward when it reaches the bottom?
*$\theta_2$ can't be included in the answer.

I belive the answer is given by $$ d = h [\tan \theta_1 + \tan \theta_2]$$ each term giving you thee horizontal distance travelled for each medium.
Now, according to Snell's law $$\frac{\sin \theta_1}{\sin \theta_2} = \frac{n_1}{n_2}$$ so $$\theta_2 = \arcsin \left(\sin \theta_1 \cdot \frac{n2}{n1}\right)$$ and upon substituing $$ d = h \left[\tan \theta_1 + \tan \,\arcsin \left(\sin \theta_1 \cdot \frac{n2}{n1}\right)\right] $$