Angle $\xi$ between $\left| Q \right>$ and orientation vector $\left| a \right>$ (i.e. $ax$, $ay$, $az$), in units of rlu; $g_{ij}=\left| b_i \left> \right< b_j \right|$ is the covariant metric of the reciprocal lattice with basis $\left| b_i \right>$:
\begin{equation}\xi = \arccos\left( \frac{\left< Q | a \right> }{\sqrt{\left< Q | Q \right>}\sqrt{\left< a | a \right>}}\right) \end{equation}
The sign, $\sigma_{\mathrm{side}}$, of $\xi$ depends on which side of the orientation vector $\left| a \right>$ the scattering vector $\left| Q \right>$ is located. The sign can be found by calculating the (covariant) cross product of $\left| a \right>$ and $\left| Q \right>$ to give an out-of-plane vector which can be compared with the given scattering plane up vector.
\paragraph*{Special case}
Special case for cubic crystals, $g_{ij}=\delta_{ij}\cdot\left(2\pi/ a \right)^2$: