Solution (source code)

= Solution

For a point $\boldsymbol p=\boldsymbol r_2(t)$, the magnitude of $(\boldsymbol p-\boldsymbol a_1)\times\boldsymbol n_1$ is the area of a parallelogram. Dividing by its base length $\|\boldsymbol n_1\|$ gives the perpendicular <Euclidean distance> to the first line. Explicitly,
$$
\boldsymbol p-\boldsymbol a_1=(t-1,t,t+1),\qquad
(\boldsymbol p-\boldsymbol a_1)\times\boldsymbol n_1=(-(t+1),t+1,-1).
$$
Hence
$$
\boxed{d(t)=\frac{\sqrt{2(t+1)^2+1}}{\sqrt2}
=\sqrt{(t+1)^2+\frac12}.}
$$
This use of the <cross product> removes any component parallel to the first line automatically.