Least squares fitting of conic sections with type identification by