The task of estimating the correct point at time T given past times is called Filtering in statistics. This is exactly what's happening here so it's the perfect fit :) Should eliminate the input lag (provided computations are not too slow).
https://en.wikipedia.org/wiki/Kalman_filter
Just putting it here as reminder, I may do it myself if I manage to find in which part of my brain I lost all my C++ knowledge.