Celestial Programming : Vertical Sundial

The equations for a vertical sundial are quite similar to those for a horizontal sundial. And the results might look like the dial is just rotated, but the angles are different.

Computation of the angles for the hour lines is fairly simple, I give two methods below. They both produce the same results, but the first method allows the use of the ATAN2 function to ensure \(\theta\) is in the correct quadrant. The second method is just shorter.

Hour Lines

$$ \begin{align*} x &=\sin H \\ y &=\frac{\cos H}{\cos \phi} \\ \tan \theta &= \frac{x}{y} \\ \\ Alternate: \\ \tan \theta &= \tan H \cos \phi \end{align*} $$
\(\theta \) = Line's angle for given hour
\(H \) = Hour angle of the Sun
\(\phi \) = Latitude