adding functionality for traj closest point costs