In practice if you have a continuously twice differentiable regular curve $p(t) = (x(t), y(t), z(t))$ you can compute its velocity as $v(t) = \dot{p}(t) = \frac{dp}{dt}(t)$ and its acceleration as $a(t) = \dot{v}(t) = \ddot{p}(t)$ and use those to form an orthonormal basis (this wouod fail if $v(t)=0$ or $a(t)=0$). The velocity $v$ is tangent to the curve, but $a$ is not necessarily orthogonal to it, so if we wish to construct an orthonormal basis we need to orthonormalize those, e.g., by using Gram-Schmidt: \begin{equation} f_1(t) = \frac{v(t)}{\|v(t)\|_2}, \quad a_{\perp v}(t) = a(t) - (f_1(t)\cdot a(t))f_1(t), \quad f_2(t) = \frac{a(t)}{\|a(t)\|_2}. \end{equation} We can compute the third vector by using the cross product $f_3(t) = f_1(t)\times f_2(t)$. Now $f_1(t), f_2(t), f_3(t)$ form an orthonormal basis, and you can use the following for your camera matrix $C$ and view matrix $V$: \begin{align} C &= \begin{bmatrix} | & | & | & | \\ f_1(t) & f_2(t) & f_3(t) & p(t) \\ | & | & | & | \\ 0 & 0 & 0 & 1 \end{bmatrix} = \begin{bmatrix} F(t) & p(t) \\ 0^T & 1 \end{bmatrix}, \\ V &= C^{-1} = \begin{bmatrix} (F(t))^T & -(F(t))^Tp(t) \\ 0^T & 1 \end{bmatrix}. \end{align} Looking at your code the specific curve you have is parwmetrized as follows: \begin{align} x(t) = \frac{a \cos(t)}{1+\sin^2(t)}, \quad y(t) = \frac{a \cos(t)\sin(t)}{1+\sin^2(t)},\quad z(t) = b \cos(c t). \end{align} The first derivatives (the components of the velocity) can be computed in the following way (I derived this without pen and paper so you should double check it): \begin{align} \dot{x}(t) &= -\frac{a\sin(t)}{1+\sin^2(t)}-\frac{2a\cos^2(t)\sin(t)}{(1+\sin^2(t))^2}, \\ \dot{y}(t) &= \frac{a \cos(2t)}{1+\sin^2(t)} - \frac{a\sin^2(2t)}{2(1+\sin^2(t))^2}, \\ \dot{z}(t) &= -bc\sin(ct). \end{align} The second derivatives (components of the acceleration) are too tedious to compute so I suggest using wolfram alpha or some symbolic solver to do that for you.