In order to simulate an airplane model, I need to change its orientation knowing the curvature of its trajectory.
The simulator gives me the plane position, so in order to perform my orientation calculus I need to know the curvature of the trajectory.
So, having its trajectory history (I can choose how many previous positions use), how can I calculate the curvature of this 3D trajectory?
In a real-life situation, you'll probably want to take redundant measurements and do a fit and/or remove outliers and things like that to improve the robustness, but if you regard the measurements as exact, three positions suffice. Measure them at times $t=-\Delta t,0,\Delta t$, call the results $x_{-1},x_0,x_1$, respectively, and calculate the curvature $\kappa$ according to
$$ \begin{eqnarray} \dot x&\simeq&\frac12\frac {x_1-x_{-1}}{\Delta t}\;,\\ \ddot x&\simeq&\frac{x_1+x_{-1}-2x_0}{\Delta t^2}\;,\\ \kappa&=&\frac{\left|\ddot x_\perp\right|}{\left|\dot x\right|^2}= \frac{\left|\ddot x-\frac{\ddot x\cdot\dot x}{\dot x\cdot\dot x}\dot x\right|}{\left|\dot x\right|^2}= \frac{\left|\ddot x\left(\dot x\cdot\dot x\right)-\left(\ddot x\cdot\dot x\right)\dot x\right|}{\left(\dot x\cdot\dot x\right)\left(\dot x\cdot\dot x\right)}\;. \end{eqnarray} $$
(The $\Delta t$ drops out, so you might as well leave it out; it's just there so that $\dot x$ and $\ddot x$ have their usual meanings.)