I am writing computer code which instantiates a Kepler orbit given cartesian position and velocity vectors. I am working from this reference document.
It says:
Calculate orbital momentum vector
$\mathbf{h} = \mathbf{r} \times \mathbf{\dot r}$
Determine the vector $\mathbf n$ pointing towards the ascending node
$\mathbf n = (0,0,1)^T \times \mathbf{h} = (-h_y, h_x, 0)^T$
Obtain the longitude of the ascending node
$\Omega = \mathrm{arccos}(\frac{n_x}{||\mathbf{n}||})$
Suppose we have $\mathbf{r} = (X,0,0)$ and $\mathbf{\dot{r}}=(0,Y,0)$, we will end up with $\mathbf{h}=(0,0,Z)$, but this causes $\mathbf n$ to collapse to zero, and then $\Omega$ and other parameters can't be calculated.
Is the document wrong, or am I reading it wrong, or do I just need to detect and handle certain special cases? If so, what are these special cases, exhaustively?