Fit a cubic function to a point cloud