Perfect splines and nonlinear optimal control theory