Least-squares determination of molecular structures from gaseous electron-diffraction data: I. Slope and curvature criteria for background