Least squares estimation of curvature and torsion